/* ============================================================
   RESUMER — Layout: Header, Navigation, Controls, Containers
   Uses design tokens from app.css
   ============================================================ */

/* ────── Header ────── */
#compact-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--surface-header);
    padding: 0 20px;
    box-shadow: var(--shadow-header);
    z-index: var(--z-header);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    height: var(--header-height);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* ────── Brand ────── */
.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--duration-fast);
    user-select: none;
    flex-shrink: 0;
}

.brand:hover {
    background: rgba(255, 255, 255, 0.06);
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-gradient);
    color: white;
    font-size: 17px;
    flex-shrink: 0;
}

.brand-name {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* ────── Inline Navigation (center) ────── */
.inline-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    justify-self: center;
    background: rgba(255, 255, 255, 0.06);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-tab-btn {
    background: transparent;
    color: var(--text-on-header-muted);
    border: none;
    padding: 7px 16px;
    font-size: var(--font-size-base);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all var(--duration-normal) var(--ease-default);
    border-radius: var(--radius-sm);
    position: relative;
    letter-spacing: 0.2px;
    font-family: var(--font-sans);
    height: 34px;
}

.nav-tab-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-tab-btn.active {
    color: #ffffff;
    background: var(--brand-gradient);
    box-shadow: 0 2px 8px rgba(79, 109, 245, 0.4);
}

.nav-tab-btn .iconify {
    font-size: 16px;
}

@media (max-width: 768px) {
    .nav-label { display: none; }
    .nav-tab-btn { padding: 8px 10px; }
    .btn-label { display: none; }
}

/* ────── Header Right Controls ────── */
.header-right-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

/* ────── Icon Buttons (theme, shortcuts) ────── */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-on-header-muted);
    cursor: pointer;
    transition: all var(--duration-fast);
    font-size: 18px;
    padding: 0;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.icon-btn .iconify {
    font-size: 18px;
}

/* ────── Resume Type Selector ────── */
#resume-type-selector {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.resume-type-btn-compact {
    padding: 6px 12px;
    background: transparent;
    color: var(--text-on-header-muted);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: all var(--duration-normal) var(--ease-default);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.3px;
    font-family: var(--font-sans);
    height: 30px;
}

.resume-type-btn-compact:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.resume-type-btn-compact.active {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(79, 109, 245, 0.4);
}

.resume-type-btn-compact .iconify {
    font-size: 13px;
}

/* ────── Control Actions (Edit, Save, Download, Print) ────── */
.control-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.control-actions button {
    padding: 7px 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: 600;
    font-family: var(--font-sans);
    transition: all var(--duration-fast) var(--ease-default);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-on-header-muted);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
}

.control-actions button:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.control-actions button:active {
    transform: scale(0.97);
}

.control-actions button .iconify {
    font-size: 16px;
}

/* Specific button accent colors on hover */
#download-button:hover { background: rgba(245, 158, 11, 0.25) !important; color: #fcd34d !important; }
#print-button:hover { background: rgba(168, 85, 247, 0.25) !important; color: #c4b5fd !important; }

/* ────── Edit Mode Actions ────── */
.edit-actions {
    gap: 10px !important;
}

.btn-discard {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.btn-discard:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    color: #fee2e2 !important;
}

.btn-save {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #86efac !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.btn-save:hover {
    background: rgba(34, 197, 94, 0.35) !important;
    color: #dcfce7 !important;
}

.control-actions input {
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-base);
    font-weight: 500;
    font-family: var(--font-sans);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-on-header);
    width: 140px;
    height: 34px;
    transition: all var(--duration-fast);
}

.control-actions input:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(79, 109, 245, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.control-actions input::placeholder {
    color: var(--text-on-header-muted);
}

/* ────── Left Floating Toolbar ────── */
#left-toolbar {
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: var(--status-bar-height);
    width: var(--left-toolbar-width);
    background: var(--surface-header);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.25);
    z-index: calc(var(--z-header) - 1);
    display: flex;
    flex-direction: column;
    padding: 10px 8px;
    gap: 4px;
    overflow-y: auto;
    overflow-x: visible;
}

.lt-actions {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
}

.lt-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 3px 0;
    flex-shrink: 0;
}

#left-toolbar .lt-actions button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    padding: 8px 10px;
    height: auto;
    min-height: 34px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    font-family: var(--font-sans);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-on-header-muted);
    transition: all var(--duration-fast) var(--ease-default);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

