@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800;900&family=Unbounded:wght@500;700;800;900&display=swap');

:root {
  --crp-red: #E31E24;
  --crp-red-bright: #FF3840;
  --crp-crimson: #C8161D;
  --bg-dark: #2E2832;
  --bg-panel: rgba(65, 56, 68, 0.84);
  --bg-card: rgba(255, 255, 255, 0.18);
  --bg-card-hover: rgba(255, 255, 255, 0.26);
  --border-light: rgba(255, 255, 255, 0.34);
  --text-main: #FFFFFF;
  --text-muted: rgba(255, 255, 255, 0.88);
  --glow-shadow: 0 12px 32px rgba(227, 30, 36, 0.48);
  --planet-bg: url('https://static.tildacdn.pro/tild3861-6661-4832-a265-323464366665/galaxy-night-panoram.jpg');
}

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

html, body {
  font-family: 'Montserrat', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.55;
  overflow-x: hidden;
  scroll-behavior: smooth;
  width: 100%;
}

h1, h2, h3, h4 {
  font-family: 'Unbounded', 'Montserrat', sans-serif;
  font-weight: 800;
  word-wrap: break-word;
}

a {
  text-decoration: none;
  color: inherit;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #26202A; }
::-webkit-scrollbar-thumb { background: var(--crp-red); border-radius: 4px; }

.text-red { color: var(--crp-red-bright); }

.gradient-text {
  background: linear-gradient(90deg, #FF757A 0%, #FF2A31 45%, #FFE0D6 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: textShimmer 5s linear infinite;
}

.planet-backdrop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 78% 24%, rgba(255, 70, 76, 0.42) 0%, transparent 46%),
    radial-gradient(circle at 18% 82%, rgba(255, 255, 255, 0.18) 0%, transparent 45%),
    linear-gradient(180deg, rgba(48, 40, 52, 0.28) 0%, rgba(38, 32, 42, 0.48) 100%),
    var(--planet-bg) center/cover no-repeat;
  filter: brightness(1.42) contrast(1.06) saturate(1.18);
  z-index: -3;
  pointer-events: none;
  animation: cosmicBreath 14s ease-in-out infinite alternate;
}

.planet-sphere-3d {
  position: fixed;
  width: 340px;
  height: 340px;
  right: 6%;
  top: 12%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 210, 200, 0.9), rgba(227, 30, 36, 0.65) 45%, rgba(40, 10, 18, 0.92) 85%);
  box-shadow:
    inset -30px -30px 60px rgba(0, 0, 0, 0.7),
    inset 15px 15px 40px rgba(255, 190, 180, 0.6),
    0 0 90px rgba(227, 30, 36, 0.45);
  opacity: 0.42;
  z-index: -2;
  pointer-events: none;
  animation: floatPlanet 9s ease-in-out infinite;
}

.orbital-ring {
  position: fixed;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 40px rgba(227, 30, 36, 0.2), inset 0 0 40px rgba(255, 255, 255, 0.08);
  pointer-events: none;
  z-index: -1;
  animation: spinOrbit 45s linear infinite;
}

.orbital-ring.ring-1 {
  width: 680px;
  height: 680px;
  top: -180px;
  right: -160px;
  border-color: rgba(255, 95, 100, 0.48);
}

.orbital-ring.ring-2 {
  width: 960px;
  height: 960px;
  bottom: -420px;
  left: -220px;
  animation-direction: reverse;
  animation-duration: 75s;
}

.glass-panel {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(75, 62, 82, 0.78));
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-light);
  border-radius: 24px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.24), inset 0 1px 2px rgba(255, 255, 255, 0.4);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(255, 255, 255, 0.58);
}

.btn-primary {
  background: linear-gradient(135deg, var(--crp-red-bright) 0%, var(--crp-crimson) 100%);
  color: #fff;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: 0.05em;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--glow-shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  text-align: center;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(227, 30, 36, 0.7);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
}

.btn-outline:hover {
  border-color: var(--crp-red-bright);
  background: rgba(227, 30, 36, 0.35);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: rgba(227, 30, 36, 0.34);
  border: 1px solid rgba(255, 115, 120, 0.68);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: #FFF;
  letter-spacing: 0.08em;
}

.badge-dot {
  width: 8px;
  height: 8px;
  background: #FF4D54;
  border-radius: 50%;
  box-shadow: 0 0 12px #FF4D54;
  animation: pulse 1.8s infinite;
  flex-shrink: 0;
}

