/* ==========================================================
   TOP Schedule Telegram Mini App — Stylesheet
   Style inspired by modern cosmic glassmorphism (Alius VPN)
   ========================================================== */

:root {
  --bg-dark: #090a15;
  --bg-surface: rgba(21, 23, 41, 0.72);
  --bg-surface-hover: rgba(30, 33, 58, 0.85);
  --bg-card: rgba(26, 29, 52, 0.65);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(140, 120, 255, 0.45);
  --border-glow: rgba(121, 82, 255, 0.35);

  --accent-primary: #7952ff;
  --accent-secondary: #a855f7;
  --accent-cyan: #38bdf8;
  --accent-coral: #ff5252;
  --accent-pink: #f43f5e;
  --accent-emerald: #10b981;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --bottom-bar-height: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: radial-gradient(circle at 50% 0%, rgba(121, 82, 255, 0.12) 0%, transparent 45%),
              radial-gradient(circle at 100% 40%, rgba(56, 189, 248, 0.08) 0%, transparent 40%),
              var(--bg-dark);
}

/* Cosmic Background Glows */
.glow-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
}
.glow-top {
  top: -100px;
  left: 20%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(121, 82, 255, 0.25) 0%, transparent 70%);
}
.glow-bottom {
  bottom: 50px;
  right: -50px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, transparent 70%);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: rgba(9, 10, 21, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7952ff 0%, #ec4899 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(121, 82, 255, 0.35);
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.header-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.1);
}
.syncing {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 16px 18px calc(var(--bottom-bar-height) + var(--safe-bottom) + 20px);
  z-index: 1;
}

/* Tab panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.25s ease forwards;
}
.tab-pane.active {
  display: block;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Calendar Section */
.calendar-section {
  margin-bottom: 20px;
}

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

.section-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.section-badge {
  font-size: 11px;
  font-weight: 600;
  background: rgba(121, 82, 255, 0.15);
  color: #c084fc;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid rgba(121, 82, 255, 0.25);
}

.calendar-nav-arrows {
  display: flex;
  gap: 6px;
}

.nav-arrow {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.nav-arrow:active {
  background: rgba(255, 255, 255, 0.15);
}

/* 7-Day Strip (Лента на 7 дней) */
.days-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 2px 8px;
  scrollbar-width: none;
}
.days-strip::-webkit-scrollbar {
  display: none;
}

