/* ============================================================
   Resume Optimizer — Premium Dark Mode Design System
   ============================================================ */

/* ---------- CSS Variables (Design Tokens) ---------- */
:root {
    /* Backgrounds */
    --bg-primary: #0a0f1e;
    --bg-secondary: #0f1629;
    --bg-card: rgba(16, 23, 48, 0.75);
    --bg-card-hover: rgba(22, 32, 64, 0.85);
    --bg-input: rgba(15, 22, 45, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.03);

    /* Accents */
    --accent-primary: #4f8cff;
    --accent-secondary: #7c5cfc;
    --accent-gradient: linear-gradient(135deg, #4f8cff 0%, #7c5cfc 100%);
    --accent-glow: rgba(79, 140, 255, 0.25);

    /* Score Colors */
    --score-excellent: #22d68a;
    --score-good: #4f8cff;
    --score-average: #fbbf24;
    --score-poor: #f87171;

    /* Text */
    --text-primary: #e8ecf4;
    --text-secondary: #8892a8;
    --text-muted: #5a6478;
    --text-accent: #4f8cff;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-input: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(79, 140, 255, 0.5);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Transitions */
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Background Particles ---------- */
.bg-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particles::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -20%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(79, 140, 255, 0.08) 0%, transparent 70%);
    animation: float-orb 20s ease-in-out infinite;
}

.bg-particles::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -15%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(124, 92, 252, 0.06) 0%, transparent 70%);
    animation: float-orb 25s ease-in-out infinite reverse;
}

@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -80px) scale(1.1); }
    66% { transform: translate(-30px, 40px) scale(0.95); }
}

/* ---------- Header ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(10, 15, 30, 0.8);
    border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.logo-icon {
    font-size: 1.4rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.header-badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    padding: var(--space-xs) var(--space-md);
    border: 1px solid var(--border-subtle);
    border-radius: 100px;
    background: var(--bg-glass);
}

/* ---------- Main Container ---------- */
.main-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-lg);
    position: relative;
    z-index: 1;
}

