/* ═══════════════════════════════════════════════════════════════
   NetKPSS — Stellar EdTech Design System  v6
   Font: Montserrat | Theme: Deep-Navy Glassmorphic Premium
   ═══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --bg-base:          #0d0d16;
  --bg-surface:       #13131b;
  --bg-surface-low:   #1b1b23;
  --bg-card:          #1f1f27;
  --bg-card-high:     #292932;
  --bg-card-highest:  #34343d;

  --primary:          #c1c1ff;
  --primary-container:#5d5fef;
  --secondary:        #ffafd1;
  --tertiary:         #3fdfa5;
  --outline:          #908fa0;
  --outline-variant:  #464555;

  --text-primary:     #e4e1ed;
  --text-muted:       #c7c4d7;
  --text-faint:       #908fa0;
}

/* ── Base ──────────────────────────────────────────────────── */
body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* room for mobile bottom nav */
  padding-bottom: env(safe-area-inset-bottom);
}

/* ── Glass Components ──────────────────────────────────────── */
.glass-panel {
  background: rgba(31, 31, 39, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s;
}

.glass-panel:hover {
  border-color: rgba(193, 193, 255, 0.15);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-container) 0%, #4849da 100%);
  color: #ffffff;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(93, 95, 239, 0.45),
              0 0 0 1px rgba(193, 193, 255, 0.15);
  opacity: 0.95;
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-secondary {
  background: rgba(41, 41, 50, 0.6);
  color: var(--text-muted);
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  padding: 0.625rem 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid var(--outline-variant);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: rgba(57, 56, 66, 0.8);
  border-color: var(--outline);
  color: var(--text-primary);
}

/* ── Stat Cards ────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-container), var(--tertiary));
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover::before { opacity: 1; }

.stat-card .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  font-family: 'Montserrat', sans-serif;
  letter-spacing: -0.02em;
}

.stat-card .label {
  font-size: 0.7rem;
  color: var(--text-faint);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-top: 0.3rem;
}

/* ── Subject Cards ─────────────────────────────────────────── */
.subject-card {
  background: var(--bg-card);
  border: 2px solid transparent;
  transition: all 0.3s ease;
  cursor: pointer;
}

.subject-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4),
              0 0 0 1px rgba(193, 193, 255, 0.1);
  background: var(--bg-card-high);
}

.active-card {
  border-color: var(--primary-container) !important;
  background: var(--bg-card-high) !important;
  box-shadow: 0 0 0 3px rgba(93, 95, 239, 0.2),
              0 0 20px rgba(193, 193, 255, 0.1);
}

/* ── Priority Borders ─────────────────────────────────────── */
.priority-high   { border-left-color: #ef4444 !important; }
.priority-medium { border-left-color: #f59e0b !important; }
.priority-low    { border-left-color: var(--outline-variant) !important; }

.priority-badge-high {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.priority-badge-medium {
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.25);
}
.priority-badge-low {
  background: rgba(144, 143, 160, 0.12);
  color: var(--outline);
  border: 1px solid rgba(144, 143, 160, 0.25);
}

/* ── Plan Day States ──────────────────────────────────────── */
.plan-day-past { opacity: 0.45; }

.plan-day-today {
  background: rgba(93, 95, 239, 0.12) !important;
  border-color: var(--primary-container) !important;
  box-shadow: 0 0 0 1px rgba(193, 193, 255, 0.15),
              0 0 24px rgba(93, 95, 239, 0.2);
}

.task-done {
  text-decoration: line-through;
  opacity: 0.55;
}

/* ── Charts ────────────────────────────────────────────────── */
.chart-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  height: 300px;
  max-height: 400px;
}

.chart-panel {
  background: linear-gradient(155deg, rgba(27, 27, 35, 0.95) 0%, rgba(13, 13, 22, 0.98) 100%);
  border: 1px solid rgba(193, 193, 255, 0.1);
  border-radius: 1rem;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 40px rgba(0, 0, 0, 0.35);
}

.chart-detail-wrap {
  position: relative;
  width: 100%;
  min-height: 280px;
  transition: height 0.35s ease;
}

.chart-overview-wrap {
  position: relative;
  width: 100%;
  height: 240px;
}

@media (min-width: 768px) {
  .chart-wrapper { height: 350px; }
  .chart-overview-wrap { height: 260px; }
}

/* ── Glow & Effects ───────────────────────────────────────── */
.neon-glow-primary {
  box-shadow: 0 0 15px rgba(193, 193, 255, 0.35);
}

.neon-glow-tertiary {
  box-shadow: 0 0 15px rgba(63, 223, 165, 0.35);
}

.glow-text {
  text-shadow: 0 0 20px rgba(193, 193, 255, 0.4);
}

.shimmer {
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
  background-size: 200% 100%;
  animation: shimmer 3s infinite linear;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ── Mobile Bottom Nav ────────────────────────────────────── */
#mobileBottomNav {
  font-family: 'Montserrat', sans-serif;
}

/* ── Footer Links ─────────────────────────────────────────── */
.footer-link:hover { color: var(--primary); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-surface); }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

