/* ============================================
   MOBILE OPTIMIZATION
   ============================================ */

/* --- БАЗОВЫЕ ФИКСЫ (все мобильные) --- */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
  }

  * { box-sizing: border-box; }

  body {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    line-height: 1.5;
  }

  input, textarea, select {
    font-size: 16px !important;
  }

  img, video, iframe {
    max-width: 100% !important;
  }

  .container {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* --- HERO СЕКЦИЯ (index.html) --- */
@media (max-width: 768px) {
  .hero {
    min-height: 100svh !important;
  }

  .hero-video {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  .parallax-bg {
    position: absolute !important;
    inset: 0 !important;
  }

  .hero-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    padding: 16px 20px !important;
  }
  .hero-bar-brand { font-size: 24px !important; }
  .hero-bar-divider { display: none !important; }
  .hero-bar-label { font-size: 12px !important; }
  .hero-chip { font-size: 10px !important; padding: 4px 8px !important; }
  .btn-hero-cta { width: 100% !important; justify-content: center !important; margin-left: 0 !important; }

  .blob, .decor, .hero-overlay, .hero-glass-top, .hero-top-line {
    display: none !important;
  }

  /* Скрыть статистику и адрес */
  .stats-section {
    display: none !important;
  }
}

/* --- НАВИГАЦИЯ --- */
@media (max-width: 768px) {
  .topnav {
    padding: 0.5rem 1rem !important;
  }

  .auth-logo-img {
    height: 36px !important;
  }

  .sm-logo-img {
    max-height: 28px !important;
    width: auto !important;
  }

  .btn-small {
    font-size: 0.75rem !important;
    padding: 0.5rem 0.75rem !important;
  }

  .staggered-menu-panel {
    width: 100vw !important;
  }

  /* Убираем нумерацию 01, 02, 03 чтобы не налезала на текст */
  .sm-panel-list[data-numbering] .sm-panel-item::after {
    display: none !important;
  }

  .sm-panel-item {
    font-size: clamp(1.1rem, 6vw, 1.5rem) !important;
    padding: 0.75rem 0 !important;
  }

  .sm-panel-list {
    padding: 1rem 1.5rem !important;
  }
}

/* --- СЕКЦИИ КОНТЕНТА (index.html) --- */
@media (max-width: 768px) {
  html {
    scroll-behavior: smooth;
  }

  .section {
    padding: 2.5rem 0 !important;
  }

  .section-title {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    margin-bottom: 1.5rem !important;
  }

  /* Как это работает */
  .how-steps {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .how-step {
    padding: 1.25rem !important;
  }

  .how-step h3 { font-size: 1rem !important; }
  .how-step p { font-size: 0.85rem !important; }

  /* О компании */
  .about-facts {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .about-fact {
    padding: 0.75rem !important;
  }

  .about-fact-number {
    font-size: 1.25rem !important;
  }

  .about-content p {
    font-size: 0.9rem !important;
  }

  /* Forbes */
  .press-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .press-combo {
    min-height: 200px !important;
  }

  .press-front {
    width: 100% !important;
    height: auto !important;
  }

  .press-side {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
  }

  .press-logo {
    height: 60px !important;
  }

  /* Партнеры */
  .partner-contact {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  .partner-cta-only {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 1.25rem !important;
  }

  .btn-partner-cta {
    padding: 0.875rem 1.5rem !important;
    font-size: 0.9rem !important;
    width: fit-content !important;
  }

  .partner-photo {
    width: 160px !important;
    height: 160px !important;
    border-radius: 50% !important;
  }

  .partner-card {
    font-size: 0.9rem !important;
    padding: 0.75rem 1rem !important;
  }

  .partner-note {
    font-size: 0.8rem !important;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .footer-col h3 { font-size: 1rem !important; }
  .footer-col p, .footer-col li { font-size: 0.85rem !important; }
  .copyright { font-size: 0.8rem !important; }

  .big-number, .mega-number { font-size: 2rem !important; }
  .muted { font-size: 0.85rem !important; }
}

/* --- ФОРМЫ АВТОРИЗАЦИИ --- */
@media (max-width: 600px) {
  .auth-page {
    padding: 1rem !important;
  }

  .auth-container {
    padding: 0 !important;
  }

  .auth-card {
    padding: 1.25rem !important;
    margin: 0 !important;
    border-radius: 12px !important;
  }

  .auth-title {
    font-size: 1.25rem !important;
  }

  .auth-subtitle {
    font-size: 0.85rem !important;
  }

  .auth-logo img {
    height: 40px !important;
  }

  .stepper-btn {
    min-height: 48px !important;
    font-size: 0.9rem !important;
  }
}

/* --- ПРОФИЛЬ / ЛИЧНЫЙ КАБИНЕТ --- */
@media (max-width: 768px) {
  .profile-page {
    padding: 0.75rem !important;
  }

  .profile-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .profile-card {
    position: static !important;
    padding: 1rem !important;
  }

  .page-title {
    font-size: 1.5rem !important;
  }

  .avatar-circle {
    width: 80px !important;
    height: 80px !important;
    font-size: 1.75rem !important;
  }

  .tab-btn {
    font-size: 0.85rem !important;
    padding: 0.6rem 1rem !important;
  }

  .info-item label {
    font-size: 0.75rem !important;
  }

  .info-item span {
    font-size: 0.9rem !important;
  }
}

/* --- ТАБЛИЦА КЛИЕНТОВ (карточки на мобильных) --- */
@media (max-width: 768px) {
  .clients-table-wrapper {
    overflow-x: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .clients-table {
    min-width: unset !important;
    width: 100% !important;
  }

  .clients-table thead {
    display: none !important;
  }

  .clients-table tbody tr {
    display: block !important;
    margin-bottom: 0.5rem !important;
  }

  .client-card-mobile {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .client-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }

  .client-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
  }

  .client-card-info {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
  }

  .client-card-actions {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
  }

  .client-card-actions .btn-action {
    flex: 1;
    text-align: center;
    padding: 0.4rem 0.5rem !important;
    font-size: 0.75rem !important;
    min-height: 36px !important;
  }
}

/* --- МОДАЛЬНЫЕ ОКНА --- */
@media (max-width: 768px) {
  .modal {
    padding: 0.5rem !important;
    align-items: flex-start !important;
    overflow-y: auto !important;
  }

  .modal-content,
  .modal-content-large,
  .modal-shell {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0.5rem 0 !important;
    padding: 1rem !important;
    border-radius: 12px !important;
    overflow-y: visible !important;
  }

  .modal-header {
    padding: 0.75rem 0 !important;
    gap: 0.5rem !important;
  }

  .modal-title {
    font-size: 1.1rem !important;
  }

  .modal-body {
    padding: 0 !important;
  }

  .modal-close {
    width: 36px !important;
    height: 36px !important;
    flex-shrink: 0 !important;
  }

  .modal-footer {
    flex-direction: column !important;
    gap: 0.5rem !important;
    padding-top: 0.75rem !important;
  }

  .modal-footer button {
    width: 100% !important;
  }

  /* Форма клиента -- всё в одну колонку */
  .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    grid-template-columns: 1fr !important;
    margin-bottom: 0 !important;
  }

  .form-row .form-group {
    width: 100% !important;
  }

  .form-group {
    margin-bottom: 1rem !important;
  }

  .form-label {
    font-size: 0.85rem !important;
    margin-bottom: 0.35rem !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .form-input,
  .form-input[type="text"],
  .form-input[type="email"],
  .form-input[type="tel"],
  .form-input[type="number"],
  select.form-input,
  textarea.form-input {
    font-size: 16px !important;
    padding: 0.65rem 0.75rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .checkbox-label-inline {
    font-size: 0.8rem !important;
    line-height: 1.4 !important;
  }

  /* Кнопка отправки формы */
  .profile-form .stepper-btn,
  .profile-form button[type="submit"] {
    width: 100% !important;
    padding: 0.75rem !important;
    font-size: 0.9rem !important;
  }

  /* Просмотр клиента */
  .client-details-grid {
    grid-template-columns: 1fr !important;
  }

  .info-row {
    flex-direction: column !important;
    gap: 0.25rem !important;
    padding: 0.5rem 0 !important;
  }

  .info-label {
    font-size: 0.75rem !important;
  }

  .info-value {
    font-size: 0.9rem !important;
    word-break: break-word !important;
  }
}

/* --- АДМИНКА --- */
@media (max-width: 1024px) {
  .sidebar {
    width: 60px !important;
    min-width: 60px !important;
  }

  .sidebar .nav-text,
  .sidebar-header p {
    display: none !important;
  }

  .sidebar-header h1 {
    font-size: 0.75rem !important;
  }

  .main-content {
    margin-left: 60px !important;
    padding: 1rem !important;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    gap: 0.75rem !important;
  }

  .stat-card {
    padding: 0.75rem !important;
  }

  .stat-value {
    font-size: 1.25rem !important;
  }

  .stat-label {
    font-size: 0.7rem !important;
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    height: 56px !important;
    flex-direction: row !important;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-right: none !important;
  }

  .sidebar-header,
  .sidebar-footer {
    display: none !important;
  }

  .sidebar-nav {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
    justify-content: space-around !important;
    padding: 0 !important;
  }

  .sidebar .nav-link {
    flex-direction: column !important;
    gap: 0.15rem !important;
    padding: 0.5rem !important;
    font-size: 0.65rem !important;
  }

  .sidebar .nav-text {
    display: block !important;
    font-size: 0.6rem !important;
  }

  .sidebar .nav-icon svg {
    width: 20px !important;
    height: 20px !important;
  }

  .main-content {
    margin-left: 0 !important;
    margin-bottom: 56px !important;
    padding: 0.75rem !important;
  }

  .main-header h2 {
    font-size: 1.25rem !important;
  }

  .filters-bar {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .search-input, .filter-select {
    width: 100% !important;
  }

  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    font-size: 0.7rem !important;
    min-width: 600px;
  }

  .data-table th,
  .data-table td {
    padding: 0.5rem 0.35rem !important;
    white-space: nowrap !important;
  }
}

/* --- TOUCH TARGETS --- */
@media (max-width: 768px) {
  button, .btn, a.nav-link {
    min-height: 44px;
  }

  button:hover, a:hover {
    transform: none !important;
  }

  button:active {
    opacity: 0.85;
  }
}

/* --- LANDSCAPE --- */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { min-height: 100svh !important; }
  .hero-layout { padding-bottom: 1rem !important; }
  .display-brand { font-size: clamp(24px, 6vw, 40px) !important; }
}

/* --- МАЛЕНЬКИЕ ЭКРАНЫ (375px) --- */
@media (max-width: 375px) {
  body { font-size: 14px; }
  .display-brand { font-size: clamp(28px, 9vw, 48px) !important; }
  .hero-title { font-size: 0.9rem !important; }
  .section-title { font-size: 1.25rem !important; }
  .big-number, .mega-number { font-size: 1.75rem !important; }
  .btn-partner-cta { font-size: 0.8rem !important; padding: 0.75rem 1.25rem !important; }
  .stat-value { font-size: 1rem !important; }
}
