:root {
    --bg-dark: #09090b;
    --bg-surface: rgba(255, 255, 255, 0.05);
    --bg-surface-active: rgba(255, 255, 255, 0.1);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --accent: #06b6d4;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --success: #22c55e;

    --font-stack: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --radius-lg: 24px;
    --radius-md: 12px;
}

.status-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
}

.vad-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.vad-badge.speaking {
    background: var(--success);
    color: #000;
    box-shadow: 0 0 10px var(--success);
}

.vad-badge.hidden {
    opacity: 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-stack);
    height: 100vh;
    overflow: hidden;
    /* Prevent body scroll, handle inside app */
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Ambient Background */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: -1;
}

.glow-1 {
    width: 300px;
    height: 300px;
    background: var(--primary);
    top: -50px;
    left: -50px;
    animation: float 10s infinite ease-in-out;
}

.glow-2 {
    width: 250px;
    height: 250px;
    background: var(--accent);
    bottom: -50px;
    right: -50px;
    animation: float 12s infinite ease-in-out reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 20px);
    }
}

/* App Container */
#app-container {
    width: 100%;
    height: 100%;
    max-width: 1200px;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: scale(0.95);
    z-index: 10;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 20;
}

/* Auth & Setup Screens */
#auth-screen,
#setup-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
}

.auth-tab.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn-loading::after {
    content: '...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    line-height: 1;
    animation: dots 1.4s infinite ease-in-out both;
}

@keyframes dots {

    0%,
    80%,
    100% {
        opacity: 0.2;
        transform: translate(-50%, -50%) scale(0.9);
    }

    40% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.glass-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: var(--glass-border);
    padding: 40px 30px;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    margin: auto 0; /* Helps center vertically within scrolling container */
}

.glass-card h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 0.95rem;
}

.input-group {
    margin-bottom: 20px;
    text-align: left;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.2);
}

.hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.primary-btn {
    width: auto;
    min-width: 180px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px var(--primary-glow);
    position: relative;
}

.primary-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px var(--primary-glow);
    filter: brightness(1.1);
}

.primary-btn:active {
    transform: scale(0.98);
}

.controls-start {
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-icon:active {
    transform: scale(0.95);
}

/* Meeting Screen */
#meeting-screen {
    padding: 0;
}

