/* ============================================================
   1. TOOL VISIBILITY TOGGLES
   ============================================================ */

.hidden-file-input {
    display: none;
}

#tool-container {
    display: none;
}
#tool-container.is-visible {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#preview-section {
    display: none;
}
#preview-section.is-visible {
    display: grid;
}

#advanced-settings {
    display: none;
}
#advanced-settings.is-visible {
    display: block;
}

#download-button {
    display: none;
}
#download-button.is-visible {
    display: inline-flex;
}
 /* Advanced settings panel - hidden by default */
    #advanced-card {
        display: none;
    }

/* ============================================================
   2. PREVIEW IMAGE & FRAME
   ============================================================ */

.image-frame {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px; 
}

.preview-image {
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}

canvas.preview-image {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
}
/* ============================================================
   3. PLACEHOLDERS (unified naming — all tools)
   ============================================================ */

.opacity-placeholder,
.split-placeholder,
.rotate-placeholder,
.favicon-placeholder,
.result-placeholder,
.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    width: 100%;
    color: #9ca3af;
    font-size: 0.95rem;
    background: #f8fafc;
    border-radius: 12px;
    text-align: center;
    padding: 16px;
}

.opacity-placeholder.is-hidden,
.split-placeholder.is-hidden,
.rotate-placeholder.is-hidden,
.favicon-placeholder.is-hidden,
.result-placeholder.is-hidden,
.preview-placeholder.is-hidden {
    display: none;
}


/* ============================================================
   4. ACTION BUTTONS ROW (all tools)
   ============================================================ */

.action-buttons-row,
.format-actions-row,
.grayscale-actions-row {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}


/* ============================================================
   5. CENTERED FIELD
   ============================================================ */

.format-field-center {
    margin: 0 auto;
}


/* ============================================================
   6. LOADING INDICATOR
   ============================================================ */

#loading {
    display: none;
    text-align: center;
    margin: 16px 0;
    font-size: 1rem;
    color: var(--t-primary, #4f46e5);
    font-weight: 600;
}
#loading.is-visible {
    display: block;
}

#loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(79, 70, 229, 0.25);
    border-radius: 50%;
    border-top-color: var(--t-primary, #4f46e5);
    animation: tool-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes tool-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


/* ============================================================
   7. SELECTION OVERLAY (canvas-based tools)
   ============================================================ */

.selection-overlay {
    position: absolute;
    border: 2px dashed var(--primary-color, #4a6bff);
    background: rgba(74, 107, 255, 0.12);
    pointer-events: none;
    display: none;
    border-radius: 4px;
}
.selection-overlay.is-visible {
    display: block;
}


/* ============================================================
   8. PRESET BUTTON
   ============================================================ */

.preset-btn {
    padding: 10px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 10px;
    border: 1.5px solid var(--t-border-strong, #d5dbe5);
    background: #ffffff;
    color: var(--t-text, #0b1220);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 44px;
    font-family: inherit;
}
.preset-btn:hover {
    border-color: var(--t-primary, #4f46e5);
    color: var(--t-primary, #4f46e5);
    transform: translateY(-1px);
}
.preset-btn.is-active {
    background: var(--t-primary, #4f46e5);
    border-color: var(--t-primary, #4f46e5);
    color: #ffffff;
}


/* ============================================================
   9. RESPONSIVE
   ============================================================ */

@media (max-width: 600px) {
    .action-buttons-row,
    .format-actions-row,
    .grayscale-actions-row {
        flex-direction: column;
        align-items: stretch;
    }
    .action-buttons-row .btn,
    .format-actions-row .btn,
    .grayscale-actions-row .btn {
        width: 100%;
    }

    #tool-container.is-visible {
        gap: 16px;
    }

    .preview-image {
        max-height: 320px;
    }
}
