:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --ai-bubble: rgba(30, 41, 59, 0.8);
    --user-bubble: #3b82f6;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.3) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.2) 0, transparent 50%);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    gap: 24px;
}

.app-container {
    width: 100%;
    max-width: 600px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@media (min-width: 601px) {
    .app-container {
        height: 95vh;
        border-radius: 24px;
        overflow: hidden;
        border: 1px solid var(--glass-border);
    }
}

/* Sidebar Styles */
.sidebar {
    display: none; /* Hidden on mobile */
    width: 320px;
    height: 95vh;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

@media (min-width: 950px) {
    .sidebar {
        display: flex;
    }
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 4px;
}

.sidebar-header p {
    font-size: 14px;
    color: var(--text-secondary);
}

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

.topic-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
}

.topic-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.topic-icon {
    font-size: 20px;
}

/* Glassmorphism Classes */
.glass-header, .glass-footer {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}

/* Header */
.glass-header {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    gap: 16px;
    position: relative;
}

.avatar-container {
    position: relative;
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    border: 2px solid var(--bg-color);
    border-radius: 50%;
}

.header-info h1 {
    font-size: 18px;
    font-weight: 600;
}

.header-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.export-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.portfolio-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.export-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.portfolio-btn:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

@media (max-width: 450px) {
    .btn-text {
        display: none;
    }
    .export-btn {
        padding: 8px;
        font-size: 16px;
    }
    .portfolio-btn {
        padding: 6px 8px;
        font-size: 12px;
    }
}

/* Chat Container */
.chat-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    max-width: 85%;
    animation: fadeIn 0.3s ease-out;
}

.ai-message {
    align-self: flex-start;
}

.user-message {
    align-self: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

.ai-message .message-bubble {
    background-color: var(--ai-bubble);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

.user-message .message-bubble {
    background-color: var(--user-bubble);
    color: white;
    border-bottom-right-radius: 4px;
}

.glass-footer {
    border-top: 1px solid var(--glass-border);
    border-bottom: none;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.input-area {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 12px;
}

.text-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s, background 0.3s;
}

.text-input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.3);
}

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

.record-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
    position: relative;
    outline: none;
}

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

.cancel-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(239, 68, 68, 0.2);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

/* Recording State */
.record-btn.recording {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    animation: pulse-red 1.5s infinite;
}

.status-text {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color 0.3s;
}

.status-text.recording {
    color: #ef4444;
    font-weight: 600;
}

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

@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
    background-color: var(--ai-bubble);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

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

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

/* Advanced Feedback Features */
.ai-text {
    margin-bottom: 8px;
}

.replay-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.replay-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.feedback-card {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feedback-section {
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
}

.feedback-section.errors {
    border-left: 3px solid #ef4444;
}

.feedback-section.suggestions {
    border-left: 3px solid #f59e0b;
}

.feedback-section h4 {
    margin-bottom: 6px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.feedback-section ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.wiki-card {
    display: flex;
    gap: 16px;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
}

.wiki-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.wiki-info h4 {
    color: #a78bfa; /* Soft purple for vocabulary */
    margin: 0 0 4px 0;
    font-size: 16px;
}

.wiki-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.vocab-example {
    margin-top: 8px !important;
    color: #cbd5e1 !important;
    font-style: italic;
    border-left: 2px solid #a78bfa;
    padding-left: 8px;
}

.feedback-section li {
    margin-bottom: 4px;
}