/* ── Focus ────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Accessibility ────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.mobile-nav-open { display: flex !important; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-faint);
}
.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* ── Hero gradient ────────────────────────────────────────── */
.hero-gradient {
  background: linear-gradient(135deg, rgba(93, 95, 239, 0.1), rgba(13, 13, 22, 0));
}

/* ── Input ─────────────────────────────────────────────────── */
input[type="date"] {
  color-scheme: dark;
  min-height: 48px;
  appearance: none;
  -webkit-appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(0.7);
  cursor: pointer;
  padding: 4px;
  width: 20px;
  height: 20px;
  opacity: 0.65;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

@media (max-width: 640px) {
  input[type="date"] {
    font-size: 16px;
    min-height: 52px;
    padding: 14px 16px;
  }
  input[type="date"]::-webkit-calendar-picker-indicator {
    width: 24px;
    height: 24px;
  }
  /* Make room for bottom nav on mobile */
  body { padding-bottom: 5rem; }
}

/* ── Exam Option (Deneme) ─────────────────────────────────── */
.exam-option {
  transition: all 0.15s;
}
.exam-option:hover {
  border-color: rgba(193, 193, 255, 0.4) !important;
  background: rgba(93, 95, 239, 0.06) !important;
}

/* ══════════════════════════════════════════════════════════════
   DESIGN SYSTEM DEEP OVERRIDES — Glassmorphic Input & Form
   ══════════════════════════════════════════════════════════════ */

/* ── Input & Textarea styling ─────────────────────────────── */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  background: rgba(19, 19, 27, 0.8) !important;
  border: 1px solid rgba(70, 69, 85, 0.7) !important;
  color: var(--text-primary) !important;
  border-radius: 0.75rem !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: rgba(193, 193, 255, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(93, 95, 239, 0.15) !important;
  outline: none !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-faint) !important;
  opacity: 1 !important;
}

/* ── Section / Page Title Style ───────────────────────────── */
h1, h2 {
  letter-spacing: -0.01em;
}

/* ── Ambient page glow (all pages) ───────────────────────── */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(93, 95, 239, 0.09) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -10%;
  right: -5%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(63, 223, 165, 0.06) 0%, transparent 65%);
  pointer-events: none;
  z-index: 0;
}

/* Ensure page content sits above ambient glow */
body > nav,
body > main,
body > footer,
#mobileBottomNav {
  position: relative;
  z-index: 1;
}

/* ── Tag / Badge Pill helper ──────────────────────────────── */
.pill-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: rgba(93, 95, 239, 0.15);
  border: 1px solid rgba(193, 193, 255, 0.2);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Streak / Highlight Card ──────────────────────────────── */
