/**
 * Khatutik Platform — Base Design System & Global Styles
 * Adheres to 3-Color Palette & 3-Font Hierarchy (design_system.md)
 */

:root {
  /* ========================================================================
     Khatutik Master Color Palette
     - Primary Base:     #FFF5E6 (Светло-кремовый для фона)
     - Large Blocks/BG:  #B8DDF2 (Нежно-голубой для фона и крупных блоков)
     - Cards & Buttons:  #BFE3D0 (Мятный для карточек и кнопок)
     - Small Accents:    #F6C9B8 (Тёплый персиковый для небольших акцентов)
     ======================================================================== */
  --color-bg: #FFF5E6;              /* Светло-кремовый (основной фон страницы) */
  --color-block-bg: #B8DDF2;        /* Нежно-голубой (для крупных блоков) */
  --color-card-bg: #BFE3D0;         /* Мятный (для карточек) */
  --color-button: #BFE3D0;          /* Мятный (для кнопок) */
  --color-button-hover: #A7D7BC;    /* Насыщенный мятный при наведении */
  --color-button-text: #164E63;     /* Глубокий гармоничный цвет текста кнопок */

  --color-accent: #F6C9B8;          /* Тёплый персиковый (акценты) */
  --color-accent-hover: #EEB39E;
  --color-accent-text: #84321A;

  /* Brand Typography & Color Tone (Не чёрный!) */
  --color-brand-title: #1B4965;     /* Глубокий океанический тон для имени сайта */
  --color-brand-sub: #C86D51;       /* Тёплый терракотово-персиковый для подзаголовка */
  --color-text: #2C3E50;            /* Мягкий темно-сизый сланец вместо черного */
  --color-muted: #5C6F84;           /* Читаемый вторичный текст */
  --color-border: #D1E5E7;
  --color-border-light: rgba(184, 221, 242, 0.55);
  --color-surface: #FFFFFF;

  /* Semantic Blue / Peach Shades */
  --color-primary: #0284C7;         /* Sky Blue */
  --color-primary-hover: #0369A1;
  --color-primary-light: #B8DDF2;

  --color-secondary: #F6C9B8;       /* Warm Peach */
  --color-secondary-hover: #EEB39E;
  --color-secondary-light: #FFF0EB;

  --color-danger: #EF4444;
  --color-danger-light: #FEE2E2;

  /* Typography */
  --font-display: 'Fredoka', cursive, -apple-system, sans-serif;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Dimensions & Shapes */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(44, 62, 80, 0.04);
  --shadow-md: 0 10px 25px -5px rgba(27, 73, 101, 0.08), 0 8px 10px -6px rgba(44, 62, 80, 0.04);
  --shadow-lg: 0 20px 35px -5px rgba(27, 73, 101, 0.1), 0 10px 15px -5px rgba(44, 62, 80, 0.04);
}

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

/* Disable Microsoft Edge / IE native password reveal & clear buttons */
input[type="password"]::-ms-reveal,
input[type="password"]::-ms-clear {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}


body {
  font-family: var(--font-body);
  background-color: var(--color-bg);
  background-image: 
    radial-gradient(at 5% 5%, rgba(184, 221, 242, 0.45) 0px, transparent 55%),
    radial-gradient(at 95% 10%, rgba(246, 201, 184, 0.4) 0px, transparent 50%),
    radial-gradient(at 50% 95%, rgba(191, 227, 208, 0.45) 0px, transparent 55%);
  background-attachment: fixed;
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Shared Header with Soft Cloud Waves & Sky Atmospheric Backdrop
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(180deg, #B8DDF2 0%, rgba(184, 221, 242, 0.92) 55%, rgba(255, 245, 230, 0.98) 100%);
  border-bottom: none;
  overflow: hidden;
}

/* Atmospheric Sky Decor (Graceful Soaring Swallows & Sparkling Morning Stars ✨) */
.header-sky-decor {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.sky-bird {
  position: absolute;
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 2px 5px rgba(27, 73, 101, 0.18));
}

.sky-star {
  position: absolute;
  pointer-events: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.85)) drop-shadow(0 0 3px #FFFFFF);
  animation: starSparkle 3.2s ease-in-out infinite;
}

/* === Bird Placements in Open Sky Zones === */
/* Leading swallow between logo and center menu */
.bird-lead-left {
  left: 26%;
  top: 15%;
  width: 38px;
  height: 18px;
  animation: birdGlide1 7.2s ease-in-out infinite;
}

/* Companion swallow between logo and center menu */
.bird-pair-left {
  left: 32%;
  top: 34%;
  width: 26px;
  height: 13px;
  animation: birdGlide2 6.6s ease-in-out infinite 0.7s;
}

