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

@import url('https://fonts.googleapis.com/css2?family=AR+One+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg: #0a1a1a;
    --surface: #0f2626;
    --surface-hover: #163333;
    --border: #1d4a4a;
    --text: #efe6db;
    --text-muted: #8aaba8;
    --primary: #2da89d;
    --primary-hover: #1d7a71;
    --primary-light: rgba(79, 192, 183, 0.12);
    --secondary: #f88204;
    --secondary-hover: #c66903;
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
    --suggestion-bg: #0d2020;
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    font-family: 'AR One Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* Views */
.view {
    display: none;
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.view.active {
    display: block;
}

/* Auth View */
#auth-view header {
    text-align: center;
    padding: 48px 0 24px;
}

#auth-view h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #4fc0b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 20px;
}

.hero-tagline {
    font-size: 1.15rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 6px;
}

.hero-cta {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 18px;
}

.hero-features {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    max-width: 420px;
    margin: 0 auto;
}

.hero-feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.hero-feature-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Landing Sections */
.landing-section {
    text-align: left;
}

.landing-section h2 {
    text-align: center;
}

/* How It Works */
.how-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 12px;
}

.how-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.how-step-num {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.how-step strong {
    display: block;
    margin-bottom: 2px;
}

.how-step p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Tips Section */
.tips-section {
    border-color: var(--primary);
}

.tips-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

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

.tip-card {
    padding: 14px;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    text-align: center;
}

.tip-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 6px;
}

.tip-card-important {
    border: 1px solid var(--warning);
    background: rgba(251, 191, 36, 0.06);
}

.tip-card strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.tip-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Pricing Grid */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

