/* ═══════════════════════════════════════════════════════════════
   AstraMaster — Responsive / Mobile Styles
   Breakpoints:
     1024px — tablet landscape
      768px — tablet portrait
      560px — large phone
      400px — small phone
   ═══════════════════════════════════════════════════════════════ */

/* ─── GLOBAL ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --header-h: 60px; }

  .container,
  .header__inner { padding: 0 24px; }

  .section-header-centered { margin-bottom: 40px; }
}

@media (max-width: 768px) {
  .container,
  .header__inner { padding: 0 16px; }

  .section-title { font-size: clamp(1.4rem, 5vw, 2rem); }
  .section-sub   { font-size: .95rem; }
  .section-header-centered { margin-bottom: 32px; gap: 10px; }
}

@media (max-width: 400px) {
  .container,
  .header__inner { padding: 0 12px; }
}

/* ─── HEADER ────────────────────────────────────────────────────── */

/* Hamburger button — hidden on desktop */
.burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.08);
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
  margin-left: auto;
  transition: background .2s;
}
.burger:hover { background: rgba(255,255,255,0.14); }
.burger span {
  display: block;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all .25s;
}
.burger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.burger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .burger { display: flex; }
  .header__nav { display: none; }
  #header-actions-desktop { display: none; }
  .logo__img-file { height: 34px; }
}

/* ─── MOBILE MENU OVERLAY ───────────────────────────────────────── */
.mob-menu {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: rgba(10, 18, 40, 0.97);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  /* Hidden by default — use visibility so CSS transitions work */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-16px);
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
  overflow-y: auto;
  overflow-x: hidden;
}
.mob-menu.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear 0s;
}
.mob-menu__backdrop {
  position: fixed;
  inset: 0;
  z-index: 940;
  background: rgba(0,0,0,.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s, visibility 0s linear .3s;
}
.mob-menu__backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s, visibility 0s linear 0s;
}

/* On desktop — completely remove from layout */
@media (min-width: 769px) {
  .mob-menu,
  .mob-menu__backdrop { display: none !important; }
}

/* Background SVG layer */
.mob-menu__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.mob-menu__bg-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Inner layout */
.mob-menu__inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 0 24px 40px;
}

/* Top bar */
.mob-menu__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.mob-menu__logo-img {
  height: 38px;
  filter: brightness(0) invert(1);
}
.mob-menu__close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  cursor: pointer;
  transition: background .2s, border-color .2s;
  flex-shrink: 0;
}
.mob-menu__close:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.3);
}

/* Nav links */
.mob-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 28px 0 0;
}
.mob-menu__link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.85);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background .2s, border-color .2s, color .2s;
  backdrop-filter: blur(4px);
}
.mob-menu__link:hover,
.mob-menu__link.active {
  background: rgba(216,230,60,0.10);
  border-color: rgba(216,230,60,0.25);
  color: var(--white);
}
.mob-menu__link.active .mob-menu__link-text { color: var(--yellow); }

.mob-menu__link-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: rgba(135,187,215,0.12);
  border: 1px solid rgba(135,187,215,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--powder);
  flex-shrink: 0;
}
.mob-menu__link.active .mob-menu__link-icon {
  background: rgba(216,230,60,0.12);
  border-color: rgba(216,230,60,0.3);
  color: var(--yellow);
}
.mob-menu__link-text { flex: 1; }
.mob-menu__link-arrow { color: rgba(255,255,255,0.25); flex-shrink: 0; }

/* Divider */
.mob-menu__divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 28px 0;
}

/* Action buttons group */
.mob-menu__actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.mob-menu__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 52px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: all .2s;
  border: 2px solid transparent;
  cursor: pointer;
}

/* "О нас" — dark blue with yellow-green text */
.mob-menu__btn--about {
  background: rgba(19,36,65,0.75);
  border-color: rgba(135,187,215,0.25);
  color: var(--yellow);
  backdrop-filter: blur(8px);
}
.mob-menu__btn--about:hover {
  background: rgba(19,36,65,0.9);
  border-color: rgba(216,230,60,0.4);
}

/* "Войти" — outline only */
.mob-menu__btn--outline {
  background: transparent;
  border-color: rgba(255,255,255,0.35);
  color: var(--white);
}
.mob-menu__btn--outline:hover {
  background: rgba(255,255,255,0.07);
  border-color: var(--white);
}

/* "Регистрация" — solid lime-yellow */
.mob-menu__btn--primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--midnight);
  box-shadow: 0 4px 24px rgba(216,230,60,0.35);
}
.mob-menu__btn--primary:hover {
  background: var(--yellow-hover);
  border-color: var(--yellow-hover);
  box-shadow: 0 6px 32px rgba(216,230,60,0.5);
  transform: translateY(-1px);
}

/* Notification badge inside mob menu */
.mob-notif {
  background: var(--yellow);
  color: var(--midnight);
  font-size: .7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.4;
}