/* High-altitude soaring swallow in top sky above menu */
.bird-high-center {
  left: 50%;
  top: 6px;
  width: 30px;
  height: 15px;
  animation: birdSoarHigh 8.5s ease-in-out infinite;
}

/* Banking swallow in open sky between menu and login */
.bird-bank-right {
  right: 23%;
  top: 15%;
  width: 32px;
  height: 20px;
  animation: birdGlide1 7.8s ease-in-out infinite 1.4s;
}

/* Distant swallow in top right sky */
.bird-far-right {
  right: 16%;
  top: 30%;
  width: 24px;
  height: 12px;
  animation: birdGlide2 7s ease-in-out infinite 2s;
}

/* === Star Placements in Open Sky Zones (Visible & Sparkling) === */
.star-corner-left {
  left: 20px;
  top: 12px;
  animation-delay: 0s;
}

.star-above-title {
  left: 175px;
  top: 8px;
  animation-delay: 1.4s;
}

.star-gap-left-high {
  left: 22%;
  top: 10px;
  animation-delay: 0.6s;
}

.star-gap-left-low {
  left: 21%;
  top: 40px;
  animation-delay: 2.1s;
}

.star-top-center {
  left: 47%;
  top: 6px;
  animation-delay: 1.1s;
}

.star-gap-right-high {
  right: 21%;
  top: 10px;
  animation-delay: 0.4s;
}

.star-gap-right-low {
  right: 27%;
  top: 38px;
  animation-delay: 1.8s;
}

.star-corner-right {
  right: 24px;
  top: 12px;
  animation-delay: 0.9s;
}

/* Keyframe Animations */
@keyframes starSparkle {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.72) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.3) rotate(45deg);
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 1)) drop-shadow(0 0 5px #FFFFFF);
  }
}

@keyframes birdGlide1 {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  40% {
    transform: translate(11px, -6px) rotate(-3deg);
  }
  75% {
    transform: translate(18px, -2px) rotate(2deg);
  }
}

@keyframes birdGlide2 {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  45% {
    transform: translate(-9px, -5px) rotate(3deg);
  }
  80% {
    transform: translate(-15px, -2px) rotate(-2deg);
  }
}

@keyframes birdSoarHigh {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(calc(-50% + 14px)) translateY(-5px);
  }
}

/* Header Container */
.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.85rem 2rem 1.65rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  position: relative;
  z-index: 2;
}

/* Soft Cloud Waves Divider at Header Bottom */
.header-wave-divider {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 24px;
  pointer-events: none;
  z-index: 3;
  line-height: 0;
}

.header-wave-divider .wave-svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 -1px 3px rgba(184, 221, 242, 0.45));
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.25s ease;
}

.brand-link:hover {
  transform: translateY(-1px);
}

.brand-logo {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 18px rgba(246, 201, 184, 0.55);
  border: 3px solid #FFF5E6;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.brand-link:hover .brand-logo {
  transform: rotate(12deg) scale(1.08);
  box-shadow: 0 10px 24px rgba(246, 201, 184, 0.75);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--color-brand-title); /* Elegant Deep Ocean Blue — NOT black! */
  line-height: 1.05;
  transition: color 0.25s ease;
}

.brand-link:hover .brand-title {
  color: var(--color-primary);
}

.brand-subtitle {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-brand-sub); /* Warm terracotta/peach tone */
  line-height: 1.2;
  margin-top: 3px;
}

/* ==========================================================================
   Header Navigation — Animated Dandelion Glass Capsule
   ========================================================================== */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1.5px solid rgba(184, 221, 242, 0.8);
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 20px -2px rgba(27, 73, 101, 0.06), 0 2px 8px -1px rgba(246, 201, 184, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.header-nav:hover {
  border-color: var(--color-accent);
  box-shadow: 0 8px 28px -3px rgba(184, 221, 242, 0.4), 0 4px 14px -2px rgba(246, 201, 184, 0.35);
}

.header-nav-link {
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  white-space: nowrap;
  position: relative;
  transition: color 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
  z-index: 1;
}

/* Animated Glow Pill on Hover */
.header-nav-link::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-full);
  background: rgba(184, 221, 242, 0.35);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: -1;
}

/* Underline strictly centered under the menu label text */
.header-nav-link span {
  position: relative;
  display: inline-block;
}

.header-nav-link span::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--color-accent); /* #F6C9B8 - Тёплый персиковый */
  border-radius: var(--radius-full);
  transition: width 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease, background 0.2s ease;
  opacity: 0;
  pointer-events: none;
}