.streak-card {
  background: linear-gradient(135deg, rgba(93, 95, 239, 0.15) 0%, rgba(63, 223, 165, 0.08) 100%);
  border: 1px solid rgba(193, 193, 255, 0.18);
  border-radius: 1rem;
  position: relative;
  overflow: hidden;
}
.streak-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-container), var(--tertiary));
}

/* ── Tab / toggle button active state ────────────────────── */
.tab-active {
  background: rgba(93, 95, 239, 0.2) !important;
  border-color: rgba(193, 193, 255, 0.3) !important;
  color: var(--primary) !important;
}

/* ── Checkbox custom ──────────────────────────────────────── */
input[type="checkbox"] {
  accent-color: var(--primary-container);
  width: 1.1rem;
  height: 1.1rem;
}

/* ── Progress bar ─────────────────────────────────────────── */
.progress-bar-track {
  background: rgba(70, 69, 85, 0.5);
  border-radius: 9999px;
  overflow: hidden;
  height: 6px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--primary-container), var(--primary));
  transition: width 0.6s ease;
}

/* ── Mobile bottom nav enhanced ───────────────────────────── */
#mobileBottomNav a {
  transition: color 0.15s, background 0.15s;
}

/* ── Link hover ───────────────────────────────────────────── */
a:not([class]) {
  color: var(--primary);
}
a:not([class]):hover {
  text-decoration: underline;
}

/* ── Topluluk — karşılama kartı sağ üst ────────────────────── */

.greeting-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.community-greeting-slot {
  flex: 0 0 auto;
  width: 128px;
  min-width: 128px;
  margin-top: 2px;
}

.community-greeting-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.65rem 0.6rem 0.7rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(63, 223, 165, 0.22);
  background: rgba(41, 41, 50, 0.85);
  overflow: hidden;
}

.community-greeting-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(63, 223, 165, 0.16), transparent 70%);
  pointer-events: none;
}

.community-live-badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.45rem;
  border-radius: 999px;
  background: rgba(63, 223, 165, 0.12);
  border: 1px solid rgba(63, 223, 165, 0.35);
  color: #3fdfa5;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.community-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fdfa5;
  box-shadow: 0 0 0 0 rgba(63, 223, 165, 0.55);
  animation: community-pulse-dot 2s ease-in-out infinite;
}

@keyframes community-pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(63, 223, 165, 0.55); }
  50% { box-shadow: 0 0 0 4px rgba(63, 223, 165, 0); }
}

.community-greeting-count {
  position: relative;
  z-index: 1;
  font-size: 1.45rem;
  font-weight: 900;
  line-height: 1;
  color: #3fdfa5;
  font-variant-numeric: tabular-nums;
}

.community-greeting-label {
  position: relative;
  z-index: 1;
  margin-top: 0.2rem;
  font-size: 0.6rem;
  font-weight: 600;
  color: #908fa0;
  line-height: 1.25;
}

.community-avatars {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
}

.community-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff;
  border: 2px solid #292932;
  margin-left: -6px;
}

.community-avatar:first-child { margin-left: 0; }

.community-avatar-more {
  background: #34343d !important;
  color: #c7c4d7;
  font-size: 0.48rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.community-avatar.community-avatar-img {
  padding: 0;
  overflow: hidden;
  background: #292932;
}

.community-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.community-avatar-fallback {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 800;
  color: #fff;
}

.community-greeting-skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(41, 41, 50, 0.4);
}

.community-pulse {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(63, 223, 165, 0.15);
  animation: community-skel-pulse 1.4s ease-in-out infinite;
}

.community-skel-bar {
  width: 40px;
  height: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  animation: community-skel-pulse 1.4s ease-in-out infinite;
}

@keyframes community-skel-pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.9; }
}