/* Tagline at bottom */
.mob-menu__tagline {
  margin-top: auto;
  padding-top: 36px;
  font-size: .78rem;
  color: rgba(255,255,255,0.2);
  text-align: center;
  font-weight: 300;
  letter-spacing: 0.02em;
}

@media (max-width: 400px) {
  .logo__img-file { height: 28px; }
}

/* ─── FOOTER ────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
}

@media (max-width: 768px) {
  .footer { padding: 48px 0 0; }
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-bottom: 32px;
  }
  .footer__desc { max-width: 100%; }
  .footer__bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding: 18px 0;
  }
}

/* ─── HOME — HERO ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero__inner { gap: 40px; }
  .hero__card-main { width: 300px; }
  .hero__card-float--3,
  .hero__card-float--5 { display: none; }
}

@media (max-width: 768px) {
  .hero {
    min-height: auto;
    padding: 56px 0 48px;
  }
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .hero__visual { display: none; }
  .hero__title  { font-size: clamp(1.9rem, 7vw, 2.8rem); }
  .hero__sub    { font-size: .95rem; }
  .hero__cta    { flex-direction: column; gap: 12px; }
  .hero__cta .btn { width: 100%; justify-content: center; }
  .hero__trust  { gap: 16px; }
  .hero__trust-sep { display: none; }
}

@media (max-width: 400px) {
  .hero { padding: 40px 0 36px; }
  .hero__title { font-size: 1.75rem; }
}

/* ─── HOME — STATS BAR ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .stats-bar__inner {
    flex-wrap: wrap;
    gap: 0;
    justify-content: flex-start;
  }
  .stats-item {
    width: 50%;
    padding: 16px 0;
    align-items: flex-start;
    padding-left: 24px;
  }
  .stats-sep { display: none; }
}

@media (max-width: 400px) {
  .stats-item { width: 100%; padding-left: 16px; }
}

/* ─── HOME — BENEFITS ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .benefits__grid { grid-template-columns: repeat(2, 1fr); }
  .benefits { padding: 72px 0; }
}

@media (max-width: 560px) {
  .benefits__grid { grid-template-columns: 1fr; }
  .benefits { padding: 56px 0; }
  .benefit-card { padding: 24px 20px; }
}

/* ─── HOME — HOW IT WORKS ───────────────────────────────────────── */
@media (max-width: 768px) {
  .how { padding: 56px 0; }
  .how__steps {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  .how-step { max-width: 100%; padding: 0; }
  .how__arrow { transform: rotate(90deg); padding: 8px 0; }
}

/* ─── HOME — CATEGORIES ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .categories { padding: 72px 0; }
}

@media (max-width: 560px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cat-card { padding: 20px 16px; }
  .categories { padding: 56px 0; }
}

@media (max-width: 360px) {
  .cat-grid { grid-template-columns: 1fr; }
}

/* ─── HOME — REVIEWS ────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .reviews__grid { grid-template-columns: repeat(2, 1fr); }
  .reviews { padding: 72px 0; }
}

@media (max-width: 768px) {
  .reviews__grid { grid-template-columns: 1fr; }
  .reviews { padding: 56px 0; }
}

/* ─── HOME — CTA BANNER ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .cta-banner__inner {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  .cta-banner__actions {
    flex-direction: column;
    width: 100%;
  }
  .cta-banner__actions .btn { width: 100%; justify-content: center; }
}

/* ─── ORDERS PAGE ───────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .board-layout { grid-template-columns: 240px 1fr; gap: 24px; }
}

@media (max-width: 900px) {
  .board-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }

  /* Collapsible mobile filter */
  .sidebar { display: none; }
  .sidebar.sidebar--open { display: flex; }

  .filter-toggle-btn {
    display: flex;
  }

  .orders-hero__inner { flex-direction: column; align-items: flex-start; gap: 20px; }
  .orders-hero__stats { flex-wrap: wrap; gap: 20px; }
  .board-wrap { padding: 24px 0 60px; }
}

@media (max-width: 600px) {
  .job-card { flex-direction: column; gap: 12px; }
  .job-card__date { margin-left: 0; }
  .job-card__footer { flex-wrap: wrap; }
  .job-card__user { margin-left: 0; }
  .job-toolbar { flex-direction: column; align-items: flex-start; }
  .job-toolbar__right { width: 100%; justify-content: flex-end; }
  .pagination-wrap { flex-direction: column; align-items: center; }
}

/* Filter toggle button — shown only on mobile */
.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  color: var(--midnight);
  cursor: pointer;
  transition: all .2s;
}
.filter-toggle-btn:hover { border-color: var(--midnight); }

