/* ============================================
ByteToExam — базовые стили (base.css)
============================================ */

/* --- Переменные --- */
:root {
  --blue: #3b71ca;
  --blue-hover: #2b5cb3;
  --green: #20b2aa;
  --purple: #7b61ff;
  --text-dark: #111827;
  --text-gray: #718096;
  --bg: #f4f7fb;
  --white: #ffffff;
  --border: #e2e8f0;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* --- Сброс --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font);
}

html { font-size: 17.6px; }   /* 16px × 1.1 = 110% */

/* --- Основные стили --- */
body {
  background: var(--bg);
  color: var(--text-dark);
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Контейнер --- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Декоративный фон --- */
.bg-decor {
  position: absolute;
  z-index: -1;
  opacity: 0.08;
  font-family: monospace;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--blue);
  pointer-events: none;
}
.bg-decor--left { top: 15%; left: 3%; }
.bg-decor--right { bottom: 15%; right: 3%; text-align: right; }

/* ============================================
Кнопки
============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
  flex-shrink: 0;
}
.btn:active { transform: scale(0.97); }

.btn--outline {
  background: transparent;
  border-color: var(--blue);
  color: var(--blue);
}
.btn--outline:hover { background: rgba(59,113,202,0.06); }

.btn--primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.btn--primary:hover { background: var(--blue-hover); }

/* ============================================
Шапка
============================================ */

.header {
  background: var(--white);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.25rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* Правая часть: навигация + бургер */
.header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header__actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ============================================
Логотип
============================================ */

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.logo__img {
  height: 3.25rem;
  width: auto;
  object-fit: contain;
  display: block;
}
.logo__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.logo__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #0b2239;
  white-space: nowrap;
}
.logo__accent { color: var(--blue); }
.logo__sub {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-gray);
  white-space: nowrap;
}

/* ============================================
Бургер
============================================ */

.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1100;
  border-radius: 6px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.burger:hover { background: #f1f5f9; }
.burger__line {
  display: block;
  width: 1.4rem;
  height: 2px;
  background: #334155;
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.burger.active .burger__line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active .burger__line:nth-child(2) { opacity: 0; }
.burger.active .burger__line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================
Выпадающее меню
============================================ */

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--white);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  z-index: 1000;
  border-top: 1px solid #f1f5f9;
}
.mobile-menu.active { display: block; }
.mobile-menu__inner {
  padding: 16px 0;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}
.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-menu__link {
  display: none;
  padding: 0.9rem 0;
  font-size: 1rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  transition: background 0.15s;
}
.mobile-menu__link:hover { background: #f1f5f9; }
.mobile-menu__link--danger { color: #ef4444; }
.mobile-menu__link--danger:hover { background: #fef2f2; }

/* ============================================
   Lightbox (Увеличение картинок)
============================================ */
.image-modal-overlay {
    display: none; /* Скрыто по умолчанию */
    position: fixed;
    z-index: 9999;
    padding-top: 50px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85); /* Полупрозрачный черный фон */
    backdrop-filter: blur(5px);
}

.image-modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh; /* Картинка не будет выше экрана */
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.5);
    animation: zoomIn 0.3s ease;
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

@keyframes zoomIn {
    from {transform: scale(0.9); opacity: 0;}
    to {transform: scale(1); opacity: 1;}
}

/* ============================================
Универсальная кнопка "назад"
============================================ */

.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header__title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
  line-height: 1.2;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  color: #64748b;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  flex-shrink: 0;
  margin-top: 1.5px;
}

.back-btn:hover {
  background: #f4f8fe;
  color: var(--blue);
  border-color: var(--blue);
  transform: translateX(-3px);
}

.back-btn:active {
  transform: translateX(-1px);
}

main {
    flex: 1 0 auto;
}


/* ============================================
АДАПТИВНОЕ СКРЫТИЕ
============================================ */

/* --- ГОСТЬ --- */
@media (max-width: 860px) {
  .user-guest .header__actions .btn--register { display: none; }
  .user-guest .menu-link--register { display: block; }
  .user-guest .burger { display: flex; }
}
@media (max-width: 720px) {
  .user-guest .header__actions .btn--login { display: none; }
  .user-guest .menu-link--login { display: block; }
}

/* --- УЧЕНИК --- */
@media (max-width: 1000px) {
  .user-student .header__actions .btn--tests { display: none; }
  .user-student .menu-link--tests { display: block; }
  .user-student .burger { display: flex; }
}
@media (max-width: 860px) {
  .user-student .header__actions .btn--logout { display: none; }
  .user-student .menu-link--logout { display: block; }
}
@media (max-width: 720px) {
  .user-student .header__actions .btn--profile { display: none; }
  .user-student .menu-link--profile { display: block; }
}

/* --- УЧИТЕЛЬ --- */
@media (max-width: 1000px) {
  .user-teacher .header__actions .btn--teachers { display: none; }
  .user-teacher .menu-link--teachers { display: block; }
  .user-teacher .burger { display: flex; }
}
@media (max-width: 860px) {
  .user-teacher .header__actions .btn--logout { display: none; }
  .user-teacher .menu-link--logout { display: block; }
}
@media (max-width: 720px) {
  .user-teacher .header__actions .btn--profile { display: none; }
  .user-teacher .menu-link--profile { display: block; }
}

/* ============================================
Адаптив — прочее
============================================ */
@media (max-width: 720px) {
  .header__inner { padding: 0.75rem 1rem; }
  .btn { padding: 0.55rem 1rem; font-size: 0.85rem; }
  .logo__img { height: 2.6rem; }
  .logo__title { font-size: 1.2rem; }
  .logo__sub { font-size: 0.62rem; }
  .bg-decor { display: none; }
}

@media (max-width: 480px) {
  .logo__title { font-size: 1rem; }
  .logo__sub { display: none; }
}

/* ============================================
Футер (Школа ЦПМ)
============================================ */

.footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    width: 100%;
    margin-top: 3rem; /* Отступ от основного контента */
}

.footer__inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer__left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.footer__logo {
    height: 30px; /* Высота логотипа, подгони под свою картинку */
    width: auto;
    display: block;
}

.footer__separator {
    width: 1px;
    height: 24px;
    background-color: var(--border);
}

.footer__copy {
    font-size: 0.85rem;
    color: var(--text-gray);
}

.footer__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.4rem;
}

.footer__link {
    font-size: 0.85rem;
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.2s;
}

.footer__link:hover {
    color: var(--text-dark);
}

.footer__link--mail {
    color: var(--blue);
    font-weight: 600;
}

.footer__link--mail:hover {
    color: var(--blue-hover);
    text-decoration: underline;
}

@media (max-width: 860px) {
    .footer__inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer__left {
        flex-direction: column;
        gap: 0.8rem;
    }
    .footer__separator {
        display: none;
    }
    .footer__right {
        justify-content: center;
        align-items: center;
        gap: 1rem;
    }
}
