* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Tahoma, Arial, sans-serif;
  background: #f7fbff;
  color: #17233c;
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 230px 1fr;
  direction: rtl;
}

.sidebar {
  background: rgba(255, 255, 255, 0.96);
  color: #17233c;
  padding: 30px 22px;
  min-height: 100vh;
  height: 100vh;
  max-height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.08);
  z-index: 100;
}

.sidebar h2 {
  text-align: center;
  margin: 0 0 40px;
  font-size: 28px;
  color: #0f2d5c;
}

.sidebar a {
  height: 56px;
  padding: 0 18px;
  margin-bottom: 14px;
  border-radius: 16px;
  color: #334155;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.25s;
}

.sidebar a i {
  font-size: 25px;
}

.sidebar a:hover,
.sidebar a.active {
  background: #eaf3ff;
  color: #2563eb;
  box-shadow: inset 0 0 0 1px #dbeafe;
}

.sidebar .logout {
  color: #ef4444;
  margin-top: 45px;
}

.main {
  padding: 35px;
}

.main h1 {
  margin: 0 0 30px;
  font-size: 36px;
  color: #0f2d5c;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  max-width: 100%;
  gap: 26px;
  margin-bottom: 30px;
}

.card {
  background: linear-gradient(135deg, #ffffff, #f0fdf4);
  border-radius: 26px;
  padding: 30px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  border: 1px solid #e6ecf5;
}

.card h3 {
  margin: 0 0 24px;
  font-size: 27px;
  color: #0f2d5c;
}

.card input {
  width: 100%;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
  background: #ffffff;
}

.card input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 5px rgba(96, 165, 250, 0.14);
}

.card button {
  width: 100%;
  height: 56px;
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.25s;
  background: linear-gradient(135deg, #16a34a, #22c55e);
}

.card button:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px rgba(22, 163, 74, 0.22);
}

.students {
  background: white;
  border-radius: 26px;
  padding: 28px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  border: 1px solid #e6ecf5;
  margin-bottom: 30px;
}

.students h3 {
  margin: 0 0 22px;
  font-size: 27px;
  color: #0f2d5c;
}

#studentsList,
#submissionsList {
  min-height: 120px;
  border: 2px dashed #dbeafe;
  border-radius: 22px;
  display: grid;
  gap: 14px;
  padding: 20px;
  color: #64748b;
  font-size: 18px;
  background: #fbfdff;
}

.student-row {
  background: #f8fbff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1.3fr auto;
  gap: 14px;
  align-items: center;
  color: #17233c;
}

.student-row strong {
  color: #0f172a;
}

.student-row button {
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  background: #2563eb;
  color: white;
  cursor: pointer;
  font-weight: bold;
}

.submission-row {
  background: #f8fbff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.submission-info {
  display: grid;
  gap: 5px;
}

.submission-info strong {
  color: #0f2d5c;
  font-size: 18px;
}

.submission-info span,
.submission-info small {
  color: #64748b;
}

.submission-row audio {
  width: 100%;
}

.submission-row select,
.submission-row textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid #dbeafe;
  border-radius: 14px;
  font-family: inherit;
  outline: none;
}

.submission-row textarea {
  min-height: 80px;
  resize: vertical;
}

.submission-actions {
  display: flex;
  gap: 10px;
}

.submission-actions button {
  flex: 1;
  border: none;
  padding: 12px;
  border-radius: 14px;
  background: #2563eb;
  color: white;
  font-weight: bold;
  cursor: pointer;
}

.submission-actions .delete-btn {
  background: #ef4444;
}

@media (max-width: 900px) {
  .page {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    height: auto;
    max-height: none;
    position: static;
  }

  .student-row {
    grid-template-columns: 1fr;
  }

  .submission-actions {
    flex-direction: column;
  }
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.section-title h3 {
  margin: 0;
}

.refresh-btn {
  border: none;
  padding: 10px 16px;
  border-radius: 12px;
  background: #2563eb;
  color: white;
  font-weight: bold;
  cursor: pointer;
}
.toast {
  position: fixed;
  top: 25px;
  left: 25px;
  background: #0f2d5c;
  color: white;
  padding: 14px 22px;
  border-radius: 16px;
  font-weight: bold;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(-15px);
  pointer-events: none;
  transition: 0.3s;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  background: #16a34a;
}

.toast.error {
  background: #ef4444;
}

.toast.warning {
  background: #f59e0b;
}.card select {
  width: 100%;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  font-size: 16px;
  outline: none;
  font-family: inherit;
  background: #ffffff;
}

.grades-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.grades-grid button {
  border: none;
  border-radius: 16px;
  padding: 16px;
  background: #eaf3ff;
  color: #2563eb;
  font-weight: bold;
  cursor: pointer;
}

.grades-grid button:hover {
  background: #2563eb;
  color: white;
}
.teacher-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: white;
  border-radius: 22px;
  padding: 22px;
  text-align: center;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  border: 1px solid #e6ecf5;
}

