/* --- General Design System & Variables --- */
:root {
  /* Fonts */
  --font-latin: 'Outfit', sans-serif;
  --font-arabic: 'Amiri', serif;

  /* Light Theme Colors (Default) */
  --bg-primary: #f3f7f6;
  --bg-secondary: #e6efeb;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.4);
  --text-primary: #0f1e1a;
  --text-secondary: #3d5a52;
  --text-muted: #628279;
  
  --primary-color: #0b6b55; /* Deep Islamic Emerald */
  --primary-light: #129377;
  --primary-glow: rgba(11, 107, 85, 0.15);
  
  --accent-color: #c98e16; /* Warm Sand Gold */
  --accent-light: #e5ab37;
  --accent-glow: rgba(201, 142, 22, 0.15);

  --card-bg: rgba(255, 255, 255, 0.85);
  --card-border: rgba(11, 107, 85, 0.08);
  
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  
  --shadow-sm: 0 4px 6px -1px rgba(11, 107, 85, 0.05);
  --shadow-md: 0 10px 25px -5px rgba(11, 107, 85, 0.1);
  --shadow-lg: 0 20px 35px -10px rgba(11, 107, 85, 0.15);
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

/* Dark Theme Colors */
body.dark-theme {
  --bg-primary: #070d0b;
  --bg-secondary: #0c1a16;
  --glass-bg: rgba(12, 26, 22, 0.7);
  --glass-border: rgba(255, 255, 255, 0.06);
  --text-primary: #e6f3f0;
  --text-secondary: #9dbfb5;
  --text-muted: #6e8e85;
  
  --primary-color: #14b8a6; /* Lighter/brighter Emerald */
  --primary-light: #2dd4bf;
  --primary-glow: rgba(20, 184, 166, 0.25);
  
  --accent-color: #f59e0b; /* Bright Desert Gold */
  --accent-light: #fbbf24;
  --accent-glow: rgba(245, 158, 11, 0.25);
  
  --card-bg: rgba(15, 32, 27, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.5);
}

/* Base resets & styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

body {
  font-family: var(--font-latin);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  padding: 20px;
  position: relative;
}

/* Background Blurs */
.bg-blur {
  position: fixed;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.45;
  pointer-events: none;
}

body.dark-theme .bg-blur {
  opacity: 0.15;
}

.bg-blur-1 {
  background: radial-gradient(circle, var(--primary-light), transparent 70%);
  top: -10%;
  left: -10%;
}

.bg-blur-2 {
  background: radial-gradient(circle, var(--accent-light), transparent 70%);
  bottom: -10%;
  right: -10%;
}

/* App Container (Glassmorphism card) */
.app-container {
  width: 100%;
  max-width: 960px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: 85vh;
  min-height: 600px;
  overflow: hidden;
  position: relative;
  z-index: 10;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 30px;
  border-bottom: 1px solid var(--glass-border);
}

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

.logo-icon {
  width: 45px;
  height: 45px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary-color);
}

.arabic-logo {
  font-family: var(--font-arabic);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-color);
}

.logo-text p {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Progress Widget */
.progress-widget {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 150px;
}

.progress-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
  border-radius: 3px;
  transition: width 0.5s ease-out;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-secondary);
  border: none;
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  background: var(--primary-glow);
  color: var(--primary-color);
  transform: scale(1.05);
}

/* Navigation Tabs */
.app-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid var(--glass-border);
}

body.dark-theme .app-nav {
  background: rgba(255, 255, 255, 0.02);
}

.nav-item {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-muted);
  padding: 15px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-latin);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.nav-item i {
  font-size: 20px;
}

.nav-item:hover {
  color: var(--primary-color);
  background: rgba(11, 107, 85, 0.03);
}

.nav-item.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: rgba(11, 107, 85, 0.05);
}

/* Main Content Area */
.app-main {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  position: relative;
}

/* Scrollbar styling */
.app-main::-webkit-scrollbar {
  width: 6px;
}
.app-main::-webkit-scrollbar-track {
  background: transparent;
}
.app-main::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
}
body.dark-theme .app-main::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
}

