/* ==========================================================================
   HỌC PYTHON CÙNG TÔI - DESIGN SYSTEM & STYLESHEET
   Phát triển bởi Chuyên gia Python 20+ năm kinh nghiệm & Super Teamwork Swarm
   ========================================================================== */

:root {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(56, 189, 248, 0.3);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --py-blue: #38bdf8;
  --py-blue-dark: #0284c7;
  --py-yellow: #fbbf24;
  --py-yellow-dark: #d97706;
  --py-green: #34d399;
  --py-red: #f87171;
  --py-purple: #c084fc;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(241, 245, 249, 1);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(2, 132, 199, 0.4);
  
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Glassmorphism helpers */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
}

.glass-panel-glow {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  transition: all 0.25s ease;
}

.glass-panel-glow:hover {
  border-color: var(--border-highlight);
  box-shadow: 0 8px 30px -10px rgba(56, 189, 248, 0.15);
  transform: translateY(-2px);
}

/* Code Typography */
code, pre, .font-mono {
  font-family: var(--font-mono);
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.4);
}

/* Navigation active tab pill */
.nav-tab.active {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(251, 191, 36, 0.1));
  border-color: var(--py-blue);
  color: var(--py-blue);
  font-weight: 600;
}

/* Code Blocks Styling */
.code-container {
  position: relative;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  overflow: hidden;
  margin: 1rem 0;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.code-content {
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Interactive line highlighter */
.code-line {
  display: block;
  padding: 0 0.5rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.code-line:hover {
  background-color: rgba(56, 189, 248, 0.12);
}

.code-line.active {
  background-color: rgba(251, 191, 36, 0.18);
  border-left: 3px solid var(--py-yellow);
}

/* Console Output Styling */
.console-output {
  background: #05070c;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 1rem;
  min-height: 180px;
  max-height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.console-output .out-stdout {
  color: #e2e8f0;
}
.console-output .out-info {
  color: #38bdf8;
}
.console-output .out-success {
  color: #34d399;
}
.console-output .out-error {
  color: #f87171;
}

/* Editor Textarea with line numbers */
.editor-wrapper {
  position: relative;
  display: flex;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  overflow: hidden;
}

.line-numbers {
  padding: 1rem 0.5rem;
  text-align: right;
  color: #475569;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  min-width: 2.75rem;
}

.code-editor-area {
  flex: 1;
  width: 100%;
  min-height: 260px;
  background: transparent;
  color: #f8fafc;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  padding: 1rem;
  border: none;
  outline: none;
  resize: vertical;
  tab-size: 4;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-blue {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-yellow {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-purple {
  background: rgba(192, 132, 252, 0.15);
  color: #c084fc;
  border: 1px solid rgba(192, 132, 252, 0.3);
}

.badge-green {
  background: rgba(52, 211, 153, 0.15);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Callout Box (Góc nhìn chuyên gia 20 năm) */
.callout-mentor {
  border-left: 4px solid var(--py-yellow);
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.08) 0%, rgba(17, 24, 39, 0.2) 100%);
  padding: 1rem 1.25rem;
  border-radius: 0 0.75rem 0.75rem 0;
  margin: 1.25rem 0;
}

.callout-pitfall {
  border-left: 4px solid var(--py-red);
  background: linear-gradient(90deg, rgba(248, 113, 113, 0.08) 0%, rgba(17, 24, 39, 0.2) 100%);
  padding: 1rem 1.25rem;
  border-radius: 0 0.75rem 0.75rem 0;
  margin: 1.25rem 0;
}

/* Toast Container */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #1e293b;
  color: #f8fafc;
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
  animation: slideInRight 0.25s ease-out forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Modal Backdrop */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  max-width: 48rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transform: scale(0.95);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}
