/* ============================================
   LinguaAI Design System
   AI English Learning Platform - B2 to C2
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

/* === CSS Variables === */
:root {
  /* Colors */
  --primary: #6C5CE7;
  --primary-light: #a29bfe;
  --primary-dark: #4a3cb8;
  --secondary: #00D2FF;
  --secondary-light: #74e8ff;
  --accent-coral: #FF6B6B;
  --accent-green: #00E676;
  
  /* Skill Colors */
  --skill-listening: #3498DB;
  --skill-speaking: #E67E22;
  --skill-reading: #2ECC71;
  --skill-writing: #9B59B6;
  
  /* Backgrounds */
  --bg-deep: #0F0F23;
  --bg-surface: #1A1A3E;
  --bg-surface-hover: #252550;
  --bg-card: rgba(26, 26, 62, 0.6);
  --bg-input: #12122e;
  
  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0C0;
  --text-muted: #6B6B8D;
  
  /* Borders */
  --border-subtle: rgba(108, 92, 231, 0.2);
  --border-glass: rgba(255, 255, 255, 0.08);
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-primary: 0 0 20px rgba(108, 92, 231, 0.3);
  --shadow-glow-secondary: 0 0 20px rgba(0, 210, 255, 0.3);
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Sidebar */
  --sidebar-width: 260px;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms ease;
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--secondary); }

img { max-width: 100%; display: block; }

button {
  font-family: var(--font-primary);
  cursor: pointer;
  border: none;
  outline: none;
}

input, textarea, select {
  font-family: var(--font-primary);
  font-size: 1rem;
  outline: none;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }

.text-gradient {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-muted { color: var(--text-secondary); }

/* === Glassmorphism Card === */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow-primary);
}

.glass-card--no-hover:hover {
  transform: none;
  box-shadow: none;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 25px rgba(108, 92, 231, 0.6);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--primary);
}

.btn-glow {
  position: relative;
  overflow: hidden;
}
.btn-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-normal);
}
.btn-glow:hover::after { opacity: 1; }

.btn-skill-listening { background: var(--skill-listening); color: white; }
.btn-skill-speaking { background: var(--skill-speaking); color: white; }
.btn-skill-reading { background: var(--skill-reading); color: white; }
.btn-skill-writing { background: var(--skill-writing); color: white; }

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.1rem; }

/* === Input Fields === */
.input-field {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field::placeholder { color: var(--text-muted); }
.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

/* === Progress Bars === */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar__fill--listening { background: linear-gradient(90deg, var(--skill-listening), #5dade2); }
.progress-bar__fill--speaking { background: linear-gradient(90deg, var(--skill-speaking), #f39c12); }
.progress-bar__fill--reading { background: linear-gradient(90deg, var(--skill-reading), #58d68d); }
.progress-bar__fill--writing { background: linear-gradient(90deg, var(--skill-writing), #af7ac5); }
.progress-bar__fill--primary { background: linear-gradient(90deg, var(--primary), var(--secondary)); }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-primary { background: rgba(108, 92, 231, 0.2); color: var(--primary-light); }
.badge-listening { background: rgba(52, 152, 219, 0.2); color: var(--skill-listening); }
.badge-speaking { background: rgba(230, 126, 34, 0.2); color: var(--skill-speaking); }
.badge-reading { background: rgba(46, 204, 113, 0.2); color: var(--skill-reading); }
.badge-writing { background: rgba(155, 89, 182, 0.2); color: var(--skill-writing); }
.badge-success { background: rgba(0, 230, 118, 0.2); color: var(--accent-green); }
.badge-warning { background: rgba(255, 107, 107, 0.2); color: var(--accent-coral); }

/* === Sidebar Layout === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-deep);
  border-right: 1px solid var(--border-glass);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  padding: var(--space-lg);
}

.sidebar__logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: var(--space-2xl);
  color: var(--text-primary);
}

.sidebar__logo span { font-size: 1.8rem; }

.sidebar__nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
}

.sidebar__nav-item:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.sidebar__nav-item--active {
  background: rgba(108, 92, 231, 0.15);
  color: var(--primary-light);
  border-left: 3px solid var(--primary);
}

.sidebar__nav-item .icon { font-size: 1.2rem; width: 24px; text-align: center; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-top: 1px solid var(--border-glass);
  margin-top: auto;
}

.sidebar__user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.sidebar__user-info { flex: 1; }
.sidebar__user-name { font-weight: 600; font-size: 0.9rem; }
.sidebar__user-level { font-size: 0.75rem; color: var(--text-secondary); }

/* === Main Content === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-glass);
  background: rgba(15, 15, 35, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.top-bar__left h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.top-bar__right {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.page-content {
  padding: var(--space-xl);
}

/* === Grid System === */
.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* === Skill Cards === */
.skill-card {
  position: relative;
  overflow: hidden;
}

.skill-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.skill-card--listening::before { background: var(--skill-listening); }
.skill-card--speaking::before { background: var(--skill-speaking); }
.skill-card--reading::before { background: var(--skill-reading); }
.skill-card--writing::before { background: var(--skill-writing); }

.skill-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin-bottom: var(--space-md);
}

.skill-card__icon--listening { background: rgba(52, 152, 219, 0.15); }
.skill-card__icon--speaking { background: rgba(230, 126, 34, 0.15); }
.skill-card__icon--reading { background: rgba(46, 204, 113, 0.15); }
.skill-card__icon--writing { background: rgba(155, 89, 182, 0.15); }

/* === Animations === */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px rgba(108, 92, 231, 0.3); }
  50% { box-shadow: 0 0 20px rgba(108, 92, 231, 0.6); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-slide-up { animation: slideUp 0.6s ease forwards; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }
.animate-float { animation: float 3s ease-in-out infinite; }

.stagger-1 { animation-delay: 0.1s; opacity: 0; }
.stagger-2 { animation-delay: 0.2s; opacity: 0; }
.stagger-3 { animation-delay: 0.3s; opacity: 0; }
.stagger-4 { animation-delay: 0.4s; opacity: 0; }

/* === Chat Bubbles === */
.chat-bubble {
  max-width: 70%;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.chat-bubble--ai {
  background: var(--bg-surface);
  border: 1px solid var(--border-glass);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-bubble--user {
  background: linear-gradient(135deg, var(--primary), #5a4bd1);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* === Circular Progress === */
.circular-progress {
  position: relative;
  width: 120px;
  height: 120px;
}

.circular-progress svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.circular-progress__bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 8;
}

.circular-progress__fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.circular-progress__text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.circular-progress__value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
}

.circular-progress__label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* === Responsive === */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.8rem; }
}

/* === Utilities === */
.w-full { width: 100%; }
.text-center { text-align: center; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