#left-toolbar .lt-actions button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

#left-toolbar .lt-actions button:active {
    transform: scale(0.97);
}

#left-toolbar .lt-actions button .iconify {
    font-size: 16px;
    flex-shrink: 0;
}

#download-button:hover { background: rgba(245, 158, 11, 0.25) !important; color: #fcd34d !important; }
#print-button:hover    { background: rgba(168, 85, 247, 0.25) !important; color: #c4b5fd !important; }

.lt-edit-actions button { background: transparent !important; }

.lt-actions .btn-discard {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}
.lt-actions .btn-discard:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    color: #fee2e2 !important;
}
.lt-actions .btn-save {
    background: rgba(34, 197, 94, 0.2) !important;
    color: #86efac !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
}
.lt-actions .btn-save:hover {
    background: rgba(34, 197, 94, 0.35) !important;
    color: #dcfce7 !important;
}

#left-toolbar input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    font-family: var(--font-sans);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-on-header);
    height: 30px;
    transition: all var(--duration-fast);
}

#left-toolbar input[type="text"]:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px rgba(79, 109, 245, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

#left-toolbar input[type="text"]::placeholder {
    color: var(--text-on-header-muted);
}

#left-toolbar .export-drop,
#left-toolbar .import-drop {
    position: relative;
    width: 100%;
}

/* Dropdowns open to the RIGHT of the left toolbar */
#left-toolbar .export-menu,
#left-toolbar .import-menu {
    top: 0;
    left: 100%;
    right: auto;
    margin-left: 4px;
}

/* ────── Content area: shift right to clear the left toolbar ────── */
.resume-workspace {
    margin-left: var(--left-toolbar-width);
}

.cl-workspace {
    margin-left: var(--left-toolbar-width);
    padding-top: var(--header-height);
}

#ats-checker-tab {
    padding-left: var(--left-toolbar-width);
}

/* ────── Zoom Controls ────── */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(255, 255, 255, 0.06);
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.zoom-controls button {
    padding: 4px 6px !important;
    background: transparent !important;
    min-width: auto !important;
    border-radius: 4px !important;
    border: none !important;
    transition: all var(--duration-fast) !important;
    box-shadow: none !important;
    color: var(--text-on-header-muted) !important;
    cursor: pointer;
}

.zoom-controls button:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #ffffff !important;
}

.zoom-controls span:not(.iconify) {
    color: var(--text-on-header-muted);
    font-size: var(--font-size-xs);
    font-weight: 600;
    min-width: 36px;
    text-align: center;
}

.zoom-controls .iconify {
    font-size: 14px;
    color: var(--text-on-header-muted);
}

/* ────── Tab Content ────── */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ────── Editor Containers ────── */
#editor-container {
    margin-top: var(--header-height);
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

#cover-editor-container {
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

#markdown-editor,
#cover-markdown-editor {
    width: 100%;
    min-height: 600px;
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.6;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    resize: vertical;
    box-sizing: border-box;
    background: var(--surface-card);
    color: var(--text-primary);
    transition: border-color var(--duration-fast);
}

#markdown-editor:focus,
#cover-markdown-editor:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-primary-soft);
}

.editor-help {
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--color-info-soft);
    border-left: 3px solid var(--color-info);
    border-radius: var(--radius-sm);
}

.editor-help p {
    margin: 0;
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

/* ────── Preview Containers ────── */
#preview-container {
    margin-top: var(--header-height);
    margin-bottom: var(--status-bar-height);
    width: 100%;
    padding: 0;
    background: var(--surface-app);
    transition: background var(--duration-slow);
}

#cover-preview-container {
    margin-top: 0;
    margin-bottom: var(--status-bar-height);
    max-width: 8.5in;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    background: var(--surface-app);
    transition: background var(--duration-slow);
}

#cover-letter-content {
    background: white;
    padding: 40px;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-md);
    min-height: 11in;
    border-radius: var(--radius-sm);
}

/* ────── Print Styles ────── */
@media print {
    #compact-header,
    #status-bar,
    #toast-container,
    #shortcut-modal,
    #left-toolbar {
        display: none !important;
    }

    #preview-container,
    #cover-preview-container {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    .resume-workspace {
        margin-left: 0 !important;
    }

    .cl-workspace {
        margin-left: 0 !important;
    }

    #ats-checker-tab {
        padding-left: 0 !important;
    }

    #cover-letter-content {
        margin-top: 0 !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    #resume-content {
        margin-top: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
    }

    body {
        max-width: 100%;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
    }

    h1:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
}

