/* Base Styles */
:root {
    /* Light mode variables */
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --primary-bg: #eff6ff;
    --secondary: #f8fafc;
    --text: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --error: #ef4444;
    --card-bg: #ffffff;
    --body-bg: linear-gradient(to bottom, #f0f9ff, #e0f2fe);
    --code-bg: #1e293b;
    --code-text: #ffffff;
    --radius: 0.5rem;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  }

  /* Dark mode variables */
  .dark-mode {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --primary-bg: #1e293b;
    --secondary: #1e293b;
    --text: #f8fafc;
    --text-light: #cbd5e1;
    --border: #334155;
    --success: #10b981;
    --error: #ef4444;
    --card-bg: #0f172a;
    --body-bg: linear-gradient(to bottom, #0f172a, #1e293b);
    --code-bg: #0f172a;
    --code-text: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    font-family: "Inter", sans-serif;
    background: var(--body-bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: background 0.3s ease, color 0.3s ease;
  }

  /* Layout */
  .app-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
  }

  .screen {
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
  }

  .hidden {
    display: none !important;
  }

  /* Card Styles */
  .card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    width: 100%;
    transition: background 0.3s ease, box-shadow 0.3s ease;
  }

  .card-header {
    background: linear-gradient(to right, #2563eb, #3b82f6);
    color: white;
    padding: 1.5rem;
    position: relative;
  }

  .header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .card-content {
    padding: 1.5rem;
  }

  /* Theme Toggle */
  .theme-toggle {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.3s ease;
  }

  .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.2);
  }

  .theme-toggle .sun-icon {
    display: none;
  }

  .theme-toggle .moon-icon {
    display: block;
  }

  .dark-mode .theme-toggle .sun-icon {
    display: block;
  }

  .dark-mode .theme-toggle .moon-icon {
    display: none;
  }

  /* Welcome Screen */
  #welcome-screen h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  #welcome-screen h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  #welcome-screen p {
    color: var(--text-light);
    margin-bottom: 2rem;
  }

  /* Learning Screen */
  .learning-navigation {
    margin-bottom: 1.5rem;
  }

  .tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
  }

  .tab-btn {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    border-radius: var(--radius);
    transition: all 0.2s ease;
  }

  .tab-btn:hover {
    background: var(--secondary);
    color: var(--text);
  }

  .tab-btn.active {
    background: var(--primary-bg);
    color: var(--primary);
  }

  .tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
  }

  .tab-content.active {
    display: block;
  }

  .tab-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary);
  }

  .tab-content p {
    margin-bottom: 1.5rem;
  }

  .info-box {
    background: var(--primary-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: background 0.3s ease;
  }

  .info-box h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--primary-dark);
  }

  .info-box ul {
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .info-box li {
    margin-bottom: 0.5rem;
  }

  .command-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
  }

  .command-table th,
  .command-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
  }

  .command-table th {
    font-weight: 600;
    color: var(--primary-dark);
  }

  .command-table code {
    background: rgba(59, 130, 246, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
  }

  .code-example {
    margin-bottom: 1.5rem;
  }

  .code-example h4 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }

  .code-container {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow-x: auto;
    font-family: monospace;
    transition: background 0.3s ease, color 0.3s ease;
  }

  .navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
  }

  .disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* Quiz Screen */
  .quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex: 1;
  }

  .timer {
    background: white;
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: bold;
  }

  .dark-mode .timer {
    background: var(--primary-bg);
  }

  .progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 1rem;
  }

  .progress-bar {
    height: 0.5rem;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
  }

  .progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: white;
    border-radius: 9999px;
    transition: width 0.3s ease;
  }

  .time-bar .progress-fill {
    transition: width 1s linear;
  }

  #question-text {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  .options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .option {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
  }

  .option:hover {
    background: var(--secondary);
  }

  .option.selected {
    border-color: var(--primary);
    background: var(--primary-bg);
  }

  .option.correct {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
  }

  .option.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
  }

  .option-radio {
    margin-right: 0.75rem;
    margin-top: 0.25rem;
  }

  .option-text {
    flex: 1;
  }

  .explanation-container {
    background: var(--primary-bg);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    animation: fadeIn 0.3s ease-in-out;
    transition: background 0.3s ease;
  }

  .explanation-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
  }

  .explanation-header h4 {
    font-weight: 600;
  }

  .button-container {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
  }

  /* Results Screen */
  .results-summary {
    text-align: center;
    margin-bottom: 2rem;
  }

  .score-badge {
    width: 5rem;
    height: 5rem;
    background: var(--primary-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    color: var(--primary);
    transition: background 0.3s ease;
  }

  #score-display {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  .score-progress {
    width: 100%;
    height: 0.5rem;
    background: var(--border);
    border-radius: 9999px;
    margin-bottom: 1rem;
    overflow: hidden;
  }

  .score-progress .progress-fill {
    background: var(--primary);
  }

  #score-feedback {
    color: var(--text-light);
    margin-bottom: 1rem;
  }

  .answers-summary h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
  }

  .answers-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    max-height: 300px;
    overflow-y: auto;
  }

  .answer-item {
    display: flex;
    gap: 0.75rem;
  }

  .answer-icon {
    flex-shrink: 0;
    margin-top: 0.25rem;
  }

  .answer-icon.correct {
    color: var(--success);
  }

  .answer-icon.incorrect {
    color: var(--error);
  }

  .answer-details p {
    margin-bottom: 0.25rem;
  }

  .answer-details .answer-wrong {
    color: var(--text-light);
    font-size: 0.875rem;
  }

  /* Buttons */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-size: 1rem;
  }

  .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .btn-primary {
    background: var(--primary);
    color: white;
  }

  .btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
  }

  .btn-outline {
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
  }

  .btn-outline:hover:not(.disabled) {
    background: var(--primary-bg);
  }

  /* Confetti */
  #confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
  }

  /* Animations */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Responsive */
  @media (max-width: 640px) {
    .card-header,
    .card-content {
      padding: 1rem;
    }

    .button-container {
      flex-direction: column;
    }

    .btn {
      width: 100%;
    }

    .tabs {
      flex-direction: column;
      gap: 0.5rem;
    }

    .tab-btn {
      width: 100%;
      text-align: left;
    }

    .header-content {
      flex-direction: column;
      gap: 0.5rem;
      align-items: flex-start;
    }

    .theme-toggle {
      position: absolute;
      top: 1rem;
      right: 1rem;
    }
  }
