@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Space+Grotesk:wght@500;700&family=JetBrains+Mono&display=swap');

:root {
    /* DEFAULT DARK THEME */
    --bg-dark: #09090b;
    --bg-card: #14141a;
    --bg-sidebar: #0e0e12;
    --primary: #00f3ff;
    --primary-glow: rgba(0, 243, 255, 0.25);
    --secondary: #8b5cf6;
    --success: #10b981;
    --error: #ef4444;
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --border: rgba(255, 255, 255, 0.08);
    --font-brand: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;

    /* Login Background Variable */
    --login-bg: radial-gradient(circle at top right, #1e1b4b 0%, #09090b 40%);
}

/* LIGHT THEME OVERRIDES */
[data-theme="light"] {
    /* Refined Slate Palette (Blue-ish Grays) for a "Tech" feel */
    --bg-dark: #f1f5f9;
    /* Slate-100 */
    --bg-card: #ffffff;
    /* Pure White */
    --bg-sidebar: #ffffff;
    /* Pure White */

    /* Text Colors */
    --text-main: #0f172a;
    /* Slate-900 (Very Dark Blue-Gray) */
    --text-muted: #64748b;
    /* Slate-500 */

    /* Borders */
    --border: #cbd5e1;
    /* Slate-300 */

    /* Branding Colors - Adjusted for Light Mode Readability */
    /* Darker Cyan for visibility on white backgrounds */
    --primary: #0891b2;
    --primary-glow: rgba(8, 145, 178, 0.15);

    /* Darker Purple */
    --secondary: #7c3aed;

    /* Login Background */
    --login-bg: radial-gradient(circle at top right, #dbeafe 0%, #f1f5f9 50%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    font-size: 1.1rem;
    transition: background-color 0.3s, color 0.3s;
    /* Smooth Toggle */
}

.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Typography Defaults */
h1,
h2,
h3,
h4 {
    font-family: var(--font-brand);
    color: var(--text-main);
    /* CHANGED from #fff to variable */
    line-height: 1.2;
}

h1 {
    font-size: 3rem;
}

h2 {
    font-size: 2.25rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.4rem;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: transform 0.3s ease, background 0.3s;
}

.sidebar-brand {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    display: block;
    color: var(--text-main);
    /* CHANGED from #fff to variable */
    text-decoration: none;
    font-family: var(--font-brand);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 1.1rem;
}

.nav-item:hover {
    background: rgba(125, 125, 125, 0.1);
    /* Generic hover */
    color: var(--text-main);
    /* CHANGED from #fff */
}

/* Updated active state for Light Mode visibility */
.nav-item.active {
    background: var(--primary);
    color: white;
    /* Always white text on active primary button */
}

/* Sidebar fixes for light mode where primary is dark */
[data-theme="light"] .nav-item.active {
    color: #ffffff;
    background: var(--primary);
}

/* Main Content */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2.5rem;
    width: calc(100% - 280px);
    transition: margin-left 0.3s ease;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    /* CHANGED from #fff */
    font-size: 1.8rem;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: var(--font-brand);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    text-decoration: none;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Fix text color on primary button in light mode (since we darkened the cyan) */
[data-theme="light"] .btn-primary {
    color: white;
}

.btn-glass {
    background: rgba(125, 125, 125, 0.05);
    /* slightly adjusted for visibility */
    border: 1px solid var(--border);
    color: var(--text-main);
    /* CHANGED from #fff */
}

.btn-glass:hover {
    background: rgba(125, 125, 125, 0.15);
}

.btn-google {
    background: #ffffff;
    color: #333333;
    border: 1px solid #e0e0e0;
    margin-top: 1rem;
    width: 100%;
}

.btn-google:hover {
    background: #f1f5f9;
}

[data-theme="dark"] .btn-google {
    background: #ffffff;
    color: #333333;
}

/* Components */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    transition: border-color 0.2s, transform 0.2s;
}

.login-card:hover {
    border-color: var(--primary);
    transform: translateY(-5px);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.75rem;
}

.panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.panel.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Forms */
.form-input,
.form-select {
    width: 100%;
    padding: 1rem;
    background: var(--bg-card);
    /* CHANGED from fixed hex */
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    /* CHANGED from #fff */
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 1.5rem;
}

/* Feed & Lock */
.job-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    position: relative;
    transition: box-shadow 0.2s;
}