.section {
    animation: fade-in 0.6s var(--ease-out);
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Section Header ---------- */
.section-header {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.section-title {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #e8ecf4 0%, #8892a8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-sm);
}

.section-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ---------- Upload Form ---------- */
.upload-form {
    max-width: 700px;
    margin: 0 auto;
}

.drop-zone {
    position: relative;
    border: 2px dashed rgba(79, 140, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    background: var(--bg-glass);
    margin-bottom: var(--space-lg);
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(79, 140, 255, 0.05);
    box-shadow: 0 0 40px var(--accent-glow);
    transform: translateY(-2px);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.drop-icon {
    color: var(--accent-primary);
    opacity: 0.7;
    transition: opacity 0.3s;
}

.drop-zone:hover .drop-icon {
    opacity: 1;
}

.drop-text {
    font-size: 1rem;
    color: var(--text-primary);
}

.drop-subtext {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-selected {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
}

.file-icon {
    font-size: 1.4rem;
}

.file-name {
    font-weight: 600;
    color: var(--accent-primary);
}

.file-remove {
    background: rgba(248, 113, 113, 0.15);
    border: none;
    color: #f87171;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.file-remove:hover {
    background: rgba(248, 113, 113, 0.3);
}

/* ---------- Form Fields ---------- */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-group.full-width {
    margin-bottom: var(--space-md);
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.required {
    color: var(--accent-primary);
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.form-input,
.form-textarea {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: all 0.2s var(--ease-out);
    outline: none;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

/* ---------- Toggle Switch ---------- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.toggle-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.toggle-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.toggle-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.toggle-switch {
    position: relative;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 100px;
    transition: 0.3s var(--ease-out);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s var(--ease-spring);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(24px);
}

/* ---------- Buttons ---------- */
.btn-primary {
    width: 100%;
    padding: 16px 32px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all 0.3s var(--ease-out);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(79, 140, 255, 0.35);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary:disabled::before {
    display: none;
}

.btn-icon {
    transition: transform 0.3s var(--ease-spring);
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

.btn-secondary {
    padding: 12px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
}

.btn-download {
    padding: 12px 24px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    transition: all 0.2s var(--ease-out);
}

.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(79, 140, 255, 0.3);
}

.btn-whatsapp {
    padding: 12px 20px;
    background: #25D366;
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s var(--ease-out);
}

.btn-whatsapp:hover {
    transform: translateY(-1px);
    background: #1ebe57;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.35);
}

.btn-whatsapp .whatsapp-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.downloads-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}

/* ---------- Loading Section ---------- */
.loader-container {
    text-align: center;
    padding: var(--space-3xl) 0;
}

.loader-ring {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-xl);
    position: relative;
}

.loader-ring-inner {
    width: 100%;
    height: 100%;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loader-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-xl);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loader-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 360px;
    margin: 0 auto;
    text-align: left;
}

.loader-step {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    opacity: 0.35;
    transition: all 0.4s var(--ease-out);
}

.loader-step.active {
    opacity: 1;
}

.loader-step.done {
    opacity: 0.6;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: all 0.3s;
}

.loader-step.active .step-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.loader-step.done .step-dot {
    background: var(--score-excellent);
}

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.5); }
}

.step-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.loader-step.active .step-text {
    color: var(--text-primary);
    font-weight: 500;
}

/* ---------- Results Section ---------- */
.results-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

/* Score Cards Grid */
.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.score-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    transition: all 0.3s var(--ease-out);
    animation: card-in 0.5s var(--ease-out) backwards;
}

.score-card:nth-child(1) { animation-delay: 0.1s; }
.score-card:nth-child(2) { animation-delay: 0.2s; }
.score-card:nth-child(3) { animation-delay: 0.3s; }
.score-card:nth-child(4) { animation-delay: 0.4s; }
.score-card:nth-child(5) { animation-delay: 0.5s; }
.score-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes card-in {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.score-card:hover {
    transform: translateY(-4px);
    border-color: rgba(79, 140, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.score-card-featured {
    border-color: rgba(79, 140, 255, 0.2);
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.08) 0%, rgba(124, 92, 252, 0.05) 100%);
}

.score-ring {
    position: relative;
    width: 90px;
    height: 90px;
}

.score-ring svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-ring-bg {
    fill: none;
    stroke: var(--border-subtle);
    stroke-width: 6;
}

.score-ring-fill {
    fill: none;
    stroke: var(--accent-primary);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1.5s var(--ease-out), stroke 0.3s;
}

.score-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.score-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---------- Results Panels ---------- */
.results-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    animation: card-in 0.5s var(--ease-out) backwards;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.panel-icon {
    font-size: 1.2rem;
}

.badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 100px;
    background: rgba(79, 140, 255, 0.15);
    color: var(--accent-primary);
    margin-left: auto;
}

.panel-content {
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    color: var(--text-primary);
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
}

.markdown-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.markdown-content ul, .markdown-content ol {
    padding-left: var(--space-lg);
}

.markdown-content li {
    margin-bottom: var(--space-xs);
}

/* Warnings List */
.warnings-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.warnings-list li {
    padding: var(--space-sm) var(--space-md);
    background: rgba(251, 191, 36, 0.08);
    border-left: 3px solid var(--score-average);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Suggestions */
.suggestion-item {
    padding: var(--space-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: all 0.2s var(--ease-out);
}

.suggestion-item:hover {
    border-color: rgba(79, 140, 255, 0.2);
    background: rgba(79, 140, 255, 0.03);
}

.suggestion-section {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-primary);
    margin-bottom: var(--space-sm);
}

.suggestion-diff {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.diff-old {
    font-size: 0.88rem;
    padding: var(--space-sm) var(--space-md);
    background: rgba(248, 113, 113, 0.08);
    border-left: 3px solid #f87171;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    text-decoration: line-through;
    line-height: 1.6;
}

.diff-new {
    font-size: 0.88rem;
    padding: var(--space-sm) var(--space-md);
    background: rgba(34, 214, 138, 0.08);
    border-left: 3px solid var(--score-excellent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.suggestion-reason {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.suggestion-talking-point {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(124, 92, 252, 0.06);
    border-left: 3px solid var(--accent-secondary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.suggestion-talking-point::before {
    content: '🎤 Talking Point: ';
    font-weight: 600;
    color: var(--accent-secondary);
}

/* Interview List */
.interview-list {
    padding-left: var(--space-lg);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.interview-list li {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: var(--space-sm) 0;
}

/* Cover Letter */
.cover-letter-content {
    white-space: pre-wrap;
    font-size: 0.92rem;
    line-height: 1.8;
}

/* ---------- Downloads Bar ---------- */
.downloads-bar {
    background: linear-gradient(135deg, rgba(79, 140, 255, 0.08) 0%, rgba(124, 92, 252, 0.05) 100%);
    border: 1px solid rgba(79, 140, 255, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    margin-bottom: var(--space-md);
}

.downloads-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.downloads-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
}

/* ---------- Restart Bar ---------- */
.restart-bar {
    text-align: center;
    padding: var(--space-lg) 0;
}

/* ---------- Error Section ---------- */
.error-container {
    text-align: center;
    padding: var(--space-3xl) 0;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.error-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.error-message {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-subtle);
    position: relative;
    z-index: 1;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.6rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .main-container {
        padding: var(--space-lg) var(--space-md);
    }

    .toggle-row {
        flex-direction: column;
        gap: var(--space-md);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-badge {
        display: none;
    }

    .downloads-buttons {
        flex-direction: column;
    }
}
