﻿:root {
  --primary: #1a2b4c;
  --primary-light: #243a66;
  --accent: #2ea3f2;
  --accent-hover: #1b8cdb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --radius: 10px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
}

/* App Header & Navigation */
.app-header {
  background: var(--primary);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
}
.app-brand img {
  height: 38px;
  border-radius: 6px;
  background: #fff;
  padding: 2px;
}
.app-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.nav-btn {
  color: #e2e8f0;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-btn:hover, .nav-btn.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
.nav-btn.highlight {
  background: var(--accent);
  color: #fff;
}
.nav-btn.highlight:hover {
  background: var(--accent-hover);
}

/* Main Layout */
.app-container {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 20px;
}

/* Cards & Stats */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.stat-icon.blue { background: #e0f2fe; color: var(--accent); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.yellow { background: #fef3c7; color: var(--warning); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-val { font-size: 1.6rem; font-weight: 700; color: var(--text-main); line-height: 1.2; }
.stat-lbl { font-size: 0.85rem; color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: #e2e8f0; color: var(--text-main); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-blue { background: #e0f2fe; color: #0369a1; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }

/* Tables */
.table-responsive { overflow-x: auto; }
.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.custom-table th {
  background: #f1f5f9;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
}
.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
}
.custom-table tr:hover { background: #f8fafc; }

/* Whiteboard Canvas Studio */
.whiteboard-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  background: #ffffff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
}
.wb-toolbar {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.wb-tools-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.tool-btn {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-main);
  transition: all 0.15s;
}
.tool-btn:hover, .tool-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.color-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1;
}
.color-dot.active { box-shadow: 0 0 0 2px var(--accent); }
.canvas-wrapper {
  flex: 1;
  position: relative;
  background: #ffffff;
  cursor: crosshair;
  overflow: hidden;
}
#whiteboardCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Chat & Doubt Engine */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 650px;
  background: #ffffff;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.chat-header {
  padding: 14px 20px;
  background: var(--primary);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chat-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8fafc;
}
.chat-msg {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
}
.chat-msg.student {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 2px;
}
.chat-msg.ai {
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 2px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.chat-msg.tutor {
  align-self: flex-start;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
}
.chat-input-bar {
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 10px;
  align-items: center;
}
.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }

/* Video & Watermark */
.video-player-container {
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.video-player-container video {
  width: 100%;
  display: block;
}
.forensic-watermark {
  position: absolute;
  color: rgba(255, 255, 255, 0.28);
  font-size: 14px;
  font-family: monospace;
  pointer-events: none;
  user-select: none;
  z-index: 100;
  animation: floatWatermark 12s infinite alternate ease-in-out;
}
@keyframes floatWatermark {
  0% { top: 15%; left: 10%; }
  50% { top: 70%; left: 55%; }
  100% { top: 30%; left: 75%; }
}
