/* ==========================================================================
   Autobot Resume Builder - Premium CSS Design System
   ========================================================================== */

/* Color Tokens & Reset */
:root {
    --bg-dark: #090b11;
    --bg-glass: rgba(15, 20, 32, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);
    --border-glass-active: rgba(255, 255, 255, 0.2);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.5);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #1f2937;
    --text-dark-muted: #4b5563;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* CV Specific Colors - Controlled by Themes */
    --cv-bg: #ffffff;
    --cv-text: #111827;
    --cv-text-muted: #4b5563;
    --cv-primary: #1e3a8a; /* Deep Navy Default */
    --cv-border: #e5e7eb;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Inter', 'Sarabun', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Gradients & Glow Effects */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}
.bg-glow-1 {
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation: pulseGlow 15s infinite alternate;
}
.bg-glow-2 {
    background: var(--accent);
    bottom: -100px;
    right: -100px;
    animation: pulseGlow 20s infinite alternate-reverse;
}

@keyframes pulseGlow {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(50px, 50px); }
}

/* App Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 460px 1fr;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* ==========================================================================
   1. Editor Panel (Left Column)
   ========================================================================== */
.editor-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    z-index: 10;
}

/* Header Area */
.app-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-glass);
}
.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}
.logo-icon i {
    font-size: 20px;
    color: white;
}
.logo-area h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sub-logo {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

/* Preset Picker */
.quick-load-presets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.btn-preset {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 12px;
    padding: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-preset:hover {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-main);
}
.btn-preset.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    color: white;
}

/* Navigation Tabs */
.form-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: 1px solid var(--border-glass);
    scrollbar-width: none; /* Firefox */
}
.form-tabs::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}
.tab-btn {
    flex: 0 0 auto;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    display: flex;
    align-items: center;
    gap: 6px;
}
.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}
.tab-btn.active {
    color: white;
    border-bottom-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

/* Form Content Body */
.form-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 20px;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 8px;
}

/* Form Elements */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.col-span-2 {
    grid-column: span 2;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}
.form-group label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}
.form-group input,
.form-group textarea {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    color: white;
    padding: 10px 12px;
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition);
}
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}
.form-tip {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Dynamic List Items (Experience, Education, etc.) */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.section-header-row .section-title {
    margin-bottom: 0;
    border: none;
    padding-bottom: 0;
}
.btn-add-item {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(168, 85, 247, 0.1));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 6px;
    color: #93c5fd;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}
.btn-add-item:hover {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.2);
    color: white;
}

.card-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    transition: var(--transition);
}
.card-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-glass-active);
}
.btn-delete-card {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: rgba(239, 68, 68, 0.6);
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}
.btn-delete-card:hover {
    color: #ef4444;
}

/* Editor Footer & AI Optimize Section */
.editor-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-glass);
    background: rgba(8, 10, 16, 0.8);
}
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    border-radius: 10px;
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    padding: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(168, 85, 247, 0.2);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.4), 0 0 15px rgba(59, 130, 246, 0.3);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-spinner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.hidden {
    display: none !important;
}

.ai-status-alert {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}
.ai-status-alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.ai-status-alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ==========================================================================
   2. Preview Panel & A4 Sheet (Right Column)
   ========================================================================== */
.preview-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Preview Toolbar */
.preview-toolbar {
    background: rgba(15, 20, 32, 0.4);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glass);
    padding: 14px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}
.theme-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}
.toolbar-label {
    font-size: 13px;
    color: var(--text-muted);
}
.btn-theme {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}
.btn-theme:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.08);
}
.btn-theme.active {
    background: white;
    border-color: white;
    color: var(--bg-dark);
    font-weight: 600;
}

.btn-print {
    background: #10b981;
    border: none;
    border-radius: 6px;
    color: white;
    font-family: inherit;
    font-weight: 600;
    font-size: 12px;
    padding: 8px 16px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.2);
}
.btn-print:hover {
    background: #059669;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* virtual A4 viewport */
.a4-page-scroll {
    flex: 1;
    overflow-y: auto;
    background: #121520;
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* virtual A4 page standard dimensions: 210mm x 297mm */
.a4-sheet {
    width: 210mm;
    min-height: 297mm;
    background-color: var(--cv-bg);
    color: var(--cv-text);
    padding: 20mm;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: var(--transition);
    font-size: 13.5px;
    line-height: 1.5;
}

/* ==========================================================================
   3. CV Themes Implementation
   ========================================================================== */

/* 3.1 Common CV Typography Styles */
.cv-header {
    border-bottom: 2px solid var(--cv-border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}
.cv-name-title h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--cv-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}
.cv-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.cv-contact-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 12px;
    margin-top: 12px;
    font-size: 12px;
    color: var(--cv-text-muted);
}
.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.contact-item i {
    color: var(--cv-primary);
    width: 14px;
}

.cv-section {
    margin-bottom: 22px;
}
.cv-section-title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--cv-primary);
    letter-spacing: 0.8px;
    border-bottom: 1.5px solid var(--cv-primary);
    padding-bottom: 4px;
    margin-bottom: 12px;
}