/* Common Layouts & Components */

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 15px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--bg-secondary);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s ease-out forwards;
}

.toast.success { border-left: 4px solid var(--success); color: var(--success); }
.toast.error { border-left: 4px solid var(--error); color: var(--error); }
.toast.info { border-left: 4px solid var(--accent-color); color: var(--text-primary); }

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

/* --- TAB 1: PERCAKAPAN (LEARN VIEW) --- */
.learn-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  height: 100%;
}

.themes-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.themes-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.theme-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.02);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

body.dark-theme .theme-card {
  background: rgba(255, 255, 255, 0.02);
}

.theme-card:hover {
  background: var(--primary-glow);
  border-color: var(--glass-border);
}

.theme-card.active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.theme-card.completed::after {
  content: '\eab2'; /* checkmark icon from boxicons */
  font-family: 'boxicons';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--success);
  font-size: 18px;
}

.theme-card.active.completed::after {
  color: white;
}

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

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

.theme-name {
  font-size: 14px;
  font-weight: 600;
}

.theme-arabic {
  font-family: var(--font-arabic);
  font-size: 11px;
  opacity: 0.8;
}

.dialogue-panel {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
}

.dialogue-header {
  padding: 16px 20px;
  background: rgba(11, 107, 85, 0.05);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialogue-title-area h2 {
  font-size: 18px;
  font-weight: 700;
}

.dialogue-title-area p {
  font-size: 12px;
  color: var(--text-muted);
}

.dialogue-actions {
  display: flex;
  gap: 10px;
}

.btn {
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-latin);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.btn.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  border-color: transparent;
}

.btn.btn-primary:hover {
  box-shadow: 0 4px 10px var(--primary-glow);
}

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

/* Chat bubble styling */
.bubble-row {
  display: flex;
  width: 100%;
}

.bubble-row.left { justify-content: flex-start; }
.bubble-row.right { justify-content: flex-end; }

.chat-bubble {
  max-width: 75%;
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
  box-shadow: var(--shadow-sm);
  animation: fadeInBubble 0.4s ease-out;
}

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

.bubble-row.left .chat-bubble {
  background: var(--bg-secondary);
  border-bottom-left-radius: 4px;
}

.bubble-row.right .chat-bubble {
  background: rgba(11, 107, 85, 0.08);
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(11, 107, 85, 0.15);
}

.bubble-character {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary-color);
  margin-bottom: 6px;
  display: block;
}

.bubble-row.right .bubble-character {
  color: var(--accent-color);
  text-align: right;
}

