/* ============================================
   Markdown Resume Builder — Styles
   Theme: Blue/Slate split editor
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #2563EB;
    --primary-hover: #3B82F6;
    --secondary: #60A5FA;
    --bg: #0F172A;
    --bg-editor: #1E293B;
    --bg-preview: #ffffff;
    --bg-card: rgba(30, 41, 59, 0.9);
    --border: rgba(37, 99, 235, 0.2);
    --border-hover: rgba(37, 99, 235, 0.4);
    --text: #E2E8F0;
    --text-muted: #94A3B8;
    --text-dim: #64748B;
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', monospace;
    --transition: 200ms ease;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Header --- */
.app-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1.25rem;
    z-index: 100;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.control-group-inline {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.control-group-inline label {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.select-sm {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 0.28rem 0.4rem;
    font-size: 0.78rem;
    font-family: var(--font);
    cursor: pointer;
}

.select-sm:focus {
    outline: none;
    border-color: var(--primary);
}

.color-input {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: transparent;
    padding: 2px;
}

.header-actions {
    display: flex;
    gap: 0.3rem;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.7rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--font);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
}

.btn-xs {
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-dim);
}

.btn-xs:hover {
    border-color: var(--primary);
    color: var(--secondary);
    background: rgba(37, 99, 235, 0.08);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- Split Layout --- */
.app-main {
    flex: 1;
    overflow: hidden;
}

.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

/* --- Editor Panel --- */
.editor-panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.toolbar-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
}

.insert-buttons {
    display: flex;
    gap: 0.2rem;
    flex-wrap: wrap;
}

.md-editor {
    flex: 1;
    width: 100%;
    background: var(--bg-editor);
    border: none;
    color: var(--text);
    padding: 1rem;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.7;
    resize: none;
    tab-size: 2;
    outline: none;
}

.md-editor::placeholder {
    color: var(--text-dim);
}

/* --- Preview Panel --- */
.preview-panel {
    display: flex;
    flex-direction: column;
    background: #334155;
}

.preview-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    justify-content: center;
}

.resume-page {
    background: var(--bg-preview);
    color: #1a1a1a;
    width: 100%;
    max-width: 210mm;
    min-height: 297mm;
    padding: 2rem 2.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
}

/* Resume base styles */
.resume-page h1 {
    font-size: 1.8em;
    margin: 0 0 0.3em;
}

.resume-page h2 {
    font-size: 1.15em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--primary, #2563EB);
    padding-bottom: 0.25em;
    margin: 1.2em 0 0.5em;
}

.resume-page h3 {
    font-size: 1em;
    margin: 0.6em 0 0.15em;
}

.resume-page p {
    margin: 0.25em 0;
}

.resume-page ul {
    margin: 0.25em 0;
    padding-left: 1.4em;
}

.resume-page li {
    margin: 0.15em 0;
}

.resume-page a {
    color: var(--primary, #2563EB);
    text-decoration: none;
}

.resume-page strong {
    font-weight: 600;
}

.resume-page em {
    font-style: italic;
}

.resume-page hr {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 0.75em 0;
}

/* --- Print Styles --- */
.print-only {
    display: none;
}

@media print {
    body>*:not(.print-only) {
        display: none !important;
    }

    .print-only {
        display: block !important;
        width: 100%;
    }

    .print-only .resume-page {
        background: white;
        color: #1a1a1a;
        padding: 0;
        box-shadow: none;
        max-width: none;
        min-height: auto;
    }

    @page {
        margin: 0.5in;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .split-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .editor-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .header-controls {
        flex-wrap: wrap;
    }
}