/* ============================================================
   CRM Interview Assistant — Styles
   Mobile-first, dark theme, glassmorphism
   ============================================================ */

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

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #111128;
    --bg-card: rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555570;
    --accent-blue: #4f8eff;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    --gradient-mic: linear-gradient(135deg, #4f8eff 0%, #8b5cf6 100%);
    --gradient-mic-active: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    --gradient-card-en: linear-gradient(135deg, rgba(79, 142, 255, 0.1) 0%, rgba(139, 92, 246, 0.05) 100%);
    --gradient-card-tr: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(79, 142, 255, 0.05) 100%);
    --shadow-glow: 0 0 40px rgba(79, 142, 255, 0.15);
    --shadow-glow-active: 0 0 60px rgba(239, 68, 68, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- App Shell ---- */
.app {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ---- Header ---- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: calc(var(--safe-area-top) + 8px) 16px 8px;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-glass);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.25rem;
}

.logo-text {
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse-dot 2s infinite;
}

.status-indicator.listening .status-dot {
    background: var(--accent-red);
}

.status-indicator.thinking .status-dot {
    background: var(--accent-orange);
    animation: pulse-dot 0.5s infinite;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* ---- Main ---- */
.main {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: calc(var(--safe-area-bottom) + 24px);
}

/* ---- Glass Card ---- */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* ---- Section Labels ---- */
.section-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.label-icon {
    font-size: 0.8rem;
}

/* ---- Microphone Button ---- */
.mic-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
}

.mic-btn {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-mic);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.mic-btn:active,
.mic-btn.listening {
    transform: scale(1.08);
    background: var(--gradient-mic-active);
    box-shadow: var(--shadow-glow-active);
}

.mic-icon {
    width: 32px;
    height: 32px;
    z-index: 2;
}

.mic-icon svg {
    width: 100%;
    height: 100%;
}

/* Mic rings animation */
.mic-rings {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
}

.ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(79, 142, 255, 0.15);
    opacity: 0;
    transition: opacity 0.3s;
}

.mic-btn.listening .ring {
    opacity: 1;
    animation: ring-pulse 1.5s infinite;
}

.mic-btn.listening .ring-1 {
    animation-delay: 0s;
    border-color: rgba(239, 68, 68, 0.3);
}

.mic-btn.listening .ring-2 {
    animation-delay: 0.3s;
    inset: -20px;
    border-color: rgba(239, 68, 68, 0.2);
}

.mic-btn.listening .ring-3 {
    animation-delay: 0.6s;
    inset: -32px;
    border-color: rgba(239, 68, 68, 0.1);
}

@keyframes ring-pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.8;
    }

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

.mic-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ---- Next Question Button ---- */
.next-question-btn {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-lg);
    background: var(--gradient-mic);
    color: white;
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s ease;
    animation: nextPulse 2s infinite;
    letter-spacing: 0.02em;
    position: sticky;
    top: 60px;
    z-index: 50;
}

.next-question-btn:active {
    transform: scale(0.97);
    animation: none;
}

@keyframes nextPulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(79, 142, 255, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(79, 142, 255, 0.5);
    }
}

/* ---- Transcript ---- */
.transcript-card {
    border-left: 3px solid var(--accent-purple);
}

.transcript-card p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
    font-style: italic;
}

/* ---- Answer Cards ---- */
.english-card {
    background: var(--gradient-card-en);
    border-left: 3px solid var(--accent-blue);
}

.english-card p {
    font-size: 1.15rem;
    line-height: 1.7;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.turkish-card {
    background: var(--gradient-card-tr);
    border-left: 3px solid var(--accent-green);
}

.turkish-card div {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* ---- Loading ---- */
/* ---- Stall Phrase ---- */
.stall-phrase {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
    animation: fadeSlideUp 0.3s ease;
}

.stall-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stall-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-green);
    line-height: 1.5;
}

.loading-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.loader {
    display: flex;
    gap: 4px;
}

.loader-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-blue);
    animation: loader-bounce 1.2s infinite ease-in-out;
}

.loader-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.loader-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes loader-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

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

/* ---- Quick Questions Grid ---- */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    text-align: left;
}

.quick-btn:active {
    transform: scale(0.97);
    background: var(--bg-card-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.quick-emoji {
    font-size: 1rem;
    flex-shrink: 0;
}

/* ---- Text Input ---- */
.input-form {
    width: 100%;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 8px;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--accent-blue);
}

textarea {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    padding: 6px 8px;
    min-height: 40px;
    max-height: 120px;
}

textarea::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--gradient-mic);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.send-btn:active {
    transform: scale(0.93);
}

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

.send-btn svg {
    width: 18px;
    height: 18px;
}

/* ---- Header Right ---- */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---- Settings Button ---- */
.settings-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.settings-btn svg {
    width: 16px;
    height: 16px;
}

.settings-btn:active {
    transform: scale(0.93);
    color: var(--accent-blue);
    border-color: var(--accent-blue);
}

.settings-btn.has-profile {
    border-color: var(--accent-green);
    color: var(--accent-green);
}

/* ---- Settings Panel ---- */
.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.settings-overlay.open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.settings-panel {
    width: 100%;
    max-width: 480px;
    max-height: 90dvh;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-glass);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-glass);
}

.settings-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-close svg {
    width: 18px;
    height: 18px;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-label-icon {
    font-size: 1rem;
}

.settings-hint {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.settings-textarea {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 10px 12px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    min-height: auto;
    max-height: none;
}

.settings-textarea:focus {
    border-color: var(--accent-blue);
}

.settings-textarea::placeholder {
    color: var(--text-muted);
    font-size: 0.78rem;
}

.settings-footer {
    padding: 12px 20px calc(var(--safe-area-bottom) + 12px);
    border-top: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-save {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-mic);
    color: white;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.settings-save:active {
    transform: scale(0.97);
}

.settings-saved-msg {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 500;
    white-space: nowrap;
}

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: calc(var(--safe-area-bottom) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 18px;
    background: rgba(239, 68, 68, 0.9);
    border-radius: var(--radius-full);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
    z-index: 200;
    animation: toast-in 0.3s ease forwards;
    max-width: calc(100% - 40px);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 4px;
}

/* ---- Answer appear animation ---- */
.answer-section {
    animation: fadeSlideUp 0.4s ease forwards;
}

.transcript-section {
    animation: fadeSlideUp 0.3s ease forwards;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

/* ---- Desktop tweaks (still mobile-optimized) ---- */
@media (min-width: 481px) {
    .app {
        border-left: 1px solid var(--border-glass);
        border-right: 1px solid var(--border-glass);
    }

    body {
        background: #050510;
    }
}

/* ---- Landscape phone ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .mic-btn {
        width: 64px;
        height: 64px;
    }

    .mic-icon {
        width: 24px;
        height: 24px;
    }

    .mic-section {
        padding: 8px 0;
    }
}