/* ========================================
   LANC1070 AI Tutor - Modern Theme CSS
   ======================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --primary-blue: #1e3a8a;
  --secondary-blue: #3b82f6;
  --accent-green: #10b981;
  --warning-amber: #f59e0b;
  --bg-light: #f8fafc;
  --card-bg: #ffffff;
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e7eb;
  
  /* Spacing */
  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  
  /* Borders */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------
   DEPRECATION: Compatibility aliases (temporary)

   These CSS custom properties are aliases for legacy
   variable names used across existing templates.

   Purpose: keep backward compatibility so older
   templates (or inline styles) that reference names
   like --primary-color continue to render correctly.

   Plan: keep these aliases until you've visually
   verified all pages. After verification, remove this
   block and rename any remaining legacy references to
   the canonical variables (e.g. --primary-blue).

   Safe to remove once a repo-wide grep for the legacy
   names returns no results and you've tested pages.
   (Timestamp: 2025-11-07)
  -------------------------------------------------- */
:root {
  --primary-color: var(--primary-blue);
  --secondary-color: var(--secondary-blue);
  --success-color: var(--accent-green);
  --warning-color: var(--warning-amber);
  --border-radius: var(--radius-md);
  --border-radius-lg: var(--radius-lg);
  --border-radius-xl: var(--radius-xl);
  --shadow-xl: var(--shadow-lg);
  --bg-primary: var(--card-bg);
  --bg-secondary: var(--bg-light);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-sm);
  color: var(--primary-blue);
}

h1 { font-size: 32px; }
h2 { font-size: 26px; }
h3 { font-size: 22px; }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; }

p {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--secondary-blue) 0%, var(--primary-blue) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-green) 0%, #059669 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: white;
  color: var(--secondary-blue);
  border: 2px solid var(--secondary-blue);
}

.btn-secondary:hover {
  background: var(--secondary-blue);
  color: white;
}

/* ========================================
   FORMS
   ======================================== */
.form-group {
  margin-bottom: var(--space-md);
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: inherit;
  transition: all 0.3s ease;
  background: white;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--secondary-blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

/* ========================================
   CARDS
   ======================================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: var(--space-xs);
}

/* ========================================
   NAVIGATION
   ======================================== */
.navbar {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  color: white;
  padding: var(--space-md) var(--space-lg);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-links {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.nav-links a {
  color: white;
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 260px;
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-blue) 0%, #0f172a 100%);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: white;
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-xs);
  border-radius: var(--radius-md);
  transition: all 0.3s ease;
  font-weight: 500;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateX(4px);
}

/* ========================================
   TABLES
   ======================================== */
.table-container {
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  color: white;
  position: sticky;
  top: 0;
}

th {
  padding: var(--space-md);
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

tbody tr {
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: #f1f5f9;
}

/* ========================================
   CHAT INTERFACE
   ======================================== */
.chat-container {
  max-width: 900px;
  margin: var(--space-lg) auto;
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.chat-header {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  color: white;
  padding: var(--space-lg);
  text-align: center;
}

.chatbox {
  height: 500px;
  overflow-y: auto;
  padding: var(--space-lg);
  background: #f8fafc;
}

.message {
  margin-bottom: var(--space-md);
  display: flex;
  gap: var(--space-sm);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 70%;
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.message.user .message-bubble {
  background: linear-gradient(135deg, var(--secondary-blue) 0%, var(--primary-blue) 100%);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.bot .message-bubble {
  background: white;
  border-bottom-left-radius: 4px;
  border-left: 4px solid var(--accent-green);
}

.chat-input-container {
  padding: var(--space-lg);
  background: white;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-sm);
}

.chat-input-container textarea {
  flex: 1;
  min-height: 60px;
  resize: none;
}

/* ========================================
   DASHBOARD SPECIFIC
   ======================================== */
.dashboard-header {
  background: linear-gradient(135deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
  color: white;
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.stat-card {
  background: white;
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: var(--primary-blue);
  margin-bottom: var(--space-xs);
}

.stat-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

/* ========================================
   QUIZ INTERFACE
   ======================================== */
.quiz-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--secondary-blue);
}

.quiz-output {
  background: #f8fafc;
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 2px solid var(--border-color);
  min-height: 150px;
  font-family: 'Georgia', serif;
  line-height: 1.8;
}

.feedback-box {
  background: #ecfdf5;
  border-left: 4px solid var(--accent-green);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  margin-top: var(--space-lg);
}

/* ========================================
   UTILITIES
   ======================================== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.text-center { text-align: center; }
.text-right { text-align: right; }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-primary { background: #dbeafe; color: var(--primary-blue); }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fed7aa; color: #92400e; }

/* ========================================
   FOOTER
   ======================================== */
.footer {
  text-align: center;
  padding: var(--space-md);
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border-color);
  background: white;
  margin-top: var(--space-xl);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
  :root {
    --space-lg: 24px;
    --space-xl: 32px;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .message-bubble {
    max-width: 85%;
  }
  
  .nav-links {
    flex-wrap: wrap;
  }
  
  table {
    font-size: 13px;
  }
  
  th, td {
    padding: var(--space-sm);
  }
}

/* ========================================
   LOADING STATES
   ======================================== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(59, 130, 246, 0.3);
  border-radius: 50%;
  border-top-color: var(--secondary-blue);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
