/* =========================
   IMAGE FORMAT CONVERTER
   ========================= */

.format-converter-section {
    --format-danger: #b42318;
    --format-success: #2f7d4a;
    --format-working: #805019;

    max-width: var(--tc-max-width);
    margin-inline: auto;
}

.format-converter-card [hidden] {
    display: none !important;
}


/* =========================
   MAIN CARD
   ========================= */

.format-converter-card {
    margin-top: 2.5rem;
    padding: clamp(1.1rem, 4vw, 2.5rem);

    background: var(--tc-white);
    border: 1px solid var(--tc-border);
    border-radius: 24px;

    box-shadow:
        0 24px 70px rgba(23, 36, 51, 0.1);
}


/* =========================
   UPLOAD AREA
   ========================= */

.format-drop-zone {
    padding: clamp(2.5rem, 8vw, 5rem) 1.5rem;

    text-align: center;

    background: rgba(166, 106, 36, 0.04);
    border: 2px dashed var(--tc-border);
    border-radius: 20px;

    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        transform 180ms ease;
}

.format-drop-zone.drag-active {
    background: rgba(166, 106, 36, 0.12);
    border-color: var(--tc-copper);
    transform: scale(1.01);
}

.format-drop-zone h3 {
    margin: 1rem 0 0.5rem;
    font-size: clamp(1.25rem, 3vw, 1.6rem);
}

.format-drop-zone>p:not(.status-message) {
    margin: 0 0 1.5rem;
}

.format-drop-zone .status-message {
    text-align: center;
}


/* =========================
   SETTINGS
   ========================= */

.format-settings {
    display: grid;
    grid-template-columns:
        minmax(220px, 0.8fr) minmax(280px, 1.5fr);
    align-items: end;
    gap: 1.5rem;

    padding: 1.25rem;

    background: var(--tc-cream);
    border: 1px solid var(--tc-border);
    border-radius: 16px;
}

.format-converter-section .setting-field {
    display: grid;
    gap: 0.55rem;
}

.format-converter-section .setting-field>span {
    color: var(--tc-heading);
    font-size: 0.9rem;
    font-weight: 700;
}

.format-converter-section .setting-field select {
    width: 100%;
    min-height: 50px;
    padding: 0.75rem 0.9rem;

    color: var(--tc-heading);

    background: var(--tc-white);
    border: 1px solid var(--tc-border);
    border-radius: 10px;

    outline: none;
}

.format-converter-section .setting-field select:focus {
    border-color: var(--tc-copper);

    box-shadow:
        0 0 0 3px rgba(166, 106, 36, 0.16);
}


/* Quality */

.quality-setting {
    display: grid;
    gap: 0.7rem;
}

.setting-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.setting-label-row label {
    color: var(--tc-heading);
    font-size: 0.9rem;
    font-weight: 700;
}

.setting-label-row output {
    min-width: 62px;
    padding: 0.25rem 0.55rem;

    color: var(--tc-copper-dark);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;

    background: rgba(166, 106, 36, 0.1);
    border-radius: 999px;
}

.quality-setting input[type="range"] {
    width: 100%;

    accent-color: var(--tc-copper);
    cursor: pointer;
}

.quality-setting input[type="range"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.quality-setting.is-disabled {
    opacity: 0.55;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    gap: 1rem;

    color: var(--tc-text-muted);
    font-size: 0.72rem;
}


/* =========================
   QUEUE HEADING
   ========================= */

.queue-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;

    margin-top: 2rem;
    padding-bottom: 1rem;

    border-bottom: 1px solid var(--tc-border);
}

.queue-heading h3 {
    margin: 0 0 0.2rem;
    font-size: 1.15rem;
}

.queue-heading p {
    margin: 0;

    color: var(--tc-text-muted);
    font-size: 0.85rem;
}

.queue-heading-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}


/* =========================
   IMAGE QUEUE
   ========================= */

.image-queue {
    display: grid;
    gap: 0.85rem;

    margin-top: 1rem;
}

.format-item {
    display: grid;
    grid-template-columns:
        92px minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;

    padding: 0.85rem;

    background: var(--tc-white);
    border: 1px solid var(--tc-border);
    border-radius: 14px;

    transition:
        border-color 180ms ease,
        background-color 180ms ease,
        box-shadow 180ms ease;
}