/* Slight shadow for cards in light mode for depth */
[data-theme="light"] .job-card,
[data-theme="light"] .glass-card {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.job-card.locked {
    border-color: rgba(239, 68, 68, 0.3);
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    cursor: pointer;
    border-radius: 16px;
}

.timer-badge {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 600px;
    padding: 2.5rem;
    border-radius: 20px;
    position: relative;
}

.mcq-option {
    width: 100%;
    text-align: left;
    padding: 1.2rem;
    margin-bottom: 0.75rem;
    background: rgba(125, 125, 125, 0.05);
    /* Generic alpha */
    border: 1px solid transparent;
    color: var(--text-muted);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.2s;
}

.mcq-option:hover {
    background: rgba(125, 125, 125, 0.1);
}

/* Ensure selected option is visible in both modes */
.mcq-option.selected {
    border-color: var(--primary);
    background: var(--bg-dark);
    /* Fallback */
    color: var(--text-main);
}

[data-theme="light"] .mcq-option.selected {
    background: rgba(8, 145, 178, 0.1);
}

[data-theme="dark"] .mcq-option.selected {
    background: rgba(0, 243, 255, 0.05);
}


@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }

    .main-content {
        margin-left: 240px;
        width: calc(100% - 240px);
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 1rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .grid-cards {
        grid-template-columns: 1fr;
    }

    .desktop-only {
        display: none !important;
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .app-header>div {
        width: 100%;
        justify-content: space-between;
    }

    .search-bar-container {
        flex-direction: column;
    }

    .search-bar-container .form-select {
        width: 100% !important;
    }

    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }

    .result-stat-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .btn {
        width: 100%;
    }

    .hero-btns {
        flex-direction: column;
    }
}

/* --- HERO SPECIFIC OVERRIDES --- */

.hero-title {
    font-size: 4rem;
    line-height: 1.1;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 550px;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.hero-btns .btn {
    padding: 0.9rem 1.8rem;
    font-size: 1.05rem;
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 2.8rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
    }
}

/* MCQ Selected State */
/* MCQ Selection Color */
.mcq-option.selected {
    border-color: var(--primary) !important;
    background: var(--primary) !important;
    color: #000 !important;
    font-weight: bold;
}

/* Ensure the loading spinner is the brand color */
.fa-sync,
.fa-circle-notch {
    color: var(--primary);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#ai-status {
    font-weight: 700;
    text-shadow: 0 0 10px var(--primary-glow);
}

#interview-result-card {
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- ANALYTICS DASHBOARD TABS --- */
.btn-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-brand);
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-tab:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-tab.active {
    background: var(--primary);
    color: #000;
    box-shadow: 0 0 10px var(--primary-glow);
}

/* Light mode override for active tab text */
[data-theme="light"] .btn-tab.active {
    color: white;
}

.result-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.result-tab-content.active {
    display: block;
}

/* --- HISTORY LIST ITEMS --- */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}

.history-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    margin-right: 0.5rem;
}

/* --- DETAILED RESULT MODAL --- */
.result-detail-header {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.result-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.transcript-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.6;
    margin-top: 1rem;
    white-space: pre-line;
}

/* Interview status indicators */
.interview-status {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    margin: 0.5rem 0;
    text-align: center;
    transition: all 0.3s;
}

.status-listening {
    background: rgba(0, 243, 255, 0.1);
    color: var(--primary);
    border: 1px solid var(--primary);
    animation: pulse 2s infinite;
}

.status-speaking {
    background: rgba(139, 92, 246, 0.1);
    color: var(--secondary);
    border: 1px solid var(--secondary);
}

.status-thinking {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

/* Transcript styling */
.transcript-line {
    margin-bottom: 0.8rem;
    padding: 0.8rem;
    border-radius: 8px;
    animation: slideIn 0.3s ease;
}

.transcript-interviewer {
    background: rgba(0, 243, 255, 0.05);
    border-left: 4px solid var(--primary);
}

.transcript-user {
    background: rgba(139, 92, 246, 0.05);
    border-left: 4px solid var(--secondary);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

.btn-error {
    background: var(--error);
    color: white;
    border: none;
}

.btn-error:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

/* Resume Upload Styles */
#resume-status {
    transition: all 0.3s ease;
}

#resume-status:hover {
    border-color: var(--primary);
    background: rgba(0, 243, 255, 0.05);
}

/* Resume badge in application list */
.resume-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.resume-available {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.resume-not-available {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid var(--error);
}

/* File upload button enhancements */
input[type="file"] {
    cursor: pointer;
}

/* Resume preview button */
.resume-preview-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(0, 243, 255, 0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.resume-preview-btn:hover {
    background: var(--primary);
    color: #000;
}