@media (min-width: 600px) {
    .pricing-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.pricing-tier {
    text-align: center;
    padding: 16px 10px;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.pricing-tier-highlight {
    border-color: var(--primary);
}

.pricing-name {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.pricing-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
}

.pricing-price span {
    font-size: 0.7rem;
    font-weight: 400;
}

.pricing-detail {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.faq-item summary {
    padding: 12px 14px;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-hover);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.1rem;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 10px;
}

.faq-item[open] summary::after {
    content: '\2212';
}

.faq-item p {
    padding: 12px 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* Legal Sections */
.legal-section summary {
    cursor: pointer;
    list-style: none;
}

.legal-section summary::-webkit-details-marker {
    display: none;
}

.legal-heading {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.legal-heading::after {
    content: 'Expand';
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--primary);
}

.legal-section[open] .legal-heading::after {
    content: 'Collapse';
}

.legal-body {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.legal-body h4 {
    font-size: 0.9rem;
    margin-top: 14px;
    margin-bottom: 4px;
    color: var(--text);
}

.legal-body p {
    font-size: 0.83rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 8px;
}

/* Landing Footer */
.landing-footer {
    text-align: center;
    padding: 20px 0 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Setup View */
#setup-view header {
    text-align: center;
    padding: 32px 0 24px;
}

#setup-view h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #4fc0b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 4px;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* File Upload */
#cv-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.file-upload {
    flex: 1;
    min-width: 180px;
    padding: 12px 16px;
    background: var(--surface-hover);
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s;
}

.file-upload:hover {
    border-color: var(--primary);
}

.file-upload input[type="file"] {
    display: none;
}

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

#upload-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

#upload-btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

#upload-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Status Messages */
.status-msg {
    margin-top: 10px;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.status-msg.success { color: var(--success); }
.status-msg.error { color: var(--error); }
.status-msg.loading { color: var(--warning); }

/* CV Summary */
.cv-summary {
    margin-top: 12px;
    padding: 12px;
    background: var(--surface-hover);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.cv-summary h4 {
    margin-bottom: 6px;
    color: var(--primary);
}

.cv-summary .skills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.cv-summary .skill-tag {
    padding: 2px 8px;
    background: var(--bg);
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.hidden { display: none; }

/* Mode Selector */
.mode-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mode-btn {
    flex: 1;
    padding: 14px;
    background: var(--surface-hover);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-family: inherit;
}

.mode-btn .mode-icon {
    display: block;
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.mode-btn:hover { border-color: var(--primary); color: var(--text); }
.mode-btn.active { border-color: var(--secondary); color: var(--text); background: rgba(248, 130, 4, 0.08); }

/* Disabled / Coming Soon mode buttons */
.mode-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.mode-btn-sm.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.coming-soon-badge {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}

/* Primary Button */
.primary-btn {
    width: 100%;
    padding: 16px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    font-family: inherit;
}

.primary-btn:hover:not(:disabled) { background: var(--secondary-hover); }
.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Session View */
.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 12px;
}

.session-header h1 {
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--primary), #4fc0b7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mode-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface-hover);
    padding: 2px 8px;
    border-radius: 4px;
}

.session-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.connected { background: var(--success); }
.status-dot.disconnected { background: var(--error); }
.status-dot.thinking { background: var(--warning); animation: pulse 1s infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.stop-btn {
    padding: 6px 16px;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* Session Content */
.session-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: calc(100vh - 160px);
}

.panel {
    flex: 1;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
    flex-shrink: 0;
    font-weight: 600;
}

.suggestion-panel {
    background: var(--suggestion-bg);
    border-color: rgba(45, 168, 157, 0.3);
}

.scroll-area {
    flex: 1;
    overflow-y: auto;
    font-size: 0.95rem;
    line-height: 1.7;
}

.scroll-area .placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.transcript-entry {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    animation: fadeIn 0.3s;
}

.transcript-entry:last-child {
    border-bottom: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.suggestion-text {
    font-size: 1.05rem;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Thinking Indicator */
.thinking {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-top: 8px;
}

.thinking .dot {
    width: 6px;
    height: 6px;
    background: var(--secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.thinking .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

/* Session Footer */
.session-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    flex-wrap: wrap;
    gap: 8px;
}

.mode-switch {
    display: flex;
    gap: 6px;
}

.mode-btn-sm {
    padding: 4px 12px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.mode-btn-sm:hover { color: var(--text); }
.mode-btn-sm.active { border-color: var(--secondary); color: var(--text); background: rgba(248, 130, 4, 0.1); }

.response-style-switch {
    display: flex;
    gap: 4px;
    background: var(--surface-hover);
    border-radius: 6px;
    padding: 2px;
}

.style-btn {
    padding: 4px 10px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.style-btn:hover { color: var(--text); }
.style-btn.active { background: var(--secondary); color: white; }

.mute-btn {
    padding: 8px 18px;
    background: var(--surface-hover);
    border: 2px solid var(--success);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.mute-btn:hover {
    background: rgba(74, 222, 128, 0.1);
}

.mute-btn.muted {
    border-color: var(--error);
    color: var(--error);
    background: rgba(248, 113, 113, 0.1);
}

.mute-icon {
    font-size: 1.1rem;
}

.mic-meter {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.mic-status {
    font-size: 0.85rem;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.mic-status.muted {
    color: var(--error);
}

.level-bar-container {
    width: 80px;
    height: 6px;
    background: var(--surface-hover);
    border-radius: 3px;
    overflow: hidden;
}

.level-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.1s;
}

.level-bar.muted {
    background: var(--error);
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background 0.2s;
}

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

.profile-avatar-sm {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
}

.profile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    padding: 8px 0;
    opacity: 0;
    transform: translateY(-4px);
}

.profile-menu.open {
    display: block;
    animation: menuFadeIn 0.15s ease forwards;
}

@keyframes menuFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.profile-menu-email {
    padding: 8px 14px 2px;
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-plan {
    padding: 0 14px 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.profile-menu-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.profile-menu-item:hover {
    background: var(--surface-hover);
}

.profile-menu-logout {
    color: var(--error);
}

.profile-menu-danger {
    color: var(--error);
}

/* Delete Account Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 400px;
    width: 100%;
}

.modal-card h3 {
    margin-bottom: 12px;
    font-size: 1.1rem;
}

.modal-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 12px;
    line-height: 1.5;
}

.modal-sub-warning {
    color: var(--warning) !important;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.modal-btn-secondary {
    padding: 8px 18px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
}

.modal-btn-secondary:hover {
    background: var(--border);
}

.modal-btn-danger {
    padding: 8px 18px;
    background: var(--error);
    border: none;
    color: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
}

.modal-btn-danger:hover {
    background: #e05555;
}

.modal-btn-danger:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Saved Notes */
.save-notes-btn {
    padding: 6px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

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

.save-notes-confirm-btn {
    padding: 8px 18px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

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

.save-notes-cancel-btn {
    padding: 8px 18px;
    background: var(--surface-hover);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.save-notes-cancel-btn:hover {
    background: var(--border);
}

.saved-note-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: border-color 0.2s;
}

.saved-note-item.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.saved-note-info {
    flex: 1;
    min-width: 0;
}

.saved-note-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.saved-note-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 10px;
}

.note-action-btn {
    padding: 4px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 0.78rem;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.note-action-btn:hover {
    color: var(--text);
    border-color: var(--primary);
}

.note-action-btn.danger:hover {
    color: var(--error);
    border-color: var(--error);
}

/* Top-up option cards */
.topup-option {
    transition: all 0.2s;
}

.topup-option:hover {
    border-color: var(--secondary) !important;
    background: rgba(248, 130, 4, 0.06) !important;
}

/* Plan option cards */
.plan-option {
    transition: all 0.2s;
}

.plan-option:hover {
    border-color: var(--secondary) !important;
    background: rgba(248, 130, 4, 0.06) !important;
}

/* Upgrade banner highlight pulse */
@keyframes upgradePulse {
    0%   { box-shadow: 0 0 0 0 rgba(0, 188, 212, 0.5); }
    50%  { box-shadow: 0 0 16px 4px rgba(0, 188, 212, 0.3); }
    100% { box-shadow: 0 0 0 0 rgba(0, 188, 212, 0); }
}
.highlight-pulse {
    animation: upgradePulse 1s ease-in-out 2;
}

/* Desktop: Two-column layout */
@media (min-width: 768px) {
    .view {
        max-width: 1100px;
        padding: 24px;
    }

    .session-content {
        flex-direction: row;
        height: calc(100vh - 140px);
    }

    .panel {
        flex: 1;
        padding: 18px;
    }
}

/* Scrollbar */
.scroll-area::-webkit-scrollbar {
    width: 6px;
}

.scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}
