:root {
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --bot-bubble: #ffffff;
    --user-bubble: #6366f1;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-premium: 0 20px 50px -12px rgba(99, 102, 241, 0.15);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #e2e8f0;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    margin: 0;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.08) 0px, transparent 50%);
}

h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    width: 100%;
    max-width: 1440px;
    height: calc(100vh - 32px);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    overflow: hidden;
}

/* Dashboard Card Grid */
.dashboard-hub {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    padding: 0 40px 40px 40px;
    animation: fadeIn 0.6s ease-out;
}

.action-card {
    background: white;
    border-radius: 24px;
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0,0,0,0.02);
    cursor: pointer;
    text-align: left;
}

.action-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.action-card.progress { border-top: 4px solid #6366f1; }
.action-card.practice { border-top: 4px solid #10b981; }

.action-card h3 {
    font-size: 1.1rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-card p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.action-card .cta-btn {
    margin-top: auto;
    width: fit-content;
}

.greeting-banner {
    padding: 60px 40px 30px 40px;
    text-align: left;
}

.greeting-banner h2 {
    font-size: 2.25rem;
    margin-bottom: 8px;
}

.greeting-banner p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

header {
    padding: 24px 40px;
    background: rgba(255, 255, 255, 0.8);
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.logo span {
    color: var(--primary);
}

nav {
    display: flex;
    gap: 8px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-btn:hover:not(.active) {
    color: var(--text-main);
    background: rgba(255,255,255,0.3);
}

main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.view {
    display: none;
    width: 100%;
    height: 100%;
    animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.view.active {
    display: flex;
}

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

/* Chat Hub Layout */
#chat-hub {
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
}

.chat-container {
    display: flex;
    flex-direction: column;
    background: rgba(255,255,255,0.2);
    min-height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.1) transparent;
}

/* Message Bubbles - Ensure they don't block scrolling */
.message {
    max-width: 80%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    position: relative;
    word-wrap: break-word;
}

.bot-msg {
    align-self: flex-start;
    background: white;
    color: var(--text-main);
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0,0,0,0.02);
}

.user-msg {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-premium);
}

.chat-input-area {
    padding: 24px 40px;
    background: white;
    display: flex;
    gap: 16px;
    align-items: center;
}

#upload-btn {
    font-size: 1.25rem;
    padding: 8px;
    background: #f1f5f9;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

#upload-btn:hover {
    background: #e2e8f0;
    color: var(--primary);
}

textarea#chat-input {
    flex: 1;
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    height: 52px;
    transition: all 0.2s;
}

textarea#chat-input:focus {
    outline: none;
    background: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Sidebar Context Cards */
.context-sidebar {
    padding: 32px;
    background: rgba(255,255,255,0.4);
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.clever-card {
    background: white;
    border-radius: 24px;
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(0,0,0,0.02);
    animation: fadeIn 0.4s ease-out;
}

.clever-card h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.clever-card p {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

/* Practice focused mode */
.practice-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.exercise-card {
    width: 100%;
    text-align: left;
}

.step-indicator {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 24px;
    display: inline-block;
}

.visualization {
    width: 100%;
    height: 80px;
    background: #f8fafc;
    border-radius: 24px;
    margin: 24px 0;
    border: 1px dashed rgba(0,0,0,0.1);
}

.record-btn {
    background: #ef4444;
    color: white;
    border: none;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.record-btn:hover {
    transform: scale(1.1);
}

.record-btn .mic-icon { font-size: 1.5rem; }
.record-btn .btn-text { display: none; }

.feedback-card {
    margin-top: 40px;
    background: #ecfdf5;
    border-radius: 24px;
    padding: 24px;
    width: 100%;
    border: 1px solid #d1fae5;
}

.metric .value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #059669;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.typing-indicator {
    padding: 12px 18px;
    background: white;
    border-radius: 16px 16px 16px 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.02);
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.pulse {
    animation: premium-pulse 2s infinite;
}

@keyframes premium-pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* KB Admin in Light Theme */
.kb-container {
    max-width: 600px;
    margin: 60px auto;
    width: 100%;
}

.upload-zone {
    background: white;
    border: 2px dashed #e2e8f0;
    border-radius: 24px;
    padding: 60px;
    text-align: center;
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.mini table { font-size: 0.85rem; width: 100%; }
.mini th { border: none; padding-bottom: 8px; }
.mini td { border: none; padding: 4px 0; }

.text-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    margin-top: 24px;
    text-decoration: underline;
}

.secondary-btn:hover {
    background: #e2e8f0;
}

/* Loader Overlay */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(8px);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 24px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-overlay p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
}

/* TTS Styles */
.tts-btn {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--primary);
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

.tts-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

.bot-msg .tts-btn {
    margin-top: 12px;
    opacity: 0.8;
}

.bot-msg .tts-btn:hover {
    opacity: 1;
}

/* Stop Mode for Demonstration Button */
.exercise-btn.stop-mode {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.exercise-btn.stop-mode:hover {
    background: #dc2626 !important;
}