.day-pill {
  flex: 0 0 54px;
  height: 72px;
  border-radius: 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.day-pill:active {
  transform: scale(0.92);
}

.day-pill .pill-weekday {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.day-pill .pill-date {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

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

.day-pill.has-classes .pill-dot {
  background: #38bdf8;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}

/* Active Day Pill (Glow & Gradient) */
.day-pill.active {
  background: linear-gradient(135deg, #7952ff 0%, #a855f7 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 20px rgba(121, 82, 255, 0.45);
  transform: translateY(-2px);
}
.day-pill.active .pill-weekday {
  color: rgba(255, 255, 255, 0.8);
}
.day-pill.active .pill-date {
  color: #fff;
}
.day-pill.active .pill-dot {
  background: #fff;
  box-shadow: 0 0 6px #fff;
}

/* Schedule Section */
.schedule-section {
  margin-top: 6px;
}

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

.schedule-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.schedule-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.lessons-counter {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Lessons Cards (в точности как на скриншоте 3) */
.lessons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lesson-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.lesson-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #7952ff 0%, #38bdf8 100%);
  border-radius: 4px 0 0 4px;
}

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

.lesson-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(121, 82, 255, 0.22);
  color: #c084fc;
  padding: 3px 9px;
  border-radius: 8px;
}

.lesson-time {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  letter-spacing: 0.3px;
}

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

.lesson-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.lesson-teacher {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.lesson-room {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  padding: 3px 8px;
  border-radius: 8px;
}

/* Empty State */
.empty-schedule-card {
  background: var(--bg-card);
  border: 1px dashed var(--border-subtle);
  border-radius: 20px;
  padding: 32px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-icon {
  font-size: 38px;
  margin-bottom: 6px;
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}
.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================
   ТАБ 2: КАЛЕНДАРЬ НА 30 ДНЕЙ (В точности как на скриншоте 2)
   ========================================================== */

.ios-calendar-card {
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
  padding: 22px 18px 20px;
  margin-bottom: 16px;
}

/* Красный заголовок месяца как на скриншоте 2 */
.ios-cal-month {
  color: #ff5252;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}

/* Строка дней недели (ПН … ВС) */
.ios-weekdays-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ios-weekdays-row span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Сетка чисел месяца (7 колонок: Пн … Вс) */
.ios-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 16px;
  column-gap: 8px;
  text-align: center;
}

.ios-grid-cell {
  height: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  border-radius: 12px;
  position: relative;
  transition: all 0.15s ease;
}

.ios-grid-cell:active {
  transform: scale(0.9);
}

.ios-grid-cell.empty {
  pointer-events: none;
  opacity: 0;
}

.ios-grid-cell.weekend {
  color: rgba(255, 255, 255, 0.45);
}

/* Выделение выбранного дня (красный скругленный блок как на скриншоте 2) */
.ios-grid-cell.active {
  background: #ff5252;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(255, 82, 82, 0.45);
}

/* Точка под числом, если есть пары (как на скриншоте 2 под числом 1) */
.ios-grid-cell .cell-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a855f7;
  position: absolute;
  bottom: 2px;
}

.ios-grid-cell.active .cell-dot {
  background: #ffffff;
}

/* ==========================================================
   ТАБ 3: ПРЕДМЕТЫ ЗА 30 ДНЕЙ
   ========================================================== */

.subject-item-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  margin-bottom: 12px;
}

.subject-item-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #38bdf8 0%, #7952ff 100%);
  border-radius: 4px 0 0 4px;
}

.subject-next-date-badge {
  font-size: 11px;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 3px 8px;
  border-radius: 8px;
}

/* ==========================================================
   ТАБ 4: ДЗ (ДОМАШНИЕ ЗАДАНИЯ)
   ========================================================== */

.homework-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hw-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.hw-group-title {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hw-group-count {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
}

.hw-group-count.review {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.hw-group-count.current {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.hw-group-count.done {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.homework-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.homework-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #ec4899 0%, #7952ff 100%);
  border-radius: 4px 0 0 4px;
}

.hw-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hw-subject-badge {
  font-size: 11px;
  font-weight: 700;
  background: rgba(121, 82, 255, 0.2);
  color: #c084fc;
  padding: 3px 8px;
  border-radius: 8px;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hw-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
}
.hw-status-assigned {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}
.hw-status-review {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}
.hw-status-done {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.hw-status-overdue {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
}

.hw-theme-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}

.hw-comment-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.hw-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.hw-teacher {
  color: var(--text-muted);
}

.hw-deadline {
  color: #fb7185;
  font-weight: 600;
}

/* ==========================================================
   BOTTOM NAVIGATION BAR
   ========================================================== */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  height: calc(var(--bottom-bar-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(14, 16, 31, 0.95);
  backdrop-filter: blur(24px);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 99999 !important;
  pointer-events: auto !important;
}

.nav-item {
  flex: 1;
  height: 100%;
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer !important;
  touch-action: manipulation !important;
  pointer-events: auto !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  pointer-events: none;
}

.nav-label {
  font-size: 11px;
  font-weight: 600;
  transition: color 0.2s ease;
  pointer-events: none;
}

/* Active Nav Item */
.nav-item.active {
  color: #fff;
}
.nav-item.active .nav-icon {
  background: rgba(121, 82, 255, 0.2);
  color: #c084fc;
}
.nav-item.active .nav-label {
  color: #fff;
  font-weight: 700;
}