.form-group { margin-bottom: 18px; text-align: left; }
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 7px;
  letter-spacing: 0.06em;
}

.form-control {
  width: 100%;
  padding: 13px 16px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid var(--border-light);
  color: #FFF;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  transition: all 0.25s ease;
  outline: none;
}

.form-control::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.form-control:focus {
  border-color: var(--crp-red-bright);
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.34);
}

.form-control option {
  background: #362C34;
  color: #FFF;
}

.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.form-checkbox input {
  accent-color: var(--crp-red);
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.portal-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar {
  width: 360px;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(88, 30, 38, 0.94) 0%, rgba(44, 34, 46, 0.96) 100%);
  backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 8px 0 35px rgba(0, 0, 0, 0.28);
  transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.main-area {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding: 40px;
}

/* МОБИЛЬНАЯ ШАПКА И ВЫДВИЖНОЕ МЕНЮ (OFF-CANVAS DRAWER) */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: rgba(38, 28, 38, 0.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-light);
  z-index: 90;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
}

.mobile-menu-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(227, 30, 36, 0.3);
  border: 1px solid rgba(255, 115, 120, 0.6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
  z-index: 95;
}

.sidebar-overlay.active {
  display: block;
}

.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  max-width: calc(100vw - 32px);
  padding: 14px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(227, 30, 36, 0.96), rgba(45, 35, 45, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  animation: fadeInUp 0.35s ease forwards;
}

.cosmic-star {
  position: fixed;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: -1;
  animation: twinkleStar 4s ease-in-out infinite;
}

@keyframes twinkleStar {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.35); box-shadow: 0 0 10px #fff; }
}

@keyframes floatPlanet {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-22px) rotate(4deg); }
}

@keyframes cosmicBreath {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

@keyframes textShimmer {
  to { background-position: 200% center; }
}

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

@keyframes floatSlow {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

@keyframes spinOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 77, 84, 0.8); }
  70% { box-shadow: 0 0 0 12px rgba(255, 77, 84, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 84, 0); }
}

.animate-fade-up {
  animation: fadeInUp 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.animate-float {
  animation: floatSlow 5.5s ease-in-out infinite;
}

/* ==========================================================================
   ПОЛНАЯ МОБИЛЬНАЯ И ПЛАНШЕТНАЯ АДАПТАЦИЯ (RESPONSIVE BREAKPOINTS)
   ========================================================================== */
@media (max-width: 960px) {
  .planet-sphere-3d {
    width: 200px;
    height: 200px;
    right: -40px;
    top: 8%;
    opacity: 0.3;
  }

  .portal-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    overflow-y: visible;
  }

  .mobile-topbar {
    display: flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 310px;
    max-width: 86vw;
    height: 100vh;
    transform: translateX(-105%);
    z-index: 110;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .main-area {
    padding: 82px 16px 32px !important;
    width: 100%;
    overflow-y: visible;
  }

  .grid-2,
  .profile-grid,
  .programs-showcase,
  .features-row,
  .hero-grid {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  .courses-grid,
  .timeline-grid,
  .stat-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .admin-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .tree-module {
    margin-left: 10px !important;
  }

  .tree-lesson {
    margin-left: 18px !important;
  }

  .glass-panel,
  .action-panel,
  .showcase-card,
  .hero-3d-card {
    padding: 20px !important;
    border-radius: 18px !important;
  }

  .modal-content {
    padding: 22px 18px !important;
    max-height: 90vh;
    width: 96vw !important;
  }
}

@media (max-width: 560px) {
  h1 { font-size: 26px !important; line-height: 1.2 !important; }
  h2 { font-size: 21px !important; line-height: 1.25 !important; }
  h3 { font-size: 17px !important; }

  header {
    padding: 12px 14px !important;
  }

  header img {
    height: 32px !important;
  }

  .hero {
    padding: 96px 14px 44px !important;
    min-height: auto !important;
  }

  .stat-bar {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .login-right {
    padding: 28px 18px !important;
  }

  .social-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .captcha-box {
    flex-wrap: wrap;
  }

  #captcha-canvas {
    width: 100%;
    height: 46px;
  }

  .btn-primary,
  .btn-outline {
    padding: 13px 20px;
    font-size: 12px;
  }

  .video-wrapper {
    border-radius: 14px !important;
    margin-bottom: 18px !important;
  }

  .attachment-pill {
    width: 100%;
    margin-right: 0 !important;
    justify-content: space-between;
  }

  .toast-notification {
    left: 16px;
    right: 16px;
    bottom: 16px;
    text-align: center;
  }
}