/* ── export-studio.css ──────────────────────────────────
   Styles for the Export Studio modal (ADR-0005).
   30/70 split layout with glassmorphic backdrop, accordion
   config panel, and live preview pane.
   ───────────────────────────────────────────────────── */

/* ════════════════════════════════════════════════════════
   MODAL SHELL — Full-screen overlay with glassmorphism
   ════════════════════════════════════════════════════════ */

.export-studio-content {
    max-width: 1100px;
    width: 96vw;
    height: 82vh;
    display: flex;
    flex-direction: column;
}

.export-studio-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
    padding: 0 !important;
}

/* ════════════════════════════════════════════════════════
   LEFT PANEL — Config Accordion (30%)
   ════════════════════════════════════════════════════════ */

.export-studio-config {
    width: 30%;
    min-width: 260px;
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--color-bg-secondary);
}

/* Accordion Sections */
.export-accordion-section {
    border-bottom: 1px solid var(--color-border);
}

.export-accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    font-family: var(--font-family);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.export-accordion-header:hover {
    background: var(--color-bg-tertiary);
}

.export-accordion-header .material-symbols-outlined {
    font-size: 18px;
    color: var(--color-text-secondary);
}

.accordion-chevron {
    margin-left: auto;
    transition: transform 0.2s ease;
    font-size: 16px !important;
    color: var(--color-text-tertiary) !important;
}

.export-accordion-section.open .accordion-chevron {
    transform: rotate(180deg);
}

.export-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, padding 0.25s ease;
    padding: 0 16px;
}

.export-accordion-section.open .export-accordion-body {
    max-height: 500px;
    padding: 0 16px 14px;
}

/* ── Export Type Grid ─────────────────────── */

.export-type-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-type-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 12px;
    color: var(--color-text-secondary);
    transition: background 0.12s, color 0.12s;
    position: relative;
}

.export-type-option input[type="radio"] {
    display: none;
}

.export-type-option:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
}

.export-type-option.active {
    background: rgba(59, 111, 217, 0.12);
    color: var(--color-primary);
    font-weight: 600;
}

.export-type-option .material-symbols-outlined {
    font-size: 18px;
}

/* Tier badges */
.export-tier-badge {
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.5px;
}

.pro-badge {
    background: rgba(255, 179, 0, 0.15);
    color: #FFB300;
}

.team-badge {
    background: rgba(0, 188, 212, 0.12);
    color: #00BCD4;
}

/* ── Theme Selector Grid ─────────────────── */

.export-theme-grid {
    display: flex;
    gap: 8px;
}

.export-theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 11px;
    color: var(--color-text-secondary);
    transition: background 0.12s;
    flex: 1;
    text-align: center;
}

.export-theme-option input[type="radio"] {
    display: none;
}

.export-theme-option:hover {
    background: var(--color-bg-tertiary);
}

.export-theme-option.active {
    background: rgba(59, 111, 217, 0.12);
    color: var(--color-primary);
    font-weight: 600;
}

.theme-swatch {
    width: 32px;
    height: 22px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* ── Export Action Bar ────────────────────── */

.export-action-bar {
    padding: 14px 16px;
    margin-top: auto;
    border-top: 1px solid var(--color-border);
}

.export-go-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
}

/* ════════════════════════════════════════════════════════
   RIGHT PANEL — Live Preview (70%)
   ════════════════════════════════════════════════════════ */

.export-studio-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg-primary);
    position: relative;
    overflow: hidden;
}

.export-preview-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg-secondary);
}

.export-preview-label .material-symbols-outlined {
    font-size: 16px;
}

.export-preview-canvas {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: auto;
    /* A flat, slightly recessed surface for the sheet to sit on. The old
       checkerboard was meant to show transparency, but no export here is
       transparent — every theme paints a solid page — so it only added
       noise around the preview. */
    background: var(--color-bg-tertiary);
}

/* A PDF preview takes a moment to rebuild; keep the last one on screen and say so */
.export-preview-canvas.is-building::after {
    content: 'Updating preview…';
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    pointer-events: none;
}

.export-preview-canvas svg,
.export-preview-canvas img,
.export-preview-canvas iframe {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

/* The frame fills the pane; the SVG shell and the PDF viewer inside do their own fitting */
.export-preview-canvas iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

/* Shown when there is no document to frame: nothing drawn yet, plan-locked, or still building */
.export-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    max-width: 340px;
    color: var(--color-text-tertiary);
    font-size: 12px;
    text-align: center;
}

.export-preview-placeholder .material-symbols-outlined {
    font-size: 48px;
    opacity: 0.3;
}

.export-preview-placeholder h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
}

.export-preview-placeholder p {
    margin: 0;
    line-height: 1.5;
}

/* Spin the icon while a PDF is being built so the pane doesn't look frozen */
.export-preview-placeholder.is-busy .material-symbols-outlined {
    opacity: 0.6;
    animation: export-preview-spin 1s linear infinite;
}

@keyframes export-preview-spin {
    to { transform: rotate(360deg); }
}

.export-preview-placeholder .export-preview-upgrade {
    margin-top: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE — Collapse to stacked layout on small screens
   ════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .export-studio-body {
        flex-direction: column;
    }

    .export-studio-config {
        width: 100%;
        min-width: unset;
        max-height: 45%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .export-studio-preview {
        min-height: 40%;
    }
}

/* ════════════════════════════════════════════════════════
   PRINT CSS — Hide Export Studio chrome during printing
   ════════════════════════════════════════════════════════ */

@media print {
    #export-studio-modal {
        display: none !important;
    }
}