.cv-item {
    margin-bottom: 12px;
}
.cv-item-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 13px;
}
.cv-item-title {
    color: var(--cv-text);
}
.cv-item-date {
    color: var(--cv-text-muted);
    font-weight: 400;
}
.cv-item-sub {
    font-size: 12px;
    font-style: italic;
    color: var(--cv-text-muted);
    margin-bottom: 4px;
}
.cv-item-desc {
    font-size: 12px;
    color: var(--cv-text-muted);
    margin-top: 3px;
    white-space: pre-line;
}

.skills-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.skill-badge {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--cv-text);
}

.text-justify {
    text-align: justify;
}

/* 3.2 Theme: Minimalist (White Clean Design) */
.theme-minimalist {
    --cv-bg: #ffffff;
    --cv-text: #1f2937;
    --cv-text-muted: #4b5563;
    --cv-primary: #111827;
    --cv-border: #e5e7eb;
}
.theme-minimalist .cv-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.theme-minimalist .cv-section-title {
    border-bottom: 1px solid #111827;
}

/* 3.3 Theme: Creative (Sidebar Accent Column) */
.theme-creative {
    --cv-bg: #fafafa;
    --cv-text: #27272a;
    --cv-text-muted: #52525b;
    --cv-primary: #1e3a8a; /* Deep Navy */
    --cv-border: #d4d4d8;
    padding: 0;
}
.theme-creative .cv-header {
    background: #1e3a8a;
    color: white;
    padding: 25px 25px 20px 25px;
    margin-bottom: 0;
    border-bottom: none;
}
.theme-creative .cv-header .cv-name-title h2 {
    color: white;
}
.theme-creative .cv-header .cv-subtitle {
    color: #93c5fd;
}
.theme-creative .cv-header .cv-contact-info {
    color: #e0f2fe;
}
.theme-creative .cv-header .contact-item i {
    color: #93c5fd;
}

.theme-creative .cv-body {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: calc(297mm - 120px);
}
.theme-creative .cv-col-left {
    background: #f1f5f9;
    border-right: 1px solid #e2e8f0;
    padding: 20px;
}
.theme-creative .cv-col-right {
    padding: 20px;
}
.theme-creative .cv-section-title {
    border-bottom: 2px solid #1e3a8a;
}
.theme-creative .skill-badge {
    background: white;
    border-color: #cbd5e1;
}

/* 3.4 Theme: Tech (Dark accents & Modern boxes) */
.theme-tech {
    --cv-bg: #ffffff;
    --cv-text: #0f172a;
    --cv-text-muted: #334155;
    --cv-primary: #0f766e; /* Teal Green */
    --cv-border: #e2e8f0;
}
.theme-tech .cv-header {
    border-bottom: 3px double var(--cv-primary);
}
.theme-tech .cv-section-title {
    border-bottom: none;
    background: #f0fdfa;
    color: #0f766e;
    padding: 6px 10px;
    border-left: 4px solid #0f766e;
    border-radius: 0 4px 4px 0;
}
.theme-tech .skill-badge {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    color: #0f766e;
}
.theme-tech .cv-item {
    background: #fafafa;
    border: 1px solid #f1f5f9;
    border-radius: 6px;
    padding: 10px;
}

/* Hide sidebars elements in specific columns that are not relevant to layout */
.theme-minimalist .cv-col-left, 
.theme-minimalist .cv-col-right,
.theme-tech .cv-col-left, 
.theme-tech .cv-col-right {
    display: contents; /* Fallback and unwrap */
}

/* ==========================================================================
   🎯 ATS Score Matcher Widget Styles
   ========================================================================== */
.ats-score-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 6px 12px;
    backdrop-filter: blur(10px);
}

.ats-score-circle {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ats-score-circle svg {
    transform: rotate(-90deg);
}

.ats-score-circle circle {
    fill: none;
    stroke-width: 3;
}

.ats-score-circle .circle-bg {
    stroke: rgba(255, 255, 255, 0.05);
}

.ats-score-circle .circle-progress {
    stroke: var(--primary);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.3s;
    /* stroke-dasharray is 2 * PI * r = 2 * 3.14159 * 15 = 94.2 */
}

.ats-score-value {
    position: absolute;
    font-size: 10px;
    font-weight: 700;
    color: white;
}

.ats-score-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    line-height: 1.2;
}

/* ==========================================================================
   4. CSS Media Print Configuration
   ========================================================================== */
@media print {
    /* Hide all dashboards tools */
    body {
        background: white !important;
        color: black !important;
    }
    
    .editor-panel,
    .preview-toolbar,
    .a4-page-scroll,
    .bg-glow {
        display: none !important;
    }
    
    .app-container {
        display: block !important;
        height: auto !important;
        width: auto !important;
        overflow: visible !important;
    }
    
    .preview-panel {
        display: block !important;
        height: auto !important;
        overflow: visible !important;
    }
    
    /* Ensure the sheet prints correctly */
    .a4-sheet {
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: avoid;
    }

    /* Keep Creative Theme Layout properly sized during printing */
    .theme-creative .cv-body {
        min-height: 0 !important;
    }
    
    @page {
        size: A4;
        margin: 15mm;
    }
}
