:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --secondary-color: #7c3aed;
  --bg-gradient-start: #e0e7ff;
  --bg-gradient-end: #f3e8ff;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.5);
  --text-dark: #1e1b4b;
  --text-light: #64748b;
  --danger: #ef4444;
  --success: #10b981;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 8px;
  --shadow-soft: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  color: var(--text-dark);
  min-height: 100vh;
  background-attachment: fixed;
  position: relative;
  font-size: 1.05rem;
  overflow-x: hidden;
  width: 100%;
}

body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url('../assets/logo.jpeg');
  background-size: cover;
  background-position: center;
  opacity: 0.04;
  z-index: -1;
  pointer-events: none;
}

/* App Layout Grid */
.app-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  width: 100%;
  min-height: 100vh;
}

body.student-mode .app-layout {
  grid-template-columns: 1fr;
}
body.student-mode .sidebar {
  display: none !important;
}

@media (max-width: 1024px) {
  .app-layout, body.student-mode .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--glass-border);
  }
}

@media (max-width: 768px) {
  .app-layout, body.student-mode .app-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    overflow-y: auto;
  }
  body { overflow: auto; }
  .main-content { 
    height: auto !important; 
    overflow-y: visible !important; 
    width: 100%; 
    padding: 1rem; 
  }
  .right-sidebar {
    border-left: none !important;
    border-top: 1px solid var(--glass-border) !important;
  }
  .glass-card, .glass-panel {
    padding: 1.5rem !important;
  }
  .record-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Sidebar */
.sidebar {
  border-radius: 0;
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 2rem 1.5rem;
  background: rgba(255, 255, 255, 0.6);
  z-index: 10;
  position: sticky;
  top: 0;
  height: 100vh;
}

.logo {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.sidebar-header h3 {
  margin-bottom: 0;
  font-size: 1.1rem;
}

.student-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
}

.student-item {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
}

.student-item:hover {
  background: rgba(255, 255, 255, 0.8);
  transform: translateX(5px);
}

.student-item.active {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

/* Main Content Area */
.main-content {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-soft);
}

h1, h2, h3 {
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Hero Banner */
.hero-banner {
  position: relative;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background-image: url('../assets/logo.jpeg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-soft);
}

.hero-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to right, rgba(15, 23, 42, 0.85), rgba(30, 27, 75, 0.65));
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  color: white;
}

.hero-content h1 {
  background: none;
  -webkit-text-fill-color: white;
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hero-content p {
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.5);
  font-size: 1.05rem;
  color: var(--text-dark);
  transition: all 0.3s ease;
  outline: none;
}

input:focus, select:focus {
  border-color: var(--primary-color);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Grids */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

.btn {
  display: inline-block;
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}
.btn:active { transform: translateY(1px); }

.btn-small {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  width: auto;
  border-radius: var(--radius-sm);
}

/* Records */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.record-card {
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border-left: 4px solid var(--primary-color);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
}
.record-card:hover {
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(31, 38, 135, 0.1);
}

.record-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding-bottom: 0.5rem;
}

.record-date { font-size: 0.95rem; color: var(--text-light); }
.record-subject { font-weight: 600; color: var(--text-dark); font-size: 1.25rem; }

.record-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) {
  .record-stats { grid-template-columns: repeat(2, 1fr); }
}

.stat-item { display: flex; flex-direction: column; }
.stat-label { font-size: 0.85rem; text-transform: uppercase; color: var(--text-light); }
.stat-value { font-weight: 700; font-size: 1.4rem; }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.8);
}

.empty-state {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
  font-style: italic;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-md);
  border: 1px dashed rgba(0,0,0,0.1);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-overlay.active { display: flex; }
.modal-content {
  width: 90%; max-width: 400px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: var(--radius-lg);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.close-btn {
  background: none; border: none; font-size: 1.5rem;
  cursor: pointer; color: var(--text-light);
}
.close-btn:hover { color: var(--danger); }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.5s ease forwards; }

/* Error Dashboard */
.error-dashboard {
  border-left: 4px solid var(--danger);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.7) 0%, rgba(254, 226, 226, 0.5) 100%);
}

.error-dashboard h2 {
  background: linear-gradient(to right, #dc2626, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.error-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1rem 0;
}

.error-tag {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.1);
  transition: transform 0.2s;
}

.error-tag:hover {
  transform: scale(1.05);
}

.error-tag .count {
  background: #dc2626;
  color: white;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.75rem;
}

/* Checkbox Container */
.topics-container {
  border: 2px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-sm);
  max-height: 150px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.topic-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 4px;
  transition: background 0.2s;
  color: var(--text-dark);
}

.topic-checkbox-label:hover {
  background: rgba(255, 255, 255, 0.8);
}
.topic-checkbox-label input {
  width: auto;
  cursor: pointer;
  transform: scale(1.1);
}
/* Coach Dashboard Styles */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: center;
}

.stat-card h3 {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.data-table th, .data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    background: rgba(255,255,255,0.5);
    color: var(--text-dark);
    font-weight: 600;
}

.data-table tbody tr:hover {
    background: rgba(255,255,255,0.3);
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 2rem 0 0 0;
}

.nav-item {
    padding: 1rem 1.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255,255,255,0.5);
    color: var(--primary-color);
}


/* Finished Books Grid */
.finished-books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

