:root {
    --primary: #1a365d;
    --primary-light: #ebf8ff;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --secondary: #e2e8f0;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: rgba(226, 232, 240, 0.9);
    --card-bg: rgba(255, 255, 255, 0.85);
    --bg-glow: radial-gradient(circle at 50% 50%, #e0f2fe 0%, #f1f5f9 100%);
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-glow);
    color: var(--text);
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

.glass-bg {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(90px);
}

.app-header {
    max-width: 1600px;
    margin: 0 auto 20px auto;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.college-logo {
    height: 52px;
    width: auto;
    border-radius: 8px;
}

.header-title h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
}

.header-title p {
    font-size: 0.88rem;
    color: var(--text-muted);
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--danger-light);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #f8fafc;
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #15803d;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
}

/* Main Split Layout */
.builder-layout {
    max-width: 1600px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 1200px) {
    .builder-layout {
        grid-template-columns: 1fr;
    }
}

/* Form Panel */
.form-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 18px;
    border: 1px solid rgba(226, 232, 240, 0.8);
}

.section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
}

.field-group input,
.field-group select,
.field-group textarea {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #cbd5e1;
    font-size: 0.9rem;
    font-family: inherit;
    background: #ffffff;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s ease;
}

.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

/* ATS Score Widget */
.ats-card {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.ats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ats-score-badge {
    font-size: 1.8rem;
    font-weight: 800;
    color: #38bdf8;
}

.ats-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
}

.ats-progress-fill {
    height: 100%;
    width: 45%;
    background: linear-gradient(90deg, #38bdf8, #4ade80);
    border-radius: 10px;
    transition: width 0.4s ease;
}

.ats-tips-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.82rem;
    color: #94a3b8;
}

.ats-tip-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ats-tip-item.done {
    color: #4ade80;
}

/* Software Skill Chips */
.skill-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.chip {
    padding: 6px 12px;
    border-radius: 20px;
    background: #e2e8f0;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.chip.selected {
    background: var(--accent);
    color: #ffffff;
}

/* Photo Upload Station & Dropzone */
.photo-upload-station {
    display: flex;
    gap: 20px;
    align-items: center;
    background: #ffffff;
    padding: 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.passport-frame-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.passport-frame {
    width: 90px;
    height: 115px; /* 3.5cm x 4.5cm ratio */
    border-radius: 6px;
    border: 2px solid var(--accent);
    overflow: hidden;
    background: #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.passport-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.passport-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.photo-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dropzone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #f8fafc;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--accent);
    background: #f0f9ff;
}

.browse-link {
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.photo-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.upload-status-badge {
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #f1f5f9;
    color: var(--text-muted);
}

.upload-status-badge .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
}

.upload-status-badge.uploaded {
    background: var(--success-light);
    color: var(--success);
}

.upload-status-badge.uploaded .dot {
    background: var(--success);
}

/* Preview Panel */
.preview-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    padding: 24px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
}

.preview-toolbar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

/* A4 Resume Canvas */
.a4-paper {
    width: 210mm;
    min-height: 297mm;
    background: #ffffff;
    color: #1e293b;
    padding: 20mm 18mm;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
    border-radius: 2px;
    font-family: 'Inter', Arial, sans-serif;
    line-height: 1.5;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ATS Resume Typography & Structure */
.resume-header {
    border-bottom: 2px solid #0f172a;
    padding-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.resume-name {
    font-size: 22pt;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.resume-role {
    font-size: 11pt;
    font-weight: 600;
    color: #0284c7;
    margin-top: 2px;
}

.resume-contact-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    font-size: 9pt;
    color: #475569;
    margin-top: 8px;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Resume Live Preview Passport Photo (On-screen preview only, omitted from ATS export) */
.resume-preview-photo-wrap {
    flex-shrink: 0;
    width: 28mm !important;
    height: 35mm !important;
    max-width: 28mm !important;
    max-height: 35mm !important;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    background: #f8fafc;
    margin-left: 14px;
}

.resume-preview-photo-wrap img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    display: block;
}

@media print {
    .resume-preview-photo-wrap {
        display: none !important;
    }
}

.resume-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.resume-section-title {
    font-size: 11pt;
    font-weight: 700;
    text-transform: uppercase;
    color: #0f172a;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 3px;
    letter-spacing: 0.5px;
}

.resume-summary-text {
    font-size: 9.5pt;
    color: #334155;
    text-align: justify;
}

.resume-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 6px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.item-title {
    font-size: 10pt;
    font-weight: 700;
    color: #0f172a;
}

.item-subtitle {
    font-size: 9pt;
    font-weight: 600;
    color: #0284c7;
}

.item-date {
    font-size: 8.5pt;
    color: #64748b;
    font-weight: 500;
}

.item-bullets {
    font-size: 9pt;
    color: #334155;
    padding-left: 16px;
    margin-top: 2px;
}

.item-bullets li {
    margin-bottom: 3px;
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 9pt;
}

.skill-tag {
    background: #f1f5f9;
    color: #0f172a;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid #e2e8f0;
}

/* Clean Print Optimization */
@media print {
    body {
        background: #ffffff;
        padding: 0;
    }
    .glass-bg, .app-header, .form-panel, .preview-toolbar {
        display: none !important;
    }
    .builder-layout {
        display: block;
    }
    .preview-panel {
        padding: 0;
        border: none;
        box-shadow: none;
        background: transparent;
        max-height: none;
        overflow: visible;
    }
    .a4-paper {
        width: 100%;
        min-height: auto;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
    }
    @page {
        size: A4;
        margin: 15mm;
    }
}