.arabic-text {
  font-family: var(--font-arabic);
  font-size: 26px; /* Increased for Amiri readability */
  font-weight: 600;
  line-height: 1.8; /* Increased to prevent harakat clipping */
  direction: rtl;
  text-align: right;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.latin-text {
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.translation-text {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

/* Speak Button inside bubble */
.speak-btn {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  color: var(--primary-color);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: absolute;
  bottom: 8px;
  right: -40px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.bubble-row.right .speak-btn {
  right: auto;
  left: -40px;
}

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

.dialogue-footer {
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.01);
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.dark-theme .dialogue-footer {
  background: rgba(255, 255, 255, 0.01);
}

/* --- TAB 2: FLASHCARD VIEW --- */
.flashcard-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
  max-width: 500px;
  margin: 20px auto;
  height: 100%;
}

.flashcard-selector {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.select-dropdown {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-latin);
  font-size: 14px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  outline: none;
}

/* Flashcard element */
.flashcard-container {
  width: 100%;
  height: 280px;
  perspective: 1000px;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.flashcard.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  padding: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.card-front {
  background: linear-gradient(135deg, var(--card-bg), var(--bg-secondary));
  color: var(--text-primary);
}

.card-back {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  transform: rotateY(180deg);
}

.card-hint {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  position: absolute;
  top: 20px;
}

.card-back .card-hint {
  color: rgba(255,255,255,0.7);
}

.card-front .arabic-text {
  font-size: 42px;
  margin-bottom: 20px;
  font-weight: 700;
}

.card-back .translation-text {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-back .latin-text {
  font-size: 16px;
  color: rgba(255,255,255,0.9);
}

.card-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  justify-content: space-between;
}

.card-btn {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  font-size: 18px;
}

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

.card-indicator {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

/* --- TAB 3: KUIS INTERAKTIF --- */
.quiz-layout {
  max-width: 600px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quiz-progress-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
}

.quiz-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.quiz-question-lbl {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-color);
  letter-spacing: 0.5px;
}

.quiz-question {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.quiz-question .arabic-text {
  font-size: 32px;
  text-align: center;
  display: block;
  margin: 15px 0;
  direction: rtl;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.quiz-option {
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  padding: 14px 20px;
  font-family: var(--font-latin);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-option:hover {
  background: var(--primary-glow);
  border-color: rgba(11, 107, 85, 0.3);
}

.quiz-option.correct {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.quiz-option.correct::after {
  content: '\eab2';
  font-family: 'boxicons';
  font-size: 20px;
}

.quiz-option.incorrect {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--error) !important;
  color: var(--error) !important;
}

.quiz-option.incorrect::after {
  content: '\ea5d';
  font-family: 'boxicons';
  font-size: 20px;
}

/* Quiz Results Screen */
.quiz-results {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 30px;
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.results-icon {
  font-size: 80px;
  color: var(--accent-color);
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  to { transform: translateY(-10px); }
}

.results-score {
  font-size: 48px;
  font-weight: 800;
  color: var(--primary-color);
  margin-top: 10px;
}

.results-score span {
  font-size: 20px;
  color: var(--text-muted);
  font-weight: 500;
}

/* --- TAB 4: KAMUS SAKU --- */
.dictionary-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.search-bar-container {
  display: flex;
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: var(--text-muted);
}

.dictionary-search-input {
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px 14px 14px 48px;
  font-family: var(--font-latin);
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
}

.dictionary-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 20px;
}

.dictionary-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.dictionary-card:hover {
  transform: translateY(-2px);
  border-color: rgba(11, 107, 85, 0.2);
}

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

.dict-arabic {
  font-family: var(--font-arabic);
  font-size: 22px;
  font-weight: 700;
  direction: rtl;
  color: var(--primary-color);
}

.dict-speaker {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

.dict-speaker:hover {
  color: var(--primary-color);
}

.dict-latin {
  font-size: 12px;
  font-style: italic;
  color: var(--text-secondary);
}

.dict-indo {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.dict-category {
  display: inline-block;
  align-self: flex-start;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 4px;
}

/* Empty search result */
.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  grid-column: 1 / -1;
  padding: 40px;
  color: var(--text-muted);
  text-align: center;
}

.no-results i {
  font-size: 48px;
  margin-bottom: 12px;
}

/* --- TAB 5: TUTOR AI --- */
.ai-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  height: 100%;
}

.ai-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.api-key-input-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-field {
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-latin);
  font-size: 13px;
  outline: none;
  width: 100%;
}

.input-field:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.chat-container {
  display: flex;
  flex-direction: column;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  height: 100%;
  position: relative;
}

.chat-history {
  flex: 0 0 30%; /* 30% for text chat */
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(0,0,0,0.02);
  border-top: 1px solid var(--glass-border);
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  position: relative;
  animation: fadeInBubble 0.3s ease-out;
  box-shadow: var(--shadow-sm);
}

.chat-msg.user {
  align-self: flex-end;
  background: rgba(11, 107, 85, 0.08);
  border-bottom-right-radius: 4px;
  border: 1px solid rgba(11, 107, 85, 0.15);
}

.chat-msg.ai {
  align-self: flex-start;
  background: var(--bg-secondary);
  border-bottom-left-radius: 4px;
}

.chat-msg-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chat-msg.user .chat-msg-header {
  color: var(--accent-color);
  text-align: right;
}

.chat-msg .arabic-text {
  font-size: 24px;
  margin-bottom: 4px;
}

.chat-msg .latin-text {
  font-size: 11px;
  margin-bottom: 2px;
}

.chat-msg .translation-text {
  font-size: 13px;
}

.chat-input-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.01);
  border-top: 1px solid var(--glass-border);
}

body.dark-theme .chat-input-bar {
  background: rgba(255, 255, 255, 0.01);
}

.chat-input {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 30px;
  font-family: var(--font-latin);
  font-size: 14px;
  outline: none;
}

.chat-input:focus {
  border-color: var(--primary-color);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--glass-border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.icon-btn.mic-active {
  background: var(--error);
  color: white;
  border-color: transparent;
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Typing Indicator Animation */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 12px 18px;
  background: var(--bg-secondary);
  border-radius: 12px;
  align-self: flex-start;
  margin-top: 10px;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

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

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

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

/* Responsive Overrides */
@media (max-width: 768px) {
  body {
    padding: 0;
  }
  .app-container {
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .app-header {
    padding: 15px;
  }
  .logo-text h1 {
    font-size: 18px;
  }
  .progress-widget {
    width: 100px;
  }
  .learn-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .themes-panel {
    max-height: 150px;
    overflow-y: auto;
  }
  .theme-list {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .theme-card {
    flex-shrink: 0;
    padding: 8px 12px;
  }
  .chat-bubble {
    max-width: 85%;
  }
  .speak-btn {
    bottom: -36px;
    right: 10px;
    width: 28px;
    height: 28px;
  }
  .bubble-row.right .speak-btn {
    left: 10px;
  }
  .dialogue-body {
    padding-bottom: 40px;
  }
}

/* --- FASE 2: PREMIUM FEATURES STYLES --- */

/* 1. Dashboard View */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 25px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.08);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.stat-icon.streak {
  background: rgba(245, 158, 11, 0.08);
  color: #f59e0b;
}

.stat-icon.vocab {
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary-color);
}

.stat-icon.chat {
  background: rgba(139, 92, 246, 0.08);
  color: #8b5cf6;
}

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

.stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

@media (max-width: 768px) {
  .dashboard-row {
    grid-template-columns: 1fr;
  }
}

.dashboard-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
}

.panel-title i {
  font-size: 20px;
}

/* Ringkasan Skor Kuis */
.quiz-score-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.quiz-score-theme {
  display: flex;
  flex-direction: column;
}

.qs-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.qs-arabic {
  font-size: 12px;
  color: var(--text-muted);
}

.qs-score {
  font-size: 14px;
  font-weight: 800;
  color: var(--success);
}

/* 2. Starred / Bookmark Button */
.star-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 22px;
  color: var(--text-muted);
  transition: color 0.2s ease, transform 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin-left: auto;
}

.star-btn:hover {
  transform: scale(1.2);
}

.star-btn.active {
  color: #f59e0b; /* Emas */
}

/* 3. Filter Bar */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  width: 100%;
}

/* 4. Avatar UI (Dominan 70%) */
.avatar-section {
  flex: 1; /* Takes remaining 70% of chat container */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 25px;
  padding: 30px;
  background: linear-gradient(135deg, var(--bg-primary), rgba(11, 107, 85, 0.05));
  position: relative;
  overflow: hidden;
}

.avatar-frame {
  position: relative;
  width: 250px;
  height: 250px;
  max-height: 50vh;
  max-width: 50vh;
  border-radius: 50%;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg-card);
}

.avatar-frame.avatar-idle {
  border: 4px solid var(--border-color);
  animation: floatAvatar 4s infinite ease-in-out;
}

.avatar-frame.avatar-thinking {
  border: 4px solid var(--accent-color);
  animation: pulseAvatarThinking 1.5s infinite ease-in-out;
}

.avatar-frame.avatar-speaking {
  border: 4px solid var(--success);
  animation: pulseAvatarSpeaking 1s infinite ease-in-out;
}

.avatar-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 2;
}

.avatar-name {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.avatar-status {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 5px;
  padding: 4px 12px;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

/* Freemium Paywall Lock Styles */
.locked-content {
  position: relative;
  overflow: hidden;
  user-select: none;
}

.locked-content::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
}

body.dark-theme .locked-content::after {
  background: rgba(0, 0, 0, 0.7);
}

.lock-icon-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  background: var(--primary-color);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.premium-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.premium-modal {
  background: var(--card-bg);
  width: 90%;
  max-width: 450px;
  border-radius: 24px;
  padding: 30px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
  animation: slideUp 0.3s ease-out;
}

.premium-icon {
  font-size: 60px;
  color: var(--accent-color);
  margin-bottom: 15px;
}

.premium-modal h2 {
  font-size: 24px;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.premium-modal p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 25px;
}

.premium-btn {
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 30px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 15px var(--accent-glow);
  transition: transform 0.2s;
}

.premium-btn:hover {
  transform: translateY(-2px);
}

.premium-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 15px;
  cursor: pointer;
  text-decoration: underline;
}

@keyframes floatAvatar {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes pulseAvatarThinking {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 8px rgba(var(--accent-glow-rgb), 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 14px rgba(var(--accent-glow-rgb), 0.6);
  }
}

@keyframes pulseAvatarSpeaking {
  0%, 100% {
    transform: scale(1.02);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 16px rgba(16, 185, 129, 0.6);
  }
}

/* 5. Pronunciation Diff Visuals */
.diff-container {
  margin-top: 10px;
  padding: 10px 15px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.diff-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
}

.diff-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  direction: rtl;
  font-family: 'Cairo', sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

.diff-word {
  padding: 0 4px;
  border-radius: 4px;
}

.diff-word.correct {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.diff-word.incorrect {
  background: rgba(239, 68, 68, 0.12);
  color: var(--error);
  text-decoration: line-through;
}

.practice-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.practice-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: transparent;
}

/* --- NEW AI TUTOR LAYOUT (70/30) --- */
.ai-layout.new-design {
  display: flex;
  flex-direction: column;
  height: 75vh;
  min-height: 600px;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--card-border);
}

.ai-avatar-area {
  flex: 7; /* 70% height */
  min-height: 0;
  position: relative;
  background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ai-avatar-area img {
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  object-position: center bottom;
  animation: floatAvatar 6s ease-in-out infinite;
  z-index: 1;
}

@keyframes floatAvatar {
  0% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0); }
}