.app-header {
    height: auto;
    min-height: 70px;
    padding: env(safe-area-inset-top) 20px 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: var(--glass-border);
    background: rgba(9, 9, 11, 0.8);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.header-info {
    display: flex;
    flex-direction: column;
}

.live-indicator {
    font-size: 0.7rem;
    color: var(--danger);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.blob {
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.app-header h2 {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.danger-btn-sm {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.danger-btn-sm:hover {
    background: var(--danger);
    color: white;
}

.split-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

@media (min-width: 800px) {
    .split-view {
        flex-direction: row;
    }
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    border-bottom: var(--glass-border);
}

.ai-panel {
    flex: 4;
    /* 80% Height on Mobile */
}

.transcript-panel {
    flex: 1;
    /* 20% Height on Mobile */
}

@media (min-width: 800px) {
    .panel {
        border-bottom: none;
    }

    /* Left Panel (AI) needs border */
    .ai-panel {
        flex: 4;
        border-right: var(--glass-border);
    }

    /* Right Panel (Transcript) no border */
    .transcript-panel {
        flex: 1;
        border-right: none;
    }
}

.panel-header {
    padding: 12px 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.header-action-btn:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.header-action-btn .material-icons-round {
    font-size: 18px;
}

.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

#ai-feed {
    padding-bottom: 70vh;
    /* Allows scrolling the last item to the top */
}

/* Transcript styling */
#transcript-feed p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #e2e8f0;
    font-size: 0.8rem;
    /* Reduced size */
}

.transcript-segment {
    animation: fadeIn 0.3s ease;
}

.transcript-segment.final {
    color: white;
}

.transcript-segment.interim {
    color: var(--text-muted);
    font-style: italic;
}

/* AI Feed Styling */
#ai-feed {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.3) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.ai-message {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 16px 16px 16px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 0.95rem; /* Improved basic readability */
    line-height: 1.6;
    position: relative;
    animation: slideRight 0.4s ease;
}

.ai-message::before {
    content: 'AI';
    position: absolute;
    top: -10px;
    left: 0;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
}

.ai-message.vision-card {
    border-left: 4px solid var(--accent);
    background: rgba(6, 182, 212, 0.05);
}

.ai-message.vision-card::before {
    content: 'VISION ANALYSIS';
    background: var(--accent);
}

/* AI Markdown Styles */
.ai-message ul,
.ai-message ol {
    margin: 8px 0 8px 20px;
    padding-left: 0;
}

.ai-message li {
    margin-bottom: 12px;
    /* Increased spacing as requested */
}

.ai-message strong {
    color: var(--accent);
    font-weight: 600;
}

.ai-message .code-box {
    background: #0d021c; /* Deeper purple terminal background */
    border: 1px solid #7c3aed; /* Purple border */
    padding: 18px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.1rem; /* Much bigger code font */
    margin: 16px 0;
    overflow-x: auto;
    color: #ffffff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.5);
}

.ai-message pre {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    white-space: pre !important; 
    font-size: inherit;
    color: inherit;
}

.ai-message .command-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-welcome {
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
    font-style: italic;
}

.controls {
    height: 100px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 32px;
    background: rgba(9, 9, 11, 0.9);
    border-top: var(--glass-border);
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom);
    position: relative;
    /* For status-overlay */
}

.fab-mini {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.fab-mini:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 0 15px var(--primary-glow);
}

.fab-mini .material-icons-round {
    font-size: 30px;
}

.status-overlay {
    position: absolute;
    bottom: 8px;
    /* Position text below buttons */
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem !important;
    opacity: 0.7;
    pointer-events: none;
}

.fab {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: grid;
    place-items: center;
}

.fab .material-icons-round {
    font-size: 38px;
}

.fab.active {
    background: var(--danger);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    transform: scale(1.1);
}

.fab:active {
    transform: scale(0.9);
}

#status-text {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Audio Visualizer */
.audio-visualizer {
    height: 4px;
    display: flex;
    justify-content: center;
    gap: 4px;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.bar {
    width: 20%;
    background: var(--primary);
    animation: sound 0ms -800ms linear infinite alternate;
    height: 100%;
    transform-origin: bottom;
    transform: scaleY(0);
    transition: transform 0.1s linear;
}

/* End Screen */
#end-screen {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.end-card {
    text-align: center;
    max-width: 450px;
}

.stats {
    display: flex;
    gap: 20px;
    margin: 30px 0;
}

.stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-item .value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.secondary-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
    font-size: 1rem;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Utilities */
.hidden {
    display: none !important;
}

.placeholder-text {
    color: var(--text-muted);
    opacity: 0.5;
    text-align: center;
    margin-top: 50%;
    transform: translateY(-50%);
}

#toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(50, 50, 50, 0.9);
    padding: 12px 24px;
    border-radius: 50px;
    color: white;
    font-size: 0.9rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

#toast.show {
    opacity: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

@keyframes slideRight {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

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

/* Mobile Tweaks */
@media (max-width: 600px) {
    .glass-card {
        padding: 30px 20px;
        width: 100%;
    }

    .panel-header {
        font-size: 0.7rem;
        padding: 8px 15px;
    }

    .controls {
        height: 90px;
    }

    .fab {
        width: 64px;
        height: 64px;
    }

    .fab-mini {
        width: 50px;
        height: 50px;
    }
}

/* Feedback Section */
.feedback-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

.feedback-label {
    font-size: 0.95rem;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 4px;
}

.star-rating {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 10px 0;
    cursor: pointer;
}

.star-rating .star {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.2);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.3s;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.star-rating .star:hover {
    transform: scale(1.15);
}

.feedback-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 14px;
    color: white;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all 0.3s ease;
}

.feedback-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.feedback-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}
/* Onboarding Cards */
.onboarding-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-top: 15px;
}

.onboarding-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    text-align: left;
    position: relative;
    transition: all 0.2s;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.onboarding-card h3 {
    font-size: 1rem;
    color: var(--text-main);
    margin-bottom: 4px;
}

.onboarding-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.3;
    flex-grow: 1;
}

.onboarding-card .secondary-btn,
.onboarding-card .lemonsqueezy-button {
    margin-top: auto;
}

.premium-card {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.03);
}

.premium-card:hover {
    border-color: rgba(139, 92, 246, 0.5);
}

.card-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.4);
    letter-spacing: 0.5px;
}

.lemonsqueezy-button {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
