/* ═══════════════════════════════════════════════════════════════════════════════
   SGraph Send — Download Component Styles
   v0.2.0 — Preview layout, zip browser, and responsive overrides
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Keep non-preview siblings centred when main expands */
main.preview-expanded > *:not(send-download) {
    max-width: 672px;
    margin-left: auto;
    margin-right: auto;
}

/* Details panel — enable container queries */
#details-panel {
    container-type: inline-size;
}

/* Compact transparency inside details sidebar */
#details-panel .transparency {
    padding: var(--space-3, 12px) var(--space-4, 16px);
}
#details-panel .transparency__title {
    font-size: var(--text-small, 0.8rem);
    margin-bottom: var(--space-2, 0.5rem);
}
#details-panel .transparency__section-label {
    text-transform: none;
    font-size: var(--text-small, 0.8rem);
    letter-spacing: normal;
    color: var(--accent, #4ECDC4);
    border-left: 2px solid var(--accent, #4ECDC4);
    padding-left: var(--space-2, 0.5rem);
    margin-top: var(--space-3, 0.75rem);
    margin-bottom: var(--space-1, 0.25rem);
}
#details-panel .transparency__row {
    padding: 2px 0;
    font-size: var(--text-small, 0.8rem);
    flex-direction: column;
    gap: 1px;
}
#details-panel .transparency__value {
    font-size: var(--text-small, 0.8rem);
}
#details-panel .transparency__footer {
    font-size: var(--text-small, 0.8rem);
    margin-top: var(--space-2, 0.5rem);
    padding-top: var(--space-2, 0.5rem);
}

/* Details panel — compact when narrow */
@container (max-width: 280px) {
    #details-panel > div:first-child h3 { font-size: 0.95rem !important; }
    #details-panel .btn { font-size: 0.8rem !important; padding: 0.5rem 0.75rem !important; }
    #details-panel .btn#save-file-btn { padding: 0.65rem 0.75rem !important; font-size: 0.85rem !important; }
    #details-panel .transparency { padding: 8px 10px; }
    #details-panel .transparency__title { font-size: 0.75rem; }
    #details-panel .transparency__section-label { font-size: 0.7rem; margin-top: 8px; }
    #details-panel .transparency__row { font-size: 0.7rem; }
    #details-panel .transparency__value { font-size: 0.7rem; }
    #details-panel .transparency__footer { font-size: 0.7rem; }
}

/* ─── Zip Header ───────────────────────────────────────────────────── */

.zip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3, 0.75rem);
    margin-bottom: var(--space-3, 0.75rem);
    padding: var(--space-3, 0.75rem) var(--space-4, 1rem);
    background: var(--bg-secondary, #16213E);
    border: 1px solid var(--color-border, rgba(78,205,196,0.15));
    border-radius: var(--radius-md, 8px);
}

.zip-header__info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2, 0.5rem);
    min-width: 0;
}

.zip-header__name {
    margin: 0;
    font-size: var(--text-body, 1rem);
    font-weight: var(--weight-bold, 700);
    color: var(--color-text, #E0E0E0);
    word-break: break-all;
}

.zip-header__badge {
    font-size: var(--text-small, 0.8rem);
    color: var(--accent, #4ECDC4);
    font-family: var(--font-mono, monospace);
    background: var(--accent-subtle, rgba(78,205,196,0.1));
    padding: 1px 8px;
    border-radius: var(--radius-sm, 4px);
}

.zip-header__size,
.zip-header__summary {
    font-size: var(--text-small, 0.8rem);
    color: var(--color-text-secondary, #8892A0);
    font-family: var(--font-mono, monospace);
}

.zip-header__actions {
    display: flex;
    gap: var(--space-2, 0.5rem);
    flex-shrink: 0;
}

/* ─── Zip Browser (folder tree + file list) ────────────────────────── */

.zip-browser {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    border: 1px solid var(--color-border, rgba(78,205,196,0.15));
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    margin-bottom: var(--space-3, 0.75rem);
    max-height: 200px;
    font-size: var(--text-small, 0.8rem);
    font-family: var(--font-mono, monospace);
    line-height: 1.5;
}

.zip-browser__folders {
    background: var(--bg-secondary, #16213E);
    border-right: 1px solid var(--color-border, rgba(78,205,196,0.15));
    overflow-y: auto;
    padding: var(--space-2, 0.5rem);
}

.zip-browser__files {
    overflow-y: auto;
    padding: var(--space-2, 0.5rem);
}

/* Folder tree items */
.zip-folder-item {
    padding: 3px 6px;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    color: var(--accent, #4ECDC4);
    font-weight: var(--weight-semibold, 600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.1s;
}
.zip-folder-item:hover {
    background: rgba(78, 205, 196, 0.08);
}
.zip-folder-item--selected {
    background: rgba(78, 205, 196, 0.15);
    outline: 1px solid rgba(78, 205, 196, 0.3);
}

.zip-folder-nested {
    padding-left: var(--space-3, 0.75rem);
    border-left: 1px solid rgba(78, 205, 196, 0.1);
    margin-left: 6px;
}

/* File list items */
.zip-file-item {
    display: flex;
    align-items: center;
    gap: var(--space-2, 0.5rem);
    padding: 3px 6px;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: background 0.1s;
}
.zip-file-item:hover {
    background: rgba(78, 205, 196, 0.08);
}
.zip-file-item--selected {
    background: rgba(78, 205, 196, 0.15);
    outline: 1px solid rgba(78, 205, 196, 0.3);
}

.zip-file-item__icon {
    flex-shrink: 0;
    width: 1.2em;
    text-align: center;
}

.zip-file-item__name {
    color: var(--color-text, #E0E0E0);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.zip-file-item__size {
    color: var(--color-text-secondary, #8892A0);
    white-space: nowrap;
    flex-shrink: 0;
}

.zip-file-list__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-secondary, #8892A0);
    font-style: italic;
    padding: var(--space-4, 1rem);
}

/* ─── Zip Preview ──────────────────────────────────────────────────── */

.zip-preview {
    overflow: auto;
    border: 2px solid var(--accent, #4ECDC4);
    border-radius: var(--radius-md, 8px);
    background: var(--bg-secondary, #16213E);
    min-height: 200px;
    margin-bottom: var(--space-4, 1rem);
}

.zip-preview__empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: var(--color-text-secondary, #8892A0);
    font-size: var(--text-sm, 0.875rem);
    padding: var(--space-6, 1.5rem);
    text-align: center;
}

/* ─── Mobile Responsive ────────────────────────────────────────────── */

/* Two-column preview: stack vertically on mobile */
@media (max-width: 768px) {
    #preview-split {
        grid-template-columns: 1fr !important;
        grid-template-rows: minmax(250px, 50vh) auto !important;
        max-height: none !important;
        height: auto !important;
    }
    #split-resize { display: none !important; }
    #preview-panel { order: -1; }
    #details-panel { padding-right: 0 !important; }

    /* Zip browser: stack folders above files on mobile */
    .zip-browser {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        max-height: 300px;
    }
    .zip-browser__folders {
        border-right: none;
        border-bottom: 1px solid var(--color-border, rgba(78,205,196,0.15));
        max-height: 120px;
    }
}