/* Speech Bubble */
.ai-speech-bubble {
  position: absolute;
  top: 10%;
  right: 15%;
  max-width: 300px;
  background: var(--card-bg);
  border: 2px solid var(--primary-color);
  border-radius: 20px 20px 0 20px;
  padding: 15px 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  z-index: 2;
  font-family: var(--font-arabic);
  font-size: 22px;
  color: var(--text-primary);
  text-align: right;
  direction: rtl;
  line-height: 1.5;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.ai-speech-bubble.hidden {
  display: none;
}

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

.ai-speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -15px;
  right: 20px;
  border-width: 15px 15px 0 0;
  border-style: solid;
  border-color: var(--primary-color) transparent transparent transparent;
}

/* Config Floating Button */
.floating-config-btn {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: all 0.2s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.floating-config-btn:hover {
  background: var(--primary-color);
  color: white;
  transform: rotate(45deg);
}

/* Config Modal */
.ai-config-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-config-modal {
  background: var(--card-bg);
  width: 90%;
  max-width: 400px;
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-config-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 12px;
  margin-bottom: 8px;
}

.ai-config-modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
}

/* Bottom Chat Area (30%) */
.ai-chat-area {
  flex: 3; /* 30% height */
  min-height: 0; /* FIX: prevent content from breaking flex ratio */
  background: var(--card-bg);
  border-top: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
}

