/* ============================================================
   RESPONSIVE CSS — LIRIOS PRATAS
   Abordagem: Desktop-first com breakpoints descendentes.
   Breakpoints: 1280px | 1024px | 768px | 480px
   ============================================================ */

/* ─── UTILITIES DE CONTROLE ─────────────────────────────── */
.hide-mobile  { display: block; }
.show-mobile  { display: none !important; }
.hide-tablet  { display: block; }
.show-tablet  { display: none !important; }

/* ─── 1280px — DESKTOP GRANDE ───────────────────────────── */
@media (max-width: 1280px) {
  .container {
    max-width: 1060px;
  }

  .products-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .categories-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .site-footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
    gap: 2rem;
  }
}

/* ─── 1024px — DESKTOP PEQUENO / TABLET LANDSCAPE ───────── */
@media (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 20px;
  }

  /* ── Header ── */
  .header {
    padding: 0.75rem 0;
  }

  .header-inner {
    grid-template-columns: auto auto 1fr auto auto;
    gap: 0.75rem;
  }

  /* Menu principal: escondido, hamburguer aparece */
  .header-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    height: 100dvh;
    background: var(--color-bg-card);
    border-right: 1.5px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 5rem 1.5rem 2rem;
    z-index: 300;
    box-shadow: 4px 0 24px rgba(106, 13, 40, 0.12);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .header-menu.is-open {
    display: flex;
    animation: slideInLeft 0.28s ease;
  }

  .header-menu a {
    font-size: 1.05rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--color-border-light);
    width: 100%;
    letter-spacing: 0.04em;
  }

  .header-menu a:last-child {
    border-bottom: none;
  }

  .header-hamburger {
    display: flex;
    order: -1;
  }

  /* Overlay para fechar o drawer */
  .nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(77, 10, 30, 0.35);
    z-index: 290;
    backdrop-filter: blur(2px);
  }

  .nav-overlay.is-open {
    display: block;
    animation: fadeIn 0.22s ease;
  }

  /* ── Produtos ── */
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  /* ── Categorias ── */
  .categories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  /* ── Seções de 3 colunas → 2 ── */
  .institutional-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .buying-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  /* ── Footer ── */
  .site-footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2rem 1.5rem;
  }

  /* ── Página do produto: empilha ── */
  .store-layout-row {
    flex-direction: column;
  }

  .product-gallery-column,
  .product-detail-column {
    min-width: 0;
    width: 100%;
  }

  /* ── Carrinho: resumo abaixo ── */
  .store-layout-main.min-320 {
    min-width: 0;
    width: 100%;
  }

  .store-summary-card {
    width: 100%;
    min-width: 0;
  }

  /* ── Filtros: esconde sidebar, mostra botão ── */
  .store-filter-sidebar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: min(300px, 90vw);
    height: 100dvh;
    background: var(--color-bg-card);
    border-right: 1.5px solid var(--color-border);
    z-index: 300;
    padding: 4.5rem 1.2rem 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 4px 0 24px rgba(106, 13, 40, 0.12);
  }

  .store-filter-sidebar.is-open {
    display: block;
    animation: slideInLeft 0.28s ease;
  }

  .btn-toggle-filters {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--color-cream);
    color: var(--color-wine);
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
  }

  .btn-toggle-filters:hover {
    background: var(--color-pink-light);
    border-color: var(--color-pink-dark);
  }

  /* ── Admin sidebar: colapsável ── */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    height: 100dvh;
    z-index: 310;
    transition: left 0.3s ease;
    box-shadow: none;
  }

  .admin-sidebar.is-open {
    left: 0;
    box-shadow: 4px 0 28px rgba(77, 10, 30, 0.22);
  }

  .admin-content-wrap {
    margin-left: 0;
  }

  .admin-topbar-hamburger {
    display: flex;
  }

  /* ── Tabelas admin: scroll horizontal ── */
  .admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Stat cards: 2 colunas ── */
  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ─── 768px — TABLET ─────────────────────────────────────── */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  /* ── Utilitários de visibilidade ── */
  .hide-mobile  { display: none !important; }
  .show-mobile  { display: block !important; }

  /* ── Tipografia ── */
  .section {
    padding: 56px 0;
  }

  .section-header {
    margin-bottom: 36px;
  }

  /* ── Header ── */
  .header-search {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border-light);
    padding: 0.75rem 1rem;
    z-index: 200;
  }

  .header-search.is-open {
    display: block;
    animation: slideUp 0.22s ease;
  }

  .header-search input {
    max-width: 100%;
    width: 100%;
  }

  .btn-toggle-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-cream);
    border: 1.5px solid var(--color-border);
    color: var(--color-wine);
    font-size: 1rem;
    cursor: pointer;
  }

  /* ── Hero ── */
  .hero {
    min-height: 72vh;
    padding: 3.5rem 1rem 2.5rem;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 280px;
  }

  /* ── Produtos ── */
  .products-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
  }

  /* ── Categorias ── */
  .categories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  /* ── Seções institucionais ── */
  .institutional-grid {
    grid-template-columns: 1fr;
  }

  .buying-steps {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  /* ── Footer: 1 coluna ── */
  .site-footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .site-footer-bottom {
    text-align: center;
  }

  .footer-social {
    justify-content: center;
  }

  /* ── Carrinho: bottom sheet ── */
  .cart-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-bg-card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -6px 32px rgba(77, 10, 30, 0.18);
    z-index: 500;
    padding: 1.5rem 1rem 2rem;
    max-height: 80dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: slideUpSheet 0.32s ease;
  }

  .cart-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: 999px;
    margin: 0 auto 1.2rem;
  }

  /* ── Layout store: empilha tudo ── */
  .store-layout-row,
  .store-layout-row.wrap {
    flex-direction: column;
    gap: 1.2rem;
  }

  /* ── Paginação ── */
  .pagination-list {
    gap: 0.3rem;
  }

  /* ── Tabela de carrinho ── */
  .cart-table thead {
    display: none;
  }

  .cart-table tr {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--color-border-light);
  }

  .cart-table td {
    border-bottom: none;
    padding: 0;
  }

  /* ── Área do cliente ── */
  .customer-layout {
    flex-direction: column;
  }

  .customer-sidebar {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    position: static;
  }

  .customer-sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .customer-sidebar-nav a {
    border: 1.5px solid var(--color-border-light);
    border-radius: 999px;
    font-size: 0.82rem;
    padding: 0.4rem 0.85rem;
  }

  /* ── Breadcrumb ── */
  .breadcrumb-list {
    font-size: 0.78rem;
  }

  /* ── Admin: stat cards 1 coluna ── */
  .admin-stats-grid {
    grid-template-columns: 1fr;
  }

  /* ── Admin: forms 1 coluna ── */
  .admin-form-grid,
  .form-row {
    grid-template-columns: 1fr !important;
  }
}

