/* ============================================================
   Seos Technology — Responsive CSS
   Breakpoints:
     Mobile:  320px – 767px
     Tablet:  768px – 1024px
     Desktop: 1025px+
     Wide:    1920px+
   ============================================================ */

/* ---- Mobile-first base (320px+) ---- */

/* Navigation */
.navbar { padding: 0 1rem; }
.nav-links { display: none; }
.nav-mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--navy);
  font-size: 1.5rem;
}

/* Mobile nav drawer */
.nav-drawer {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 1rem;
  z-index: 999;
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow-md);
}

.nav-drawer.open { display: flex; }
.nav-drawer .nav-link { padding: 0.75rem 1rem; border-radius: var(--radius-md); }
.nav-drawer .nav-actions { flex-direction: column; padding: 0.75rem 0 0; border-top: 1px solid var(--border); margin-top: 0.5rem; }
.nav-drawer .btn { width: 100%; justify-content: center; }

/* Hero */
.hero-content {
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding: 3rem 1rem;
  text-align: center;
}

.hero-subtitle { margin: 0 auto 2rem; }
.hero-actions { justify-content: center; }
.hero-visual { display: none; }

/* Grids */
.grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

/* Section */
.section { padding: 3rem 0; }
.section-lg { padding: 4rem 0; }

/* Cards */
.product-card-footer { flex-direction: column; }
.product-card-footer .btn { width: 100%; }

/* Tables */
.table thead { display: none; }
.table tbody tr {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  padding: 0.75rem;
}
.table tbody td {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.875rem;
}
.table tbody td:last-child { border-bottom: none; }
.table tbody td::before {
  content: attr(data-label);
  font-weight: 600;
  color: var(--navy);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Modal */
.modal { max-width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal-overlay { align-items: flex-end; padding: 0; }

/* Toast */
.toast-container { top: auto; bottom: 1rem; right: 1rem; left: 1rem; }
.toast { min-width: unset; max-width: 100%; }

/* Dashboard layout */
.dashboard-layout { flex-direction: column; }
.sidebar { width: 100%; height: auto; position: static; }
.sidebar-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.75rem; }
.sidebar-link { padding: 0.5rem 0.875rem; font-size: 0.875rem; }

/* Admin layout */
.admin-layout { flex-direction: column; }
.admin-sidebar { width: 100%; height: auto; position: static; }

/* Stat cards */
.stats-grid { grid-template-columns: repeat(2, 1fr); }

/* Filter bar */
.filter-bar { gap: 0.5rem; }
.filter-btn { font-size: 0.8125rem; padding: 0.375rem 0.75rem; }

/* Package cards */
.packages-grid { grid-template-columns: 1fr; }

/* Footer */
.footer-grid { grid-template-columns: 1fr; gap: 2rem; }
.footer-bottom { flex-direction: column; text-align: center; }

/* ---- Tablet (768px – 1024px) ---- */
@media (min-width: 768px) {
  /* Navigation */
  .nav-mobile-toggle { display: none; }
  .nav-links { display: flex; }
  .nav-drawer { display: none !important; }

  /* Hero */
  .hero-content {
    grid-template-columns: 1fr 1fr;
    text-align: left;
    padding: 4rem 1.5rem;
  }
  .hero-subtitle { margin: 0 0 2rem; }
  .hero-actions { justify-content: flex-start; }
  .hero-visual { display: flex; }

  /* Grids */
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  /* Tables — restore normal layout */
  .table thead { display: table-header-group; }
  .table tbody tr { display: table-row; border: none; margin: 0; padding: 0; }
  .table tbody td { display: table-cell; padding: 0.875rem 1.25rem; border-bottom: 1px solid var(--gray-200); }
  .table tbody td::before { display: none; }

  /* Modal */
  .modal { max-width: 560px; border-radius: var(--radius-xl); }
  .modal-overlay { align-items: center; padding: 1.5rem; }

  /* Toast */
  .toast-container { top: 1.5rem; bottom: auto; left: auto; right: 1.5rem; }
  .toast { min-width: 300px; }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* Packages */
  .packages-grid { grid-template-columns: repeat(2, 1fr); }

  /* Product cards */
  .product-card-footer { flex-direction: row; }
  .product-card-footer .btn { width: auto; }

  /* Footer */
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .footer-bottom { flex-direction: row; text-align: left; }

  /* Section */
  .section { padding: 4rem 0; }
  .section-lg { padding: 6rem 0; }
}

/* ---- Desktop (1025px+) ---- */
@media (min-width: 1025px) {
  /* Grids */
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }

  /* Dashboard layout */
  .dashboard-layout {
    flex-direction: row;
    min-height: calc(100vh - 70px);
  }

  .sidebar {
    width: 260px;
    flex-shrink: 0;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    overflow-y: auto;
  }

  .sidebar-nav {
    flex-direction: column;
    gap: 0.125rem;
    padding: 1.25rem 1rem;
  }

  .sidebar-link { padding: 0.625rem 1rem; font-size: 0.9375rem; }

  /* Admin layout */
  .admin-layout {
    flex-direction: row;
    min-height: calc(100vh - 70px);
  }

  .admin-sidebar {
    width: 260px;
    flex-shrink: 0;
    height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
    overflow-y: auto;
  }

  /* Stats */
  .stats-grid { grid-template-columns: repeat(4, 1fr); }

  /* Packages */
  .packages-grid { grid-template-columns: repeat(3, 1fr); }

  /* Section */
  .section { padding: 5rem 0; }
  .section-lg { padding: 7rem 0; }
}

/* ---- Wide (1920px+) ---- */
@media (min-width: 1920px) {
  .container { max-width: 1440px; }
  .hero-title { font-size: 4.5rem; }
  .section { padding: 6rem 0; }
}

/* ---- Print ---- */
@media print {
  .navbar, .sidebar, .admin-sidebar, .toast-container, .modal-overlay { display: none !important; }
  body { font-size: 12pt; color: #000; }
  a { color: #000; text-decoration: underline; }
  .card, .product-card { box-shadow: none; border: 1px solid #ccc; }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- High Contrast ---- */
@media (prefers-contrast: high) {
  :root {
    --border: rgba(0, 0, 0, 0.3);
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
  }
  .card, .product-card, .package-card { border-width: 2px; }
}
