:root {
  --bg-base:      #f9fafc;
  --bg-surface:   #ffffff;
  --bg-card:      #ffffff;
  --border:       #e5e7eb;

  --accent-blue:  #5448c8; /* Vivid purple/indigo */
  --accent-purple:#7c3aed;
  --accent-green: #22c55e;
  --accent-orange:#f26522; /* Coral orange */
  --accent-red:   #ef4444;

  --text-primary:  #111827;
  --text-secondary:#6b7280;
  
  --primary: var(--accent-blue);
  --secondary: var(--accent-orange);
  
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  overflow-y: scroll; /* Фиксирует скроллбар, чтобы вкладки меню не смещались по ширине в Windows */
}
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}

.panel { padding: 20px; }

/* Inputs */
.glass-input {
  width: 100%; box-sizing: border-box; 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  color: var(--text-primary); 
  padding: 12px 15px; 
  border-radius: 12px; 
  font-size: 1.1rem; 
  outline: none; 
  transition: border-color 0.2s, box-shadow 0.2s;
}
.glass-input:focus { 
  border-color: var(--primary); 
  box-shadow: 0 0 0 3px rgba(84, 72, 200, 0.1); 
}

/* Cards */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

/* Buttons */
.btn-glass {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 9999px; /* Pill shape */
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}
.btn-glass:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}
.btn-primary-gradient {
  background: var(--accent-blue);
  border: none;
  color: #fff;
  padding: 12px 24px;
  border-radius: 9999px; /* Pill shape for modern look */
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(84, 72, 200, 0.2);
  transition: all 0.3s ease;
}
.btn-primary-gradient:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(84, 72, 200, 0.3);
}

/* Status Indicators */
.status-indicator { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; margin-bottom: 15px; font-size: 1.5rem; margin-top: 10px; }
.status-indicator.green { background: rgba(34, 197, 94, 0.1); color: var(--accent-green); }
.status-indicator.yellow { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-indicator.red { background: rgba(239, 68, 68, 0.1); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-message { font-size: 1.1rem; color: var(--text-primary); line-height: 1.4; margin-bottom: 10px; font-weight: 600; }

/* Gamification & Badges */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 15px;
  margin-top: 15px;
}
.achievement-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: all 0.3s ease;
  position: relative;
  z-index: 1;
}
.achievement-badge.show-tooltip {
  z-index: 9999;
}
.achievement-badge > .badge-icon,
.achievement-badge > .badge-title {
  opacity: 0.5;
  filter: grayscale(1);
  transition: all 0.3s ease;
}
.achievement-badge.unlocked > .badge-icon,
.achievement-badge.unlocked > .badge-title {
  opacity: 1;
  filter: none;
}
.achievement-badge.unlocked {
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.badge-icon {
  width: 50px;
  height: 50px;
  background: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}
.achievement-badge.unlocked .badge-icon {
  background: rgba(242, 101, 34, 0.05);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
  box-shadow: 0 4px 15px rgba(242, 101, 34, 0.15);
}
.badge-title { font-size: 0.75rem; color: var(--text-primary); font-weight: 600; }

.badge-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-5px);
  background: #1e1e2d;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  font-weight: 600;
  width: max-content;
  max-width: 160px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
  line-height: 1.3;
}
.badge-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #1e1e2d transparent transparent transparent;
}
.achievement-badge .badge-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-10px);
}

@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  100% { transform: rotate(360deg); }
}

/* Alerts */
.churn-alert {
  background: #ffffff;
  border: 1px solid var(--accent-orange);
  border-radius: 20px;
  padding: 15px;
  display: flex;
  gap: 15px;
  align-items: flex-start;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(242, 101, 34, 0.08);
}
.churn-alert-icon { font-size: 24px; }
.churn-alert-content h4 { color: var(--text-primary); margin: 0 0 5px; font-size: 1rem; }
.churn-alert-content p { color: var(--text-secondary); margin: 0 0 10px; font-size: 0.9rem; }

/* Lesson List */
.attendance-list { list-style: none; padding: 0; margin: 0; }
.attendance-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; background: var(--bg-surface); border-radius: 16px; margin-bottom: 10px; border: 1px solid var(--border); }
.attendance-list li:last-child { margin-bottom: 0; }
.attendance-col { display: flex; flex-direction: column; }
.attendance-status { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 0.95rem; }

/* Mobile Bottom Nav */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.02);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  background: none;
  border: none;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  padding: 5px 15px;
}
.nav-item.active { color: var(--accent-blue); }
.nav-item svg { width: 20px; height: 20px; }

/* Toasts */
.toast-container { position: fixed; bottom: 80px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 2000; }
.toast { padding: 10px 20px; border-radius: 12px; background: #111827; border: none; color: #fff; font-size: 13px; font-weight: 500; animation: slideIn 0.3s forwards; box-shadow: 0 4px 15px rgba(0,0,0,0.2);}
.toast.error { border-left: 4px solid var(--accent-red); }
.toast.success { border-left: 4px solid var(--accent-green); }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.loading-overlay { position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(255,255,255,0.7); backdrop-filter: blur(4px); z-index:9999; display:none; align-items:center; justify-content:center; }
.spinner { width: 40px; height: 40px; border: 4px solid rgba(84, 72, 200, 0.1); border-top-color: var(--accent-blue); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-10px); } }

.page-fade-in { animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.page-fade-out { animation: fadeOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards; }

#app-root { min-height: 200px; transition: opacity 0.3s ease; }