.header-nav-link .nav-icon {
  width: 22px;
  height: 22px;
  stroke: #475569;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), stroke 0.25s ease;
  flex-shrink: 0;
}

.header-nav-link:hover {
  color: var(--color-brand-title);
  transform: translateY(-2px);
}

.header-nav-link:hover::before {
  opacity: 1;
  transform: scale(1);
}

.header-nav-link:hover span::after {
  width: 100%;
  transform: translateX(-50%);
  opacity: 1;
  background: #E5A38F;
}

.header-nav-link:hover .nav-icon {
  stroke: var(--color-brand-title);
  transform: scale(1.12) rotate(5deg);
}

.header-nav-link.active {
  color: var(--color-brand-title);
  background: rgba(184, 221, 242, 0.4);
  box-shadow: inset 0 0 0 1.5px rgba(184, 221, 242, 0.85);
}

.header-nav-link.active span::after {
  width: 100%;
  transform: translateX(-50%);
  opacity: 1;
  background: #E5A38F;
}

.header-nav-link.active .nav-icon {
  stroke: var(--color-brand-title);
}

.header-nav-link:active {
  transform: scale(0.96) translateY(0);
}

.btn-header-action {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--color-button); /* #BFE3D0 - Мятный для кнопок */
  color: var(--color-button-text); /* #164E63 - Глубокий контрастный цвет */
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(191, 227, 208, 0.6);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1.5px solid rgba(167, 215, 188, 0.9);
  cursor: pointer;
}

.btn-header-action:hover {
  background: var(--color-button-hover); /* #A7D7BC */
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(167, 215, 188, 0.7);
}

.btn-header-action.btn-logout {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
  border: 1px solid rgba(239, 68, 68, 0.35);
  box-shadow: none;
}

.btn-header-action.btn-logout:hover {
  background: #DC2626;
  color: #FFFFFF;
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
  transform: translateY(-2px);
}

.btn-header-action:active {
  transform: translateY(0);
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: #FFFFFF;
  color: var(--color-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-full);
  text-decoration: none;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-back:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

/* ==========================================================================
   Shared Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid rgba(226, 232, 240, 0.7);
  background: rgba(253, 252, 249, 0.9);
  backdrop-filter: blur(10px);
  padding: 2rem 1.5rem 1.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
}

.footer-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.footer-nav-link {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-muted);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-nav-link:hover {
  color: var(--color-primary);
  background: var(--color-primary-light);
  transform: translateY(-1px);
}

.footer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

.footer-copy {
  font-size: 0.9rem;
  color: var(--color-muted);
  font-weight: 500;
}

.footer-credit {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--color-muted);
  font-weight: 500;
}

.footer-credit a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.footer-credit a:hover {
  color: var(--color-primary-hover);
  text-decoration: underline;
}

/* Contact Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  padding: 2rem;
  position: relative;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border-light);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--color-muted);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, background 0.2s;
}

.modal-close-btn:hover {
  color: var(--color-text);
  background: var(--color-border-light);
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.contact-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.contact-info h5 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
  margin-bottom: 0.2rem;
}

.contact-info p, .contact-info a {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
}

.contact-info a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .bird-pair-left,
  .bird-far-right,
  .star-above-title,
  .star-gap-left-low,
  .star-gap-right-low {
    display: none;
  }
}

@media (max-width: 992px) {
  .header-container {
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1.25rem 1.4rem 1.25rem;
  }
  .header-nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem;
  }
  .header-nav-link {
    font-size: 0.95rem;
    padding: 0.5rem 0.9rem;
    gap: 0.45rem;
  }
  .header-nav-link .nav-icon {
    width: 18px;
    height: 18px;
  }
  .brand-logo {
    width: 56px;
    height: 56px;
  }
  .brand-title {
    font-size: 1.65rem;
  }
  .brand-subtitle {
    font-size: 0.48rem;
    letter-spacing: 0.1em;
  }
  /* On tablets and mobile, hide intermediate gap elements to keep the layout clean */
  .bird-lead-left,
  .bird-bank-right,
  .star-gap-left-high,
  .star-gap-right-high {
    display: none;
  }
  .bird-high-center {
    top: 6px;
    transform: translateX(-50%) scale(0.85);
  }
  .star-corner-left {
    left: 8px;
    top: 8px;
    transform: scale(0.85);
  }
  .star-corner-right {
    right: 8px;
    top: 8px;
    transform: scale(0.85);
  }
  .btn-header-action {
    font-size: 0.95rem;
    padding: 0.6rem 1.2rem;
  }
}

@media (max-width: 640px) {
  .footer-nav {
    gap: 1.25rem;
  }
  .footer-bottom-row {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }
  .footer-copy, .footer-credit {
    text-align: center !important;
  }
}