.ai-chat-area .chat-history {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  border-radius: 0;
  border: none;
  background: transparent;
}

.ai-chat-area .chat-msg {
  max-width: 90%;
  padding: 12px 16px;
  font-size: 14px;
}

/* Make text tighter in chat history since it's 30% */
.ai-chat-area .arabic-text {
  font-size: 22px;
  margin-bottom: 4px;
  line-height: 1.8;
}
.ai-chat-area .latin-text, .ai-chat-area .translation-text {
  font-size: 12px;
  margin-bottom: 2px;
  line-height: 1.4;
}

/* Overriding old chat layout if needed */
.ai-chat-area .chat-input-bar {
  border-top: 1px solid var(--card-border);
  border-radius: 0;
  background: var(--bg-secondary);
}

/* --- NAHWU SHOROF LAYOUT --- */
.nahwu-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  min-height: 500px;
}

.nahwu-sidebar {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-xl);
  padding: 18px;
  height: fit-content;
  position: sticky;
  top: 20px;
  max-height: 80vh;
  overflow-y: auto;
}

.nahwu-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.nahwu-explanation {
  line-height: 1.8;
}

.nahwu-text {
  font-size: 14px;
  line-height: 2;
  color: var(--text-secondary);
}

.nahwu-text strong, .nahwu-text b {
  color: var(--primary-color);
  font-weight: 700;
}

