:root {
    /* Light Mode Colors */
    --bg-primary: #f5f7fb;
    --bg-card: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --primary: #4f46e5;
    --primary-light: #e0e7ff;
    --primary-dark: #3730a3;
    --accent: #06b6d4;
    --border: #e2e8f0;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.02);
    
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;

    --preview-bg: #ffffff;
    --preview-text: #0f172a;
    --preview-border: #e2e8f0;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --bg-primary: #0b0f19;
    --bg-card: #151d30;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary: #6366f1;
    --primary-light: #1e293b;
    --primary-dark: #4f46e5;
    --accent: #22d3ee;
    --border: #1e293b;
    --shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    
    --success: #34d399;
    --success-light: rgba(52, 211, 153, 0.15);
    --warning: #fbbf24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --danger: #f87171;
    --danger-light: rgba(248, 113, 113, 0.15);

    --preview-bg: #1e293b;
    --preview-text: #f8fafc;
    --preview-border: #334155;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: var(--transition);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

header {
    padding: 1.5rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.theme-toggle {
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    padding: 0.6rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    color: var(--text-primary);
}
.theme-toggle:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}
.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}
.theme-toggle .sun-icon { display: none; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 1.5rem 3rem 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}
@media (min-width: 992px) {
    .layout-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 2.25rem;
    transition: var(--transition);
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}
.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* File Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: var(--bg-primary);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}
.upload-area:hover, .upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}
[data-theme="dark"] .upload-area:hover, [data-theme="dark"] .upload-area.dragover {
    background: rgba(99, 102, 241, 0.05);
}
.upload-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
}
.upload-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}
.upload-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.file-selected-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 0.5rem;
}
[data-theme="dark"] .file-selected-badge {
    background: rgba(99, 102, 241, 0.15);
}

.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}
textarea, select {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}
textarea {
    resize: vertical;
}
textarea:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 1rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}
.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent), #0891b2);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}
.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

/* Loading Box */
.loading-box {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    gap: 1rem;
}
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Resume Paper Preview Pane */
.preview-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.paper-preview {
    background-color: var(--preview-bg);
    color: var(--preview-text);
    border: 1px solid var(--preview-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    min-height: 600px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    transition: var(--transition);
}
.paper-preview h2 {
    font-family: 'Outfit', sans-serif;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.35rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--primary);
    font-size: 1.25rem;
}
.paper-preview h3 {
    font-family: 'Outfit', sans-serif;
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
}

/* Action buttons below/above preview */
.action-toolbar {
    display: flex;
    gap: 1rem;
    width: 100%;
}
@media (max-width: 576px) {
    .action-toolbar {
        flex-direction: column;
    }
}

/* Optimization summary */
.summary-panel {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
[data-theme="dark"] .summary-panel {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.summary-panel h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}
.summary-list {
    margin-left: 1.25rem;
}
.summary-list li {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* Ad slots */
.ad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 1rem 0;
    position: relative;
    min-height: 90px;
    overflow: hidden;
}
.ad-container::before {
    content: "SPONSORED";
    position: absolute;
    top: 4px;
    right: 8px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 700;
}
.ad-sidebar {
    min-height: 250px;
    margin-top: 1.5rem;
}

/* Privacy disclaimer label */
.privacy-disclaimer {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* Alert styles */
.alert-danger {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
}

footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    margin-top: auto;
    background: var(--bg-card);
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}
.footer-info {
    display: flex;
    align-items: center;
    gap: 20px;
}
.current-time-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    color: var(--text-primary);
}
[data-theme="light"] .current-time-badge {
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(15, 23, 42, 0.08);
}
.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    margin: 0 8px;
    transition: var(--transition);
}
.footer-link:hover {
    color: var(--primary);
}

/* Accent purple button style */
.btn-accent {
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}
.btn-accent:hover {
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

/* Modal Popup Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 850px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transform: translateY(20px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.modal-overlay.active .modal-card {
    transform: translateY(0);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
}
.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    line-height: 1;
}
.modal-close:hover {
    color: var(--danger);
}
.modal-body {
    padding: 1.75rem;
    overflow-y: auto;
    flex: 1;
    background-color: var(--bg-primary);
}
.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}
.modal-footer .btn {
    width: auto;
    margin-top: 0;
    padding: 0.6rem 1.5rem;
    font-size: 0.95rem;
}