.stat-card i {
  font-size: 38px;
  color: #2563eb;
}

.stat-card h3 {
  margin: 8px 0;
  font-size: 30px;
  color: #0f2d5c;
}

.stat-card p {
  margin: 0;
  color: #64748b;
  font-weight: bold;
}

/* Stories in Teacher Admin */
.card select {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  outline: none;
  font-family: inherit;
  font-size: 15px;
  background: white;
}

#storiesList {
  display: grid;
  gap: 12px;
}

.item {
  background: #f8fbff;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item strong {
  font-size: 17px;
  color: #0f2d5c;
}

.item small {
  color: #2563eb;
  font-weight: bold;
}

.item button {
  border: none;
  background: #ef4444;
  color: white;
  padding: 8px 16px;
  border-radius: 10px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  width: auto;
  height: auto;
}

.item button:hover {
  background: #dc2626;
  transform: translateY(-2px);
}

/* Multi-page Story Form Styles */
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  margin: 6px 0 4px;
}

.story-pages-section {
  margin-top: 18px;
  margin-bottom: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
}

.pages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.pages-header h4 {
  margin: 0;
  color: #0f2d5c;
  font-size: 17px;
  font-weight: 700;
}

.pages-count-badge {
  background: #dbeafe;
  color: #1e40af;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: bold;
}

.pages-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.page-box {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.page-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.page-box-header h5 {
  margin: 0;
  font-size: 15px;
  color: #1e293b;
  font-weight: bold;
}

.remove-page-btn {
  background: #fee2e2 !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5 !important;
  padding: 5px 12px !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  width: auto !important;
  height: auto !important;
  transition: 0.2s !important;
}

.remove-page-btn:hover {
  background: #fecaca !important;
  transform: none !important;
  box-shadow: none !important;
}

.page-text {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.page-text:focus {
  border-color: #3b82f6;
  outline: none;
}

.page-image-input {
  width: 100%;
  font-size: 13px;
  margin-bottom: 0 !important;
}

.add-page-btn {
  width: 100% !important;
  height: auto !important;
  padding: 10px 16px !important;
  margin-top: 14px !important;
  background: #eef2ff !important;
  color: #4338ca !important;
  border: 1.5px dashed #818cf8 !important;
  border-radius: 12px !important;
  font-weight: bold !important;
  font-size: 14px !important;
  cursor: pointer !important;
  transition: 0.2s !important;
}

.add-page-btn:hover {
  background: #e0e7ff !important;
  border-color: #6366f1 !important;
  transform: none !important;
  box-shadow: none !important;
}

.submit-btn {
  width: 100%;
  height: 56px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  font-weight: bold;
  font-size: 17px;
  cursor: pointer;
  transition: 0.25s;
}

.submit-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.25);
}

/* Active student row */
.student-row.active-student {
  border-color: #3b82f6 !important;
  background: #eff6ff !important;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.18) !important;
}

/* Clickable Stat Cards */
a.stat-card, .stat-card {
  text-decoration: none !important;
  color: inherit !important;
  display: block;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

a.stat-card:hover, .stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 24px 50px rgba(37, 99, 235, 0.16) !important;
  border-color: #93c5fd !important;
}

a.stat-card:active, .stat-card:active {
  transform: translateY(-2px);
}

.stat-card:hover i {
  transform: scale(1.12);
  transition: transform 0.25s ease;
}

/* Tabs in Teacher Students page */
.teacher-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.teacher-tab-btn {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  padding: 12px 20px;
  font-size: 16px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.teacher-tab-btn i {
  font-size: 20px;
}

.teacher-tab-btn:hover {
  border-color: #93c5fd;
  color: #2563eb;
  background: #f8faff;
}

.teacher-tab-btn.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.teacher-tab-btn .tab-badge {
  background: #e2e8f0;
  color: #334155;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: bold;
}

.teacher-tab-btn.active .tab-badge {
  background: rgba(255, 255, 255, 0.25);
  color: white;
}

.teacher-tab-btn .tab-badge-warning {
  background: #fef3c7;
  color: #d97706;
}

.teacher-tab-btn.active .tab-badge-warning {
  background: #fbbf24;
  color: #78350f;
}

.teacher-tab-btn .tab-badge-success {
  background: #dcfce7;
  color: #16a34a;
}

.teacher-tab-btn.active .tab-badge-success {
  background: #86efac;
  color: #14532d;
}

.students-search-input {
  width: 280px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.students-search-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.student-grade-badge {
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 10px;
  display: inline-block;
  margin-right: 6px;
}

.empty-tab-state {
  text-align: center;
  padding: 40px 20px;
  color: #64748b;
  font-size: 16px;
  font-weight: 600;
  background: #f8fbff;
  border-radius: 16px;
  border: 1.5px dashed #cbd5e1;
}