.format-item.is-converted {
    background: rgba(47, 125, 74, 0.035);
    border-color: rgba(47, 125, 74, 0.35);

    box-shadow:
        0 8px 24px rgba(47, 125, 74, 0.06);
}

.format-item.is-error {
    border-color: rgba(180, 35, 24, 0.4);
}


/* Thumbnail */

.format-thumbnail {
    display: grid;
    place-items: center;

    width: 92px;
    height: 76px;

    overflow: hidden;

    background-color: #eeeeec;

    background-image:
        linear-gradient(45deg,
            #ddddda 25%,
            transparent 25%),
        linear-gradient(-45deg,
            #ddddda 25%,
            transparent 25%),
        linear-gradient(45deg,
            transparent 75%,
            #ddddda 75%),
        linear-gradient(-45deg,
            transparent 75%,
            #ddddda 75%);

    background-position:
        0 0,
        0 10px,
        10px -10px,
        -10px 0;

    background-size: 20px 20px;

    border-radius: 10px;
}

.format-thumbnail img {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}


/* File information */

.format-item-information {
    min-width: 0;
}

.format-item-information h4 {
    margin: 0 0 0.3rem;

    color: var(--tc-heading);
    font-size: 0.95rem;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.format-item-information p {
    margin: 0;

    color: var(--tc-text-muted);
    font-size: 0.78rem;
}

.format-result-information {
    margin-top: 0.3rem !important;

    color: var(--tc-copper-dark) !important;
    font-weight: 700;
}


/* Item actions */

.format-item-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.item-status {
    padding: 0.28rem 0.6rem;

    color: var(--tc-text-muted);
    font-size: 0.72rem;
    font-weight: 700;

    background: var(--tc-cream);
    border-radius: 999px;
}

.item-status.status-working {
    color: var(--format-working);
    background: rgba(166, 106, 36, 0.1);
}

.item-status.status-success {
    color: var(--format-success);
    background: rgba(47, 125, 74, 0.1);
}

.item-status.status-error {
    color: var(--format-danger);
    background: rgba(180, 35, 24, 0.1);
}

.remove-image-button {
    padding: 0.55rem 0.7rem;

    color: var(--format-danger);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;

    background: transparent;
    border: 1px solid rgba(180, 35, 24, 0.25);
    border-radius: 8px;

    cursor: pointer;
}

.remove-image-button:hover {
    background: rgba(180, 35, 24, 0.06);
}

.download-image-button {
    min-height: 38px;
    padding: 0.55rem 0.8rem;

    font-size: 0.78rem;
}

.download-image-button:disabled,
.remove-image-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* =========================
   MAIN ACTIONS AND STATUS
   ========================= */

.format-actions {
    display: flex;
    justify-content: flex-end;

    margin-top: 1.5rem;
    padding-top: 1.5rem;

    border-top: 1px solid var(--tc-border);
}

.format-actions .btn:disabled,
.queue-heading-actions .btn:disabled {
    opacity: 0.48;
    cursor: not-allowed;
    transform: none;
}

.format-converter-section .status-message {
    min-height: 1.5rem;
    margin-top: 1rem;

    text-align: right;
}

.format-converter-section .status-message.status-working {
    color: var(--format-working);
}

.format-converter-section .status-message.status-success {
    color: var(--format-success);
}

.format-converter-section .status-message.status-error {
    color: var(--format-danger);
}


/* =========================
   RESPONSIVE DESIGN
   ========================= */

@media (max-width: 800px) {
    .format-settings {
        grid-template-columns: 1fr;
    }

    .queue-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 650px) {
    .format-converter-card {
        padding: 1rem;
        border-radius: 18px;
    }

    .format-item {
        grid-template-columns: 72px minmax(0, 1fr);
    }

    .format-thumbnail {
        width: 72px;
        height: 64px;
    }

    .format-item-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
    }

    .queue-heading-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;

        width: 100%;
    }

    .queue-heading-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .format-actions {
        display: grid;
    }

    .format-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .format-converter-section .status-message {
        text-align: center;
    }
}

@media (max-width: 420px) {
    .format-item {
        grid-template-columns: 1fr;
    }

    .format-thumbnail {
        width: 100%;
        height: 160px;
    }

    .format-item-information h4 {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .format-item-actions {
        grid-column: auto;
    }

    .queue-heading-actions {
        grid-template-columns: 1fr;
    }
}