/* InterviewIQ Dark Theme Design System */
:root {
    --bg: #121212;
    --bg-elevated: #1e1e1e;
    --bg-elevated-2: #2a2a2a;
    --bg-soft: #0f172a;
    --border: #2c2c2c;
    --text: #e0e0e0;
    --text-muted: #9e9e9e;
    --text-faint: #757575;
    --primary: #1565c0;
    --primary-hover: #1976d2;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #ef9a9a;
    --accent: #90caf9;
    --accent-strong: #42a5f5;
    --focus: rgba(144, 202, 249, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    width: 90%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(18, 18, 18, 0.9);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
    opacity: 0.85;
}

.brand .logo {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero {
    padding: 1rem 0 0.35rem;
}

.hero .container {
    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.75rem;
}

.hero h1 {
    color: var(--accent);
    font-size: clamp(1.5rem, 2vw, 2.1rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.hero .subtitle {
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin: 0;
    white-space: nowrap;
}

.hero .subtitle::before {
    content: "•";
    margin-right: 0.75rem;
    color: var(--border);
}

.project-shell {
    padding: 0.5rem 0 1.5rem;
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header */
.app-header {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(144, 202, 249, 0.12);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.brand-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--accent);
    margin: 0;
}

.brand-tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-badge {
    background: rgba(76, 175, 80, 0.12);
    color: #a5d6a7;
    border: 1px solid rgba(76, 175, 80, 0.25);
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 0.825rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

/* Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.95fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 992px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-status {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .container {
        width: 100%;
        padding: 0 0.75rem;
    }

    .hero .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .hero .subtitle {
        white-space: normal;
    }

    .brand-wrapper {
        align-items: flex-start;
        gap: 12px;
    }

    .brand-tagline {
        font-size: 0.8rem;
    }

    .card {
        padding: 16px;
    }

    .card-title {
        flex-wrap: wrap;
    }

    .button-row {
        width: 100%;
        justify-content: stretch;
    }

    .button-row>* {
        flex: 1 1 100%;
    }

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

    .chat-input-bar {
        flex-direction: column;
    }

    .chat-input-bar .btn {
        width: 100%;
    }

    .quick-prompts {
        display: grid;
        grid-template-columns: 1fr;
    }

    .quick-prompt-btn {
        width: 100%;
        text-align: center;
    }

    .scorecard-table {
        min-width: 560px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .question-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .q-btn {
        width: 100%;
        text-align: center;
    }
}

/* Cards */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.card:hover {
    border-color: rgba(144, 202, 249, 0.3);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-purple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-blue {
    background: rgba(56, 189, 248, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-green {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-amber {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-rose {
    background: rgba(244, 63, 94, 0.15);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Question Selector */
.question-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.q-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.q-btn:hover {
    color: var(--text);
    background: var(--bg-elevated-2);
    border-color: rgba(144, 202, 249, 0.3);
}

.q-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.question-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
    margin: 12px 0 16px 0;
}

.keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.keyword-chip {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 3px 8px;
    border-radius: 6px;
}

.keyword-chip.matched {
    background: rgba(76, 175, 80, 0.12);
    border-color: rgba(76, 175, 80, 0.25);
    color: #a5d6a7;
}

.keyword-chip.missing {
    background: rgba(239, 154, 154, 0.1);
    border-color: rgba(239, 154, 154, 0.25);
    color: #f5c2c2;
}

/* Answer Textarea */
.textarea-container {
    position: relative;
    margin-bottom: 14px;
}

.answer-textarea {
    width: 100%;
    min-height: 160px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    padding: 16px;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.answer-textarea:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px var(--focus);
}

.char-counter {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Action Buttons */
.button-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--bg);
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--bg-elevated-2);
    color: var(--text);
    border-color: rgba(144, 202, 249, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-danger {
    background: rgba(239, 154, 154, 0.12);
    border-color: rgba(239, 154, 154, 0.35);
    color: #f5c2c2;
}

.btn-danger:hover {
    background: rgba(239, 154, 154, 0.22);
    color: #fff;
}

/* Diagnostic Stats Row */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.stat-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    text-align: center;
}

.stat-label {
    font-size: 0.725rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
}

.stat-value.green {
    color: #a5d6a7;
}

.stat-value.amber {
    color: #ffcc80;
}

.stat-value.rose {
    color: #f5c2c2;
}

.stat-value.blue {
    color: var(--accent);
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* STAR Pill Step Indicators */
.star-steps {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.star-step {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.star-step.active {
    background: rgba(76, 175, 80, 0.12);
    border-color: rgba(76, 175, 80, 0.3);
    color: #a5d6a7;
}

/* Feedback Card */
.feedback-box {
    background: var(--bg-elevated-2);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.feedback-box h4 {
    color: var(--accent);
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Scorecard Table */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.scorecard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.scorecard-table th {
    background: var(--bg);
    color: var(--text-muted);
    padding: 12px 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.scorecard-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.scorecard-table tr:hover {
    background: var(--bg-elevated-2);
}

/* Chatbot Section */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 320px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary);
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.chat-bubble.coach {
    align-self: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 2px;
}

.chat-input-bar {
    display: flex;
    padding: 10px;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border);
    gap: 8px;
}

.chat-input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 8px 12px;
    font-size: 0.875rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 3px var(--focus);
}

.quick-prompts {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.quick-prompt-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-prompt-btn:hover {
    background: var(--bg-elevated-2);
    color: var(--accent);
    border-color: rgba(144, 202, 249, 0.4);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    padding: 20px;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.modal-close:hover {
    color: var(--text);
    background: var(--bg-elevated-2);
}

.report-markdown h1 {
    font-size: 1.6rem;
    margin-bottom: 8px;
    color: var(--accent);
}

.report-markdown h2 {
    font-size: 1.2rem;
    color: var(--accent);
    margin: 20px 0 10px 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.report-markdown p {
    margin-bottom: 10px;
    color: var(--text-muted);
}

.report-markdown ul,
.report-markdown ol {
    margin-left: 20px;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.report-markdown li {
    margin-bottom: 6px;
}

.report-markdown strong {
    color: var(--text);
}

footer {
    border-top: 1px solid var(--border);
    padding: 1rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-top: 24px;
}

footer p {
    margin: 0;
}