@media (max-width: 520px) {
  .greeting-header-row {
    flex-direction: column;
    align-items: stretch;
  }
  .community-greeting-slot {
    width: 100%;
    margin-top: 0.75rem;
  }
  .community-greeting-card {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem 0.75rem;
    padding: 0.75rem 1rem;
  }
  .community-live-badge { margin-bottom: 0; }
  .community-greeting-count { font-size: 1.25rem; }
  .community-greeting-label { margin-top: 0; }
  .community-avatars { margin-top: 0; width: 100%; }
}

/* ── CSS version tag (v6) ─────────────────────────────────── */

/* ══════════════════════════════════════════════════════════════
   HARD OVERRIDES — Forces Tailwind's existing slate/indigo
   utility classes to use the design system colors.
   These use !important to win over Tailwind's generated CSS.
   ══════════════════════════════════════════════════════════════ */

/* Background overrides */
.bg-slate-950 { background-color: #0d0d16 !important; }
.bg-slate-900 { background-color: #13131b !important; }
.bg-slate-800 { background-color: #1f1f27 !important; }
.bg-slate-700 { background-color: #34343d !important; }
.bg-slate-600 { background-color: #464555 !important; }
.bg-slate-500 { background-color: #64637a !important; }

/* Border color overrides */
.border-slate-700 { border-color: #34343d !important; }
.border-slate-600 { border-color: #464555 !important; }
.border-slate-500 { border-color: #64637a !important; }
.border-slate-800 { border-color: #1f1f27 !important; }
.border-slate-900 { border-color: #13131b !important; }

/* Text color overrides */
.text-slate-100 { color: #e4e1ed !important; }
.text-slate-200 { color: #e4e1ed !important; }
.text-slate-300 { color: #c7c4d7 !important; }
.text-slate-400 { color: #908fa0 !important; }
.text-slate-500 { color: #64637a !important; }

/* Indigo overrides */
.bg-indigo-900  { background-color: #22226a !important; }
.bg-indigo-800  { background-color: #33339a !important; }
.bg-indigo-700  { background-color: #4849da !important; }
.bg-indigo-600  { background-color: #5d5fef !important; }
.bg-indigo-500  { background-color: #8b8bef !important; }
.text-indigo-400 { color: #c1c1ff !important; }
.text-indigo-300 { color: #c1c1ff !important; }
.text-indigo-200 { color: #c1c1ff !important; }
.border-indigo-600 { border-color: #5d5fef !important; }
.border-indigo-500 { border-color: #8b8bef !important; }
.border-indigo-400 { border-color: #c1c1ff !important; }

/* Hover state overrides */
.hover\:bg-slate-700:hover { background-color: #34343d !important; }
.hover\:bg-slate-800:hover { background-color: #1f1f27 !important; }
.hover\:border-indigo-500:hover { border-color: #8b8bef !important; }
.hover\:text-indigo-300:hover { color: #c1c1ff !important; }

/* Focus ring overrides */
.focus\:border-indigo-500:focus { border-color: #8b8bef !important; }
.focus\:ring-indigo-500\/30:focus { box-shadow: 0 0 0 3px rgba(93,95,239,0.3) !important; }

/* Ring overrides */
.ring-indigo-500 { --tw-ring-color: rgba(139, 139, 239, 1) !important; }

/* Ensure body background */
html, body { background-color: #0d0d16 !important; color-scheme: dark; }
html.dark, html.dark body { background-color: #0d0d16 !important; }

/* iOS form elemanları */
@media (max-width: 900px) {
  select option {
    background: #1f1f27;
    color: #e4e1ed;
  }
  input, select, textarea {
    font-size: 16px !important;
  }
  #mobileBottomNav {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  .mr-inner { padding: 1rem 1rem 2.5rem; }
  .mr-nav { gap: 4px; }
  .mr-nav-item { padding: 10px 12px; font-size: 0.78rem; }
  .mr-data-card, .mr-embed .data-card, .data-card { padding: 1rem; }
}