/* Nahwu Table */
.nahwu-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  direction: ltr;
}

.nahwu-table th {
  background: var(--primary-color);
  color: white;
  padding: 10px 14px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.nahwu-table td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid var(--card-border);
  font-family: var(--font-arabic);
  font-size: 16px;
}

.nahwu-table tr:nth-child(even) td {
  background: var(--bg-secondary);
}

.nahwu-table tr:hover td {
  background: var(--primary-glow);
}

/* Nahwu Examples */
.nahwu-example {
  transition: transform 0.2s ease;
}

.nahwu-example:hover {
  transform: translateX(5px);
}

/* --- PREMIUM MODAL --- */
.premium-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.premium-modal {
  background: var(--card-bg);
  border: 1px solid var(--accent-color);
  border-radius: var(--radius-xl);
  padding: 40px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 30px var(--accent-glow);
  animation: bounceIn 0.4s ease;
}

@keyframes bounceIn {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); }
}

.premium-icon {
  font-size: 64px;
  color: var(--accent-color);
  margin-bottom: 16px;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}

.premium-modal h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.premium-modal p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.premium-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-light));
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--accent-glow);
  margin-bottom: 10px;
}

.premium-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.premium-close {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.premium-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* Locked theme card */
.theme-card.locked {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.theme-card.locked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(0,0,0,0.03) 10px,
    rgba(0,0,0,0.03) 20px
  );
  border-radius: inherit;
  pointer-events: none;
}

/* --- RESPONSIVE: NAV WITH 7 TABS --- */
@media (max-width: 768px) {
  .nahwu-layout {
    grid-template-columns: 1fr;
  }
  
  .nahwu-sidebar {
    position: static;
    max-height: none;
  }
  
  .app-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
  }
  
  .app-nav::-webkit-scrollbar {
    display: none;
  }
  
  .nav-item {
    flex: 0 0 auto;
    min-width: 70px;
    font-size: 11px;
  }
  
  .nav-item span {
    font-size: 10px;
    white-space: nowrap;
  }
}


@media (max-width: 768px) {
  .ai-layout.new-design {
    height: calc(100vh - 120px) !important;
    min-height: 400px !important;
  }
  .ai-avatar-area {
    flex: 4 !important; /* 40% height for avatar on mobile */
  }
  .ai-chat-area {
    flex: 6 !important; /* 60% height for chat to ensure usability */
  }
  .ai-chat-area .chat-msg {
    max-width: 95%;
  }
  
  /* Fix speech bubble covering face on mobile */
  .ai-speech-bubble {
    top: auto !important;
    bottom: 10px !important;
    right: 5% !important;
    left: 5% !important;
    max-width: 90% !important;
    font-size: 16px !important;
    padding: 10px !important;
    border-radius: 15px !important;
    text-align: center !important;
  }
  .ai-speech-bubble::after {
    display: none !important;
  }
  .floating-config-btn {
    top: 10px !important;
    left: 10px !important;
    width: 35px !important;
    height: 35px !important;
    font-size: 18px !important;
    z-index: 5 !important;
  }
}