/* ────── Responsive ────── */
@media (max-width: 900px) {
    #compact-header {
        grid-template-columns: auto 1fr auto;
        gap: 8px;
        padding: 0 10px;
    }
    .header-divider { display: none; }
    .brand-name { display: none; }
}

@media (max-width: 640px) {
    /* ── Convert vertical left toolbar → horizontal bottom bar ── */
    #left-toolbar {
        flex-direction: row !important;
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        height: auto !important;
        min-height: 52px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding: 6px 10px !important;
        border-right: none !important;
        border-top: 1px solid rgba(255,255,255,0.12) !important;
        box-shadow: 0 -2px 16px rgba(0,0,0,0.35) !important;
        gap: 4px !important;
        align-items: center !important;
        scrollbar-width: none;
    }
    #left-toolbar::-webkit-scrollbar { display: none; }

    /* Actions row → horizontal */
    #left-toolbar .lt-actions {
        flex-direction: row;
        width: auto;
        flex-shrink: 0;
        gap: 4px;
    }

    /* Buttons sized for touch */
    #left-toolbar .lt-actions button {
        width: auto !important;
        flex-shrink: 0;
        padding: 8px 10px !important;
        min-height: 36px !important;
    }

    /* Company name input shorter */
    #left-toolbar input[type="text"] {
        width: 90px !important;
    }

    /* Dividers become vertical separators */
    #left-toolbar .lt-divider {
        width: 1px !important;
        height: 22px !important;
        margin: 0 2px !important;
    }

    /* Template layout selector is too verbose on mobile — hide it */
    #tpl-divider,
    #template-selector { display: none !important; }

    /* Content areas: remove left offset, add bottom padding for bar */
    .resume-workspace { margin-left: 0 !important; padding-bottom: 60px !important; }
    .cl-workspace    { margin-left: 0 !important; padding-bottom: 60px !important; }
    #ats-checker-tab { padding-left: 0 !important; padding-bottom: 60px !important; }
}

@media (max-width: 600px) {
    .header-right-controls { gap: 4px; }
    #resume-type-selector  { display: none !important; }
    /* ATS badge and shortcut button don't fit at this width */
    #ats-live-badge { display: none !important; }
    .header-right-controls .header-divider { display: none; }
}

/* ────── Left Toolbar: Layout section label + template buttons ────── */
.lt-section-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-on-header-muted);
    padding: 0 2px 2px;
    opacity: 0.6;
}

.lt-tpl-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 7px;
    padding: 7px 10px;
    height: auto;
    min-height: 30px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 500;
    font-family: var(--font-sans);
    background: transparent;
    color: var(--text-on-header-muted);
    transition: all var(--duration-fast) var(--ease-default);
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;
}

.lt-tpl-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.lt-tpl-btn.active {
    background: var(--brand-gradient);
    color: white;
    box-shadow: 0 2px 6px rgba(79, 109, 245, 0.35);
}

.lt-tpl-btn .iconify {
    font-size: 15px;
    flex-shrink: 0;
}

/* ────── Floating Customize FAB (palette icon on resume preview) ────── */
.preview-customize-fab {
    position: fixed;
    right: 20px;
    bottom: calc(var(--status-bar-height) + 20px);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-gradient);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 16px rgba(79, 109, 245, 0.45);
    z-index: calc(var(--z-header) - 2);
    transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}

.preview-customize-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(79, 109, 245, 0.6);
}

.preview-customize-fab .iconify {
    font-size: 22px;
}

/* Hide FAB when not on resume tab */
.preview-customize-fab.hidden {
    display: none;
}

/* ────── Zoom Controls in Status Bar ────── */
.status-zoom {
    display: flex !important;
    align-items: center;
    gap: 1px;
    padding: 0 2px;
}

.zoom-btn {
    background: transparent;
    border: none;
    color: var(--text-on-header-muted);
    cursor: pointer;
    padding: 1px 3px;
    border-radius: 3px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    height: 18px;
    transition: color var(--duration-fast), background var(--duration-fast);
}

.zoom-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.zoom-btn .iconify {
    font-size: 11px;
}

#zoom-level-resume {
    font-size: 10px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
    color: var(--text-on-header-muted);
    padding: 0 2px;
}