/* ─── FREELANCERS PAGE ──────────────────────────────────────────── */
@media (max-width: 1100px) {
  .masters-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .masters-layout { grid-template-columns: 1fr; }
  .masters-grid   { grid-template-columns: repeat(2, 1fr); }
  .master-profile-layout { grid-template-columns: 1fr; }
  .masters-hero__inner { flex-direction: column; align-items: flex-start; gap: 20px; }
  .masters-hero__stats { flex-wrap: wrap; gap: 20px; }
  .masters-wrap { padding: 24px 0 60px; }
}

@media (max-width: 560px) {
  .masters-grid { grid-template-columns: 1fr; }
  .masters-toolbar { flex-direction: column; align-items: flex-start; }
}

/* ─── AUTH PAGES ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .auth-layout,
  .auth-layout--reversed { grid-template-columns: 1fr; }
  .auth-visual-side { display: none; }
  .auth-form-side   { padding: 40px 24px; }
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
  .auth-form-side { padding: 28px 16px; }
  .auth-title { font-size: 1.4rem; }
}

/* ─── DASHBOARD / PROFILE / CHAT ────────────────────────────────── */
@media (max-width: 1024px) {
  .admin-stats-row  { grid-template-columns: repeat(2, 1fr); }
  .profile-grid     { grid-template-columns: 1fr; }
  .admin-charts-row { grid-template-columns: 1fr; }
  .dash-main { padding: 28px 24px 48px; }
}

/* ─── DASH SIDEBAR MOBILE TOGGLE BUTTON ─────────────────────────── */
/* Hidden on desktop by default */
.dash-mobile-toggle {
  display: none;
}

/* ─── DASH SIDEBAR BACKDROP ─────────────────────────────────────── */
.dash-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 799;
  background: rgba(19,36,65,0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s, visibility 0s linear .3s;
}
.dash-sidebar-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s, visibility 0s linear 0s;
}

@media (max-width: 900px) {
  .dash-layout {
    grid-template-columns: 1fr;
  }

  /* Sidebar — slide in from left */
  .dash-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 800;
    box-shadow: 4px 0 32px rgba(19,36,65,.25);
    overflow-y: auto;
    height: auto;
    /* Hidden state */
    transform: translateX(-100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .3s ease, visibility 0s linear .3s;
  }
  .dash-sidebar.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform .3s ease, visibility 0s linear 0s;
  }

  .dash-sidebar-backdrop { display: block; }

  /* Toggle button — visible on mobile */
  .dash-mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 16px;
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    color: var(--midnight);
    cursor: pointer;
    margin-bottom: 20px;
    transition: border-color .15s, background .15s;
  }
  .dash-mobile-toggle:hover {
    border-color: var(--midnight);
    background: var(--border-soft);
  }

  /* Chat layout fix */
  .chat-layout { grid-template-columns: 1fr; height: auto; min-height: calc(100vh - var(--header-h)); }
  .chat-list   { display: flex; border-right: none; border-bottom: 1px solid var(--border); max-height: 340px; }
  .chat-window { min-height: 500px; }

  /* Chat toggle wrap padding */
  .dash-mobile-toggle-wrap {
    padding: 16px 16px 0;
  }
}

@media (max-width: 768px) {
  .dash-main        { padding: 20px 16px 40px; }
  .admin-stats-row  { grid-template-columns: 1fr 1fr; }
  .profile-stats    { grid-template-columns: repeat(2, 1fr); }
  .profile-top__body { flex-direction: column; align-items: flex-start; }
  .profile-top__actions { margin-left: 0; }
  .form-row-2 { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .admin-stats-row { grid-template-columns: 1fr; }
  .profile-stats   { grid-template-columns: 1fr 1fr; }
  .portfolio-grid  { grid-template-columns: repeat(2, 1fr); }
  .grid-toolbar    { flex-direction: column; align-items: flex-start; }
  .grid-search-wrap .form-input { width: 100%; }
  .data-grid th,
  .data-grid td { padding: 10px 12px; font-size: .8rem; }
}

/* ─── MODAL ─────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .modal__box {
    margin: 0;
    max-width: 100%;
    max-height: 100dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    align-self: flex-end;
    padding: 20px 16px 32px;
  }
  .modal { align-items: flex-end; }
}

/* ─── CARDS / BUTTONS — GLOBAL MOBILE ───────────────────────────── */
@media (max-width: 560px) {
  .btn-lg { height: 48px; padding: 0 28px; font-size: .95rem; }
  .card   { border-radius: var(--radius); }
}

@media (max-width: 400px) {
  .btn    { height: 40px; padding: 0 18px; font-size: .85rem; }
  .btn-sm { height: 32px; padding: 0 12px; font-size: .78rem; }
}

/* ─── PAGINATION ────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .pagination-wrap {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }
  .pagination { flex-wrap: wrap; justify-content: center; }
}

/* ─── OVERFLOW GUARD ────────────────────────────────────────────── */
@media (max-width: 768px) {
  body { overflow-x: hidden; }
}