/* ─── 480px — MOBILE ─────────────────────────────────────── */
@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  /* ── Seções ── */
  .section {
    padding: 40px 0;
  }

  .section-header {
    margin-bottom: 28px;
  }

  /* ── Logo ── */
  .brand-logo-main {
    font-size: 1.05rem;
  }

  .brand-logo-script {
    font-size: 1.3rem;
  }

  /* ── Hero ── */
  .hero {
    min-height: 60vh;
    padding: 2.5rem 0.85rem 2rem;
  }

  .hero-title {
    font-size: clamp(1.6rem, 6vw, 2.2rem);
  }

  .hero-eyebrow {
    font-size: 1.4rem;
  }

  .hero-badge {
    font-size: 0.72rem;
    padding: 0.35rem 0.9rem;
  }

  /* ── Produtos: 1 coluna ── */
  .products-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* ── Categorias: 3 pequenas (ícone + nome) ── */
  .categories-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .category-card {
    padding: 0.75rem 0.4rem 0.6rem;
    gap: 0.35rem;
  }

  .category-icon-wrap {
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .category-name {
    font-size: 0.72rem;
  }

  /* ── Botões full width em ações principais ── */
  .hero-cta .btn,
  .auth-container .btn,
  .store-summary-card .btn {
    width: 100%;
  }

  /* ── Tabs do produto: scroll horizontal ── */
  .product-tab-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    display: flex;
    gap: 0;
    padding-bottom: 0;
    margin-bottom: 1rem;
  }

  .product-tab-list::-webkit-scrollbar {
    display: none;
  }

  .product-tab-list li {
    flex-shrink: 0;
  }

  .tab-link {
    font-size: 0.85rem;
    padding: 0.55rem 1rem;
    white-space: nowrap;
  }

  /* ── Botões de tamanho ── */
  .size-option {
    min-width: 36px;
    height: 36px;
    font-size: 0.85rem;
  }

  /* ── Auth container ── */
  .auth-container {
    padding: 1.8rem 1rem;
    border-radius: var(--radius-lg);
  }

  /* ── Paginação: compacta ── */
  .pagination-list a,
  .pagination-list span {
    min-width: 32px;
    height: 32px;
    font-size: 0.82rem;
    padding: 0 0.5rem;
  }

  /* ── Stat cards admin ── */
  .stat-card {
    padding: 1rem 0.75rem;
  }

  /* ── Tabelas: scroll horizontal sempre ── */
  .table-full,
  .cart-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* ── Toast: largura total ── */
  .toast {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 1rem;
    max-width: 100%;
  }
}

/* ─── ANIMAÇÕES DE DRAWER/SHEET ─────────────────────────── */
@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideUpSheet {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

/* ─── ADMIN RESPONSIVO ──────────────────────────────────── */

/* Botão hamburguer do admin (oculto no desktop) */
.admin-topbar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.admin-topbar-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-wine);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Overlay para sidebar admin no mobile */
.admin-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(77, 10, 30, 0.4);
  z-index: 300;
  backdrop-filter: blur(2px);
}

.admin-sidebar-overlay.is-open {
  display: block;
  animation: fadeIn 0.22s ease;
}

/* Wrapper de tabela com scroll */
.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-md);
}

/* Grid de métricas: responsivo */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 1280px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .admin-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-sidebar {
    width: min(260px, 88vw);
  }
}
