:root {
  --bg-color: var(--tg-theme-bg-color, #ffffff);
  --text-color: var(--tg-theme-text-color, #1a1a1a);
  --hint-color: var(--tg-theme-hint-color, #8e8e93);
  --link-color: var(--tg-theme-link-color, #2481cc);
  --button-color: var(--tg-theme-button-color, #2481cc);
  --button-text-color: var(--tg-theme-button-text-color, #ffffff);
  --secondary-bg-color: var(--tg-theme-secondary-bg-color, #f4f4f6);
  --card-bg: var(--tg-theme-secondary-bg-color, #f9f9fb);
  --card-border: rgba(0, 0, 0, 0.06);
  --active-card-border: #34c759;
  --radius: 16px;
  --transition: 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: var(--tg-theme-bg-color, #181818);
    --text-color: var(--tg-theme-text-color, #ffffff);
    --hint-color: var(--tg-theme-hint-color, #98989f);
    --secondary-bg-color: var(--tg-theme-secondary-bg-color, #242426);
    --card-bg: var(--tg-theme-secondary-bg-color, #242426);
    --card-border: rgba(255, 255, 255, 0.08);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  min-height: 100vh;
  touch-action: pan-y;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 600px;
  margin: 0 auto;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  min-height: 44px;
  max-height: 48px;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--card-border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}


.header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  padding: 0 6px;
}

.entity-title {
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
  line-height: 1.2;
}

.entity-subtitle {
  display: none;
}

.header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  transition: background-color var(--transition);
}

.icon-btn:active {
  background-color: var(--secondary-bg-color);
  transform: scale(0.92);
}

.star-active {
  fill: #ffb703;
  stroke: #ffb703;
}


/* Week Selector Bar */
.week-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background-color: var(--secondary-bg-color);
  border-bottom: 1px solid var(--card-border);
}

.week-arrow-btn {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  color: var(--text-color);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition);
}

.week-arrow-btn:active {
  transform: scale(0.88);
}

.week-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.week-label {
  font-size: 14px;
  font-weight: 700;
}

.parity-label {
  font-size: 11px;
  color: var(--hint-color);
  background: var(--bg-color);
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 500;
}

.today-badge {
  background: var(--button-color);
  color: var(--button-text-color);
  border: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity var(--transition);
}

.today-badge:active {
  opacity: 0.8;
}

/* Day Tabs Ribbon */
.day-ribbon {
  display: flex;
  padding: 8px 12px;
  gap: 6px;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--card-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.day-ribbon::-webkit-scrollbar {
  display: none;
}

.day-tab {
  flex: 1;
  min-width: 48px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 12px;
  border: 1px solid transparent;
  background-color: var(--secondary-bg-color);
  cursor: pointer;
  transition: all var(--transition);
}

.day-tab-title {
  font-size: 12px;
  font-weight: 700;
}

.day-tab-date {
  font-size: 10px;
  color: var(--hint-color);
  margin-top: 2px;
}

.day-tab-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background-color: transparent;
  margin-top: 3px;
}

.day-tab.has-lessons .day-tab-dot {
  background-color: var(--button-color);
}

.day-tab.active {
  background-color: var(--button-color);
  color: var(--button-text-color);
}

.day-tab.active .day-tab-date {
  color: rgba(255, 255, 255, 0.8);
}

.day-tab.active .day-tab-dot {
  background-color: #ffffff;
}

/* Swipe Viewport */
.schedule-viewport {
  flex: 1;
  overflow-y: auto;
  position: relative;
  touch-action: pan-y;
  padding: 12px 16px 24px;
}

.schedule-slider {
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.22s ease-out, opacity 0.22s ease-out;
}

.slide-left {
  animation: slideInLeft 0.2s ease-out forwards;
}

.slide-right {
  animation: slideInRight 0.2s ease-out forwards;
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(-24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Lesson Card */
.lesson-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  position: relative;
  transition: transform var(--transition);
}

.lesson-card.active-lesson {
  border: 2px solid var(--active-card-border);
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.15);
}

.lesson-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lesson-time-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lesson-number {
  background-color: var(--button-color);
  color: var(--button-text-color);
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.lesson-time {
  font-size: 13px;
  font-weight: 600;
}

.now-badge {
  background-color: rgba(52, 199, 89, 0.15);
  color: #248a3d;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  background-color: #34c759;
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.lesson-type-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 8px;
}

.type-lecture { background: #e3f2fd; color: #1565c0; }
.type-practice { background: #f3e5f5; color: #7b1fa2; }
.type-lab { background: #fff3e0; color: #e65100; }
.type-exam { background: #ffebee; color: #c62828; }
.type-default { background: var(--secondary-bg-color); color: var(--hint-color); }

.lesson-subject {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.lesson-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--hint-color);
  margin-top: 2px;
}

.detail-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-icon {
  font-size: 14px;
}

/* Empty State */
.empty-day-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 12px;
}

.empty-day-icon {
  font-size: 54px;
  margin-bottom: 8px;
}

.empty-day-title {
  font-size: 18px;
  font-weight: 700;
}

.empty-day-subtitle {
  font-size: 13px;
  color: var(--hint-color);
  max-width: 280px;
  line-height: 1.4;
}

/* Modal Search */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.modal.hidden {
  display: none !important;
}

.hidden {
  display: none !important;
}


.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background-color: var(--bg-color);
  border-radius: 20px 20px 0 0;
  padding: 16px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  animation: slideUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header input {
  flex: 1;
  background-color: var(--secondary-bg-color);
  border: 1px solid var(--card-border);
  color: var(--text-color);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.close-btn {
  background: transparent;
  border: none;
  font-size: 26px;
  color: var(--hint-color);
  cursor: pointer;
}

.search-results {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
}

.search-placeholder {
  font-size: 13px;
  color: var(--hint-color);
  text-align: center;
  padding: 30px 10px;
  line-height: 1.4;
}

.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background-color: var(--secondary-bg-color);
  border-radius: 12px;
  cursor: pointer;
  transition: transform var(--transition);
}

.search-item:active {
  transform: scale(0.98);
}

.search-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-item-name {
  font-size: 14px;
  font-weight: 600;
}

.search-item-type {
  font-size: 11px;
  color: var(--hint-color);
  text-transform: capitalize;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(30, 30, 30, 0.9);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  z-index: 200;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.hidden {
  opacity: 0;
  transform: translate(-50%, 10px);
}

/* Filter Pills */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 6px 16px 10px;
  background-color: var(--bg-color);
  border-bottom: 1px solid var(--card-border);
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill {
  background: var(--secondary-bg-color);
  border: 1px solid var(--card-border);
  color: var(--hint-color);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}

.filter-pill:active {
  transform: scale(0.95);
}

.filter-pill.active {
  background-color: var(--button-color);
  color: var(--button-text-color);
  border-color: var(--button-color);
}

/* Next Lesson Banner */
/* Live Day Widget (Dynamic Island for Today) */
.live-day-widget {
  margin-bottom: 14px;
}

.live-day-widget.hidden {
  display: none;
}

.live-widget {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 14px 16px;
  background-color: var(--secondary-bg-color);
  border: 1px solid var(--card-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
}


.live-widget.current-state {
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.12), rgba(36, 129, 204, 0.1));
  border-color: rgba(52, 199, 89, 0.45);
}

.live-widget.break-state {
  background: linear-gradient(135deg, rgba(255, 149, 0, 0.14), rgba(255, 204, 0, 0.1));
  border-color: rgba(255, 149, 0, 0.45);
}

.live-widget.before-state {
  background: linear-gradient(135deg, rgba(36, 129, 204, 0.12), rgba(88, 86, 214, 0.1));
  border-color: rgba(36, 129, 204, 0.4);
}

.live-widget.done-state {
  background: linear-gradient(135deg, rgba(175, 82, 222, 0.12), rgba(88, 86, 214, 0.1));
  border-color: rgba(175, 82, 222, 0.35);
}

.live-widget-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.live-pill-green {
  background: rgba(52, 199, 89, 0.22);
  color: #34c759;
}

.live-pill-orange {
  background: rgba(255, 149, 0, 0.22);
  color: #ff9500;
}

.live-pill-blue {
  background: rgba(36, 129, 204, 0.22);
  color: #2481cc;
}

.live-pill-purple {
  background: rgba(175, 82, 222, 0.22);
  color: #af52de;
}

.live-countdown {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-color);
}

.live-subject {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 4px;
}

.live-subtitle {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--hint-color);
  margin-bottom: 2px;
}

.live-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--hint-color);
  font-weight: 500;
  margin-bottom: 8px;
}

.live-progress-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
  margin-top: 6px;
}

.live-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #34c759, #30d158);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.live-widget-next {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.live-next-tag {
  font-size: 10px;
  font-weight: 800;
  color: var(--hint-color);
  letter-spacing: 0.4px;
}

.live-next-text {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Card States */
.lesson-card.active-lesson {
  border: 1.5px solid #34c759;
  box-shadow: 0 0 16px rgba(52, 199, 89, 0.25);
  position: relative;
  overflow: hidden;
}

.card-live-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 3px;
  background: #34c759;
  transition: width 0.5s ease;
}

.lesson-card.next-lesson-card {
  border: 1.5px solid #2481cc;
  background: linear-gradient(135deg, var(--secondary-bg-color), rgba(36, 129, 204, 0.06));
}

.lesson-card.past-lesson-card {
  opacity: 0.75;
}

.past-badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--hint-color);
  background-color: rgba(120, 144, 156, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
}

.next-badge {
  font-size: 10px;
  font-weight: 700;
  color: #2481cc;
  background-color: rgba(36, 129, 204, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


/* Modal Handle */
.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: var(--hint-color);
  opacity: 0.4;
  margin: 0 auto 12px;
}

/* Calendar Modal */
.calendar-modal-content {
  padding: 16px 16px 20px;
  max-height: 88vh;
}

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

.calendar-month-label {
  font-size: 16px;
  font-weight: 700;
  text-transform: capitalize;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: 28px repeat(7, 1fr);
  gap: 2px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--hint-color);
  margin-bottom: 8px;
}

.cal-col-wk {
  color: var(--button-color);
  opacity: 0.7;
}

.cal-sun {
  color: #ff3b30;
}

.calendar-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
  touch-action: pan-y;
  user-select: none;
}

.calendar-grid.cal-slide-left {
  animation: calSlideLeft 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.calendar-grid.cal-slide-right {
  animation: calSlideRight 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes calSlideLeft {
  from {
    opacity: 0.3;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes calSlideRight {
  from {
    opacity: 0.3;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.cal-row {

  display: grid;
  grid-template-columns: 28px repeat(7, 1fr);
  gap: 2px;
}

.cal-wk-cell {
  font-size: 11px;
  font-weight: 600;
  color: var(--hint-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--secondary-bg-color);
  border-radius: 8px;
  margin-right: 2px;
}

.cal-day-cell {
  min-height: 42px;
  padding: 4px 1px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  border-radius: 10px;
  cursor: pointer;
  background-color: transparent;
  transition: all 0.15s ease;
  position: relative;
}

.cal-day-cell:active {
  transform: scale(0.9);
}

.cal-day-cell.other-month {
  opacity: 0.28;
}

.cal-day-cell.today-cal-day {
  font-weight: 800;
  border: 1.5px solid var(--button-color);
}

.cal-day-cell.active-cal-day {
  background-color: var(--button-color);
  color: var(--button-text-color);
}

.cal-day-cell.active-cal-day .cal-date-num {
  font-weight: 700;
}

.cal-date-num {
  font-size: 13px;
  line-height: 1.2;
}

/* Colored Dots for Lessons */
.cal-dots {
  display: flex;
  gap: 2px;
  margin-top: 3px;
  max-width: 100%;
  flex-wrap: nowrap;
  justify-content: center;
}

.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-lecture { background-color: #1976d2; }
.dot-practice { background-color: #8e24aa; }
.dot-lab { background-color: #f57c00; }
.dot-exam { background-color: #d32f2f; }
.dot-other { background-color: #78909c; }

.cal-day-cell.active-cal-day .cal-dot {
  box-shadow: 0 0 2px #fff;
}

/* Legend */
.calendar-legend {
  display: flex;
  justify-content: space-around;
  padding: 8px 12px;
  background-color: var(--secondary-bg-color);
  border-radius: 12px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--hint-color);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

/* Actions */
.calendar-actions {
  display: flex;
  gap: 10px;
}

.btn-action {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity var(--transition), transform var(--transition);
}

.btn-action:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: var(--button-color);
  color: var(--button-text-color);
}

.btn-outline {
  background-color: var(--secondary-bg-color);
  color: var(--text-color);
  border: 1px solid var(--card-border);
}

/* ==========================================================================
   Admin Panel & Management Dashboard
   ========================================================================== */
.admin-btn {
  font-size: 17px;
  background: rgba(255, 184, 0, 0.15);
  border: 1px solid rgba(255, 184, 0, 0.4);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), background-color var(--transition);
}

.admin-btn:active {
  transform: scale(0.92);
}

.admin-modal-content {
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 20px 24px;
}


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

.admin-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-badge {
  background: linear-gradient(135deg, #ff9500, #ff3b30);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  letter-spacing: 0.5px;
}

.admin-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

/* Tabs */
.admin-tabs {
  display: flex;
  background: var(--bg-color);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
  margin-bottom: 18px;
}

.admin-tab-btn {
  flex: 1;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--hint-color);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.admin-tab-btn.active {
  background: var(--secondary-bg-color);
  color: var(--text-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* Views */
.admin-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-view.hidden {
  display: none;
}

/* Metrics Grid */
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.metric-card {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-num {
  font-size: 20px;
  font-weight: 800;
  color: var(--button-color);
}

.metric-label {
  font-size: 10px;
  color: var(--hint-color);
  font-weight: 500;
}

.metric-sub {
  font-size: 9px;
  font-weight: 600;
  color: #34c759;
  background: rgba(52, 199, 89, 0.12);
  padding: 1px 5px;
  border-radius: 6px;
  margin-top: 2px;
  align-self: center;
}

.metric-sub.highlight {
  color: var(--button-color);
  background: rgba(36, 129, 204, 0.12);
}

/* Distribution Card */
.admin-dist-card {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-dist-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--secondary-bg-color);
  gap: 2px;
}

.dist-segment {
  height: 100%;
  transition: width 0.4s ease;
}

.dist-segment.seg-group, .dist-dot.seg-group {
  background-color: #34c759;
}

.dist-segment.seg-teacher, .dist-dot.seg-teacher {
  background-color: #2481cc;
}

.dist-segment.seg-classroom, .dist-dot.seg-classroom {
  background-color: #ff9500;
}

.admin-dist-legend {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
}

.dist-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--hint-color);
}

.dist-legend-item b {
  color: var(--text-color);
}

.dist-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

/* Chips Row for Notification Times */
.admin-chips-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.admin-chip {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-color);
}

.admin-chip b {
  color: var(--button-color);
}


.admin-section-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--hint-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.top-lists-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.top-list-col {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
}

.top-list-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 8px;
}

.top-items-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.top-item-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80%;
}

.top-item-count {
  background: var(--secondary-bg-color);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  color: var(--button-color);
  border: 1px solid var(--card-border);
}

.top-empty {
  font-size: 12px;
  color: var(--hint-color);
  font-style: italic;
}

/* Maintenance Card */
.admin-card-section {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.maint-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.maint-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-color);
}

.maint-desc {
  font-size: 11px;
  color: var(--hint-color);
  margin-top: 2px;
}

/* iOS/Telegram Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #78788029;
  transition: 0.3s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}

input:checked + .slider {
  background-color: #34c759;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* Admin Form Elements */
.admin-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--hint-color);
}

.admin-input,
.admin-textarea {
  background: var(--secondary-bg-color);
  border: 1px solid var(--card-border);
  color: var(--text-color);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition);
}

.admin-input:focus,
.admin-textarea:focus {
  border-color: var(--button-color);
}

.admin-fields-row {
  display: flex;
  gap: 10px;
}

.admin-save-btn,
.bc-btn-send {
  background: var(--button-color);
  color: var(--button-text-color);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
}

.admin-save-btn:active,
.bc-btn-send:active,
.bc-btn-test:active {
  transform: scale(0.98);
}

.bc-buttons-row {
  display: flex;
  gap: 10px;
}

.bc-btn-test {
  flex: 1;
  background: var(--secondary-bg-color);
  border: 1px solid var(--card-border);
  color: var(--text-color);
  border-radius: 12px;
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.bc-btn-send {
  flex: 1.3;
}

.admin-status-alert {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

.admin-status-alert.success {
  background: rgba(52, 199, 89, 0.15);
  color: #34c759;
  border: 1px solid rgba(52, 199, 89, 0.3);
}

.admin-status-alert.error {
  background: rgba(255, 59, 48, 0.15);
  color: #ff3b30;
  border: 1px solid rgba(255, 59, 48, 0.3);
}

/* Media Upload in Broadcast */
.bc-file-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--secondary-bg-color);
  border: 1px dashed var(--button-color);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--button-color);
  cursor: pointer;
  transition: all var(--transition);
}

.bc-file-upload-btn:active {
  transform: scale(0.98);
  background: rgba(36, 129, 204, 0.1);
}

.bc-upload-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--hint-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Telegram Live Preview Container */
.tg-preview-container {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.tg-message-bubble {
  background: #212d3b;
  border-radius: 14px 14px 14px 4px;
  padding: 10px 12px 6px;
  width: 100%;
  box-sizing: border-box;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.tg-preview-media {
  border-radius: 10px;
  overflow: hidden;
  max-width: 100%;
}

.tg-preview-media img,
.tg-preview-media video {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
}

.tg-preview-text {
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  color: #fff;
}

.tg-preview-meta {
  align-self: flex-end;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin-top: -2px;
}

.tg-preview-checks {
  color: #4fa6ee;
  font-size: 11px;
}

/* Telegram Inline Button Preview */
.tg-preview-btn-wrapper {
  width: 100%;
}

.tg-inline-btn {
  background: rgba(43, 82, 120, 0.85);
  color: #ffffff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}



