/* 
 * RentalXControl - Responsive Design System
 * Estilos compartilhados para todas as páginas
 */

/* ========================================
   BREAKPOINTS E VARIÁVEIS
   ======================================== */
:root {
  /* Breakpoints */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
  --breakpoint-desktop: 1440px;
  
  /* Scrollbar Estilosa */
  --scrollbar-width: 8px;
  --scrollbar-track: rgba(0, 0, 0, 0.05);
  --scrollbar-thumb: rgba(99, 102, 241, 0.3);
  --scrollbar-thumb-hover: rgba(99, 102, 241, 0.5);
  
  /* Z-index hierarchy */
  --z-bottom-nav: 1000;
  --z-sidebar: 900;
  --z-hamburger: 950;
  --z-modal: 1100;
  --z-toast: 1200;
}

/* ========================================
   SCROLLBAR GLOBAL ESTILOSA E DISCRETA
   ======================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: var(--scrollbar-width);
  height: var(--scrollbar-width);
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 10px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 10px;
  transition: background 0.3s ease;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Scrollbar em elementos escuros */
.dark-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.dark-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

.dark-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ========================================
   MENU HAMBURGER GLOBAL
   ======================================== */
.hamburger-btn {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.hamburger-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.hamburger-btn span {
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.hamburger-btn.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Overlay quando sidebar aberta em mobile/tablet */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 850;
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ========================================
   BOTTOM NAVIGATION (MOBILE PWA)
   ======================================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: var(--z-bottom-nav);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav-items {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  min-width: 64px;
  color: #64748b;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-radius: 8px;
}

.bottom-nav-item:active {
  transform: scale(0.95);
}

.bottom-nav-item.active {
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
}

.bottom-nav-icon {
  font-size: 24px;
  line-height: 1;
}

/* Tema escuro para bottom nav */
.bottom-nav.dark {
  background: #1e293b;
  border-top-color: rgba(255, 255, 255, 0.1);
}

.bottom-nav.dark .bottom-nav-item {
  color: #94a3b8;
}

.bottom-nav.dark .bottom-nav-item.active {
  color: #818cf8;
  background: rgba(129, 140, 248, 0.1);
}

/* ========================================
   RESPONSIVE UTILITIES
   ======================================== */
.hide-mobile { display: block; }
.show-mobile { display: none; }

/* ========================================
   MEDIA QUERIES
   ======================================== */

/* TABLET (768px - 1024px): Sidebar vira hamburger */
@media (max-width: 1024px) {
  .hamburger-btn {
    display: flex;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.active {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0 !important;
  }
}

/* MOBILE (<768px): PWA com bottom navigation */
@media (max-width: 767px) {
  .bottom-nav {
    display: block;
  }
  
  .hide-mobile {
    display: none !important;
  }
  
  .show-mobile {
    display: block !important;
  }
  
  /* Adicionar padding no body para bottom nav */
  body {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
  }
  
  /* Cards responsivos */
  .stats-grid,
  .grid,
  .products-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Tabelas com scroll horizontal */
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
  
  /* Forms full-width */
  input,
  select,
  textarea,
  button {
    font-size: 16px !important; /* Previne zoom no iOS */
  }
  
  /* Padding reduzido */
  .container,
  .main-content {
    padding: 16px !important;
  }
  
  /* Header compacto */
  header,
  .header {
    padding: 12px 16px !important;
  }
  
  /* Logo menor */
  .logo img,
  .header-logo,
  .brand-logo img {
    max-height: 40px !important;
  }
}

/* DESKTOP LARGE (>1440px): Otimizações */
@media (min-width: 1441px) {
  .container {
    max-width: 1400px;
  }
  
  .main-content {
    max-width: calc(100% - 260px);
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  .sidebar,
  .bottom-nav,
  .hamburger-btn,
  .sidebar-overlay,
  header .header-actions,
  .floating-cart {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
  }
}
