/* ==========================================================================
   CASTORINNI OS — MOBILE & RESPONSIVE STYLES
   iOS Bottom TabBar, Action Sheets, Touch Stepper & Responsive Grid
   ========================================================================== */

/* --- iOS MOBILE BOTTOM TABBAR --- */
.ios-mobile-tabbar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 64px;
  background: rgba(10, 14, 12, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
  z-index: 150;
  padding: 0 0.5rem 8px 0.5rem;
  justify-content: space-around;
  align-items: center;
}

.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  flex: 1;
  position: relative;
}

.tabbar-icon {
  font-size: 1.25rem;
  transition: var(--transition-fast);
}

.tabbar-item.active {
  color: var(--gold-light);
  font-weight: 600;
}

.tabbar-item.active .tabbar-icon {
  transform: translateY(-1px);
}

.tabbar-badge {
  position: absolute;
  top: 2px;
  right: 22%;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tablet & Mobile Breakpoint (Max 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 0px;
  }

  .admin-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.8);
  }

  .admin-sidebar.mobile-open {
    transform: translateX(0);
  }

  .admin-main-wrap {
    margin-left: 0;
    width: 100vw;
    max-width: 100vw;
  }

  .admin-topbar {
    height: 60px;
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .global-search-box {
    max-width: 220px;
  }

  .search-shortcut-tag {
    display: none;
  }

  .sidebar-toggle-mobile {
    display: flex !important;
  }

  .dashboard-charts-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem;
  }
}

/* Mobile Screen (Max 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: 70px; /* Espaço para o iOS TabBar */
    overflow-x: hidden;
  }

  /* --- TOPBAR MOBILE PREMIUM: ESPAÇOSA, FLUIDA E SEM COMPRESSÃO --- */
  .admin-topbar {
    height: 56px;
    padding: 0 0.75rem;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 99;
    box-sizing: border-box;
    width: 100vw;
    max-width: 100vw;
    justify-content: space-between;
  }

  .topbar-left {
    gap: 0.5rem;
    flex: 0 0 auto;
    max-width: none;
    align-items: center;
  }

  .sidebar-toggle-mobile {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 8px;
    padding: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-pure);
    flex-shrink: 0;
  }

  .topbar-mobile-brand {
    display: flex;
    align-items: center;
  }

  .topbar-brand-name {
    font-family: var(--font-cinzel);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--gold-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }

  /* Remove o input largo da linha superior no celular para não comprimir os botões de ação */
  .global-search-box {
    display: none !important;
  }

  .topbar-right {
    gap: 0.4rem;
    justify-content: flex-end;
    align-items: center;
    flex: 1;
    flex-shrink: 0;
  }

  .topbar-mode-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    height: 34px;
    min-height: 34px;
    border-radius: 8px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
  }

  .mode-text-label {
    font-size: 0.72rem;
    font-weight: 700;
  }

  .store-status-toggle {
    padding: 0.32rem 0.6rem;
    font-size: 0.72rem;
    height: 32px;
    min-height: 32px;
    gap: 0.35rem;
    flex-shrink: 0;
    border-radius: 50px;
  }

  .status-text-full {
    display: none !important;
  }

  .status-text-compact {
    display: inline !important;
    font-weight: 700;
    font-size: 0.72rem;
  }

  .topbar-theme-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 8px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-subtle);
    flex-shrink: 0;
  }

  .topbar-new-item-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
  }

  .btn-new-item-text {
    display: none !important;
  }

  .ios-mobile-tabbar {
    display: flex;
  }

  .admin-content-viewport {
    padding: 1rem 0.75rem;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
  }

  .view-title-group h2 {
    font-size: 1.4rem;
  }

  .view-actions-bar {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* --- GRID MOBILE 2 COLUNAS INTELIGENTE (360px a 768px) --- */
  .kpi-grid,
  .kpi-grid.dashboard-mobile-2col {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
    margin-bottom: 1.25rem;
  }

  .kpi-card {
    padding: 0.85rem 0.75rem !important;
    min-height: 125px !important;
    border-radius: 10px !important;
  }

  .kpi-value {
    font-size: 1.25rem !important;
    margin-bottom: 0.2rem;
  }

  .kpi-label {
    font-size: 0.65rem !important;
  }

  .kpi-icon-badge {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.85rem !important;
  }

  .kpi-trend {
    font-size: 0.68rem !important;
  }

  /* Operação e Delivery em 2x2 no Celular */
  .operation-compact-grid,
  .delivery-summary-strip {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
  }

  .products-featured-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
  }

  .product-featured-card {
    padding: 0.75rem !important;
    border-radius: 10px !important;
  }

  .featured-product-body h4 {
    font-size: 0.82rem !important;
    margin-bottom: 0.45rem !important;
  }

  .dashboard-chart-box {
    height: 220px !important;
  }

  /* Gráficos e Seções Complexas no Mobile: 1 Coluna */
  .dashboard-charts-grid {
    grid-template-columns: 1fr !important;
    gap: 1.15rem;
    margin-bottom: 1.35rem;
    width: 100%;
  }

  .admin-grid-2col {
    grid-template-columns: 1fr !important;
    gap: 0.85rem;
  }

  .ios-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .global-search-box {
    max-width: 100%;
  }

  /* Sheet Bottom Dialog no Celular */
  .ios-modal-dialog {
    max-width: 100%;
    margin-top: auto;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 85vh;
  }

  .ios-segmented-control,
  .ios-segment-control,
  .filter-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 3px;
    scrollbar-width: none;
  }

  .ios-segmented-control::-webkit-scrollbar,
  .filter-tabs::-webkit-scrollbar {
    display: none;
  }

  .ios-segment-btn,
  .filter-tab-btn {
    white-space: nowrap;
    padding: 0.42rem 0.85rem;
    font-size: 0.76rem;
    flex-shrink: 0;
  }

  .btn-action-icon,
  .btn-table-action {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .admin-topbar {
    padding: 0 0.5rem;
    gap: 0.3rem;
  }

  .topbar-right {
    gap: 0.3rem;
  }

  .topbar-brand-name {
    font-size: 0.78rem;
  }

  .topbar-mode-btn {
    padding: 0.32rem 0.45rem;
    font-size: 0.7rem;
  }

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

@media (max-width: 380px) {
  .topbar-brand-name {
    display: none;
  }

  .topbar-mode-btn .mode-text-label {
    display: none;
  }

  .topbar-mode-btn {
    width: 34px;
    min-width: 34px;
    padding: 0;
    justify-content: center;
  }

  .kpi-card {
    padding: 0.7rem 0.55rem !important;
    min-height: 115px !important;
  }

  .kpi-value {
    font-size: 1.1rem !important;
  }
}

