/* Global Responsive Styles for SHADOW - Mobile, Tablet, Desktop */

:root {
  --container: 1200px;
}

/* Base responsive adjustments */
html, body { 
  height: 100%; 
  width: 100%;
  overflow-x: hidden;
}

img, video { 
  max-width: 100%; 
  height: auto; 
}

.container { 
  width: 100%; 
  max-width: var(--container); 
  margin: 0 auto; 
  padding: 24px; 
}

/* Grid helpers */
.grid { 
  display: grid; 
  gap: 12px; 
}

.grid-auto { 
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); 
}

/* Typography responsive scale */
h1 { font-size: clamp(24px, 5vw, 36px); }
h2 { font-size: clamp(20px, 4vw, 28px); }
h3 { font-size: clamp(18px, 3.5vw, 22px); }
h4 { font-size: clamp(16px, 3vw, 20px); }

/* Buttons */
.btn { 
  padding: 10px 16px; 
  border-radius: 10px; 
  font-size: 14px;
  white-space: nowrap;
}

/* Tables */
table { 
  width: 100%;
  border-collapse: collapse;
}

/* ============================================
   BREAKPOINTS
   ============================================ */

/* Mobile (320px - 576px) */
@media (max-width: 576px) {
  :root { 
    --container: 100%; 
  }
  
  .container { 
    padding: 12px; 
  }
  
  h1 { font-size: 22px; }
  h2 { font-size: 20px; }
  h3 { font-size: 18px; }
  h4 { font-size: 16px; }
  
  .btn { 
    padding: 8px 12px; 
    font-size: 13px;
  }
  
  /* Tables become cards on mobile */
  table, thead, tbody, th, td, tr { 
    display: block; 
  }
  
  thead tr { 
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  tr { 
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--glass);
  }
  
  td { 
    border: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: relative;
    padding: 8px 8px 8px 50%;
    text-align: left;
  }
  
  td:before { 
    content: attr(data-label);
    position: absolute;
    left: 8px;
    width: 45%;
    white-space: nowrap;
    font-weight: 600;
    color: var(--muted);
  }
  
  td:last-child {
    border-bottom: none;
  }
  
  /* Grids */
  .grid { 
    grid-template-columns: 1fr !important; 
    gap: 16px;
  }
  
  /* Flex containers */
  .flex-row {
    flex-direction: column;
  }
  
  /* Header adjustments */
  header {
    padding: 12px 16px;
  }
  
  /* Cards */
  .card {
    padding: 16px;
  }
  
  /* Forms */
  .form-group {
    margin-bottom: 16px;
  }
  
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  textarea,
  select {
    width: 100%;
    padding: 12px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* Tablet (577px - 768px) */
@media (min-width: 577px) and (max-width: 768px) {
  :root { 
    --container: 100%; 
  }
  
  .container { 
    padding: 16px 20px; 
  }
  
  /* Grids - 2 columns */
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Header */
  header {
    padding: 16px 20px;
  }
  
  /* Tables */
  table {
    font-size: 13px;
  }
  
  th, td {
    padding: 10px 8px;
  }
}

/* Tablet Landscape / Small Laptop (769px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
  :root { 
    --container: 960px; 
  }
  
  .container { 
    padding: 20px 24px; 
  }
  
  /* Grids */
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Laptop (993px - 1200px) */
@media (min-width: 993px) and (max-width: 1200px) {
  :root { 
    --container: 1140px; 
  }
  
  .container { 
    padding: 24px; 
  }
}

/* Desktop (1201px - 1366px) */
@media (min-width: 1201px) and (max-width: 1366px) {
  :root { 
    --container: 1200px; 
  }
}

/* Desktop Large (1367px+) */
@media (min-width: 1367px) {
  :root { 
    --container: 1320px; 
  }
}

/* ============================================
   SPECIFIC COMPONENTS
   ============================================ */

/* Navigation */
@media (max-width: 768px) {
  nav {
    flex-wrap: wrap;
    gap: 8px;
  }
  
  nav a {
    font-size: 14px;
    padding: 8px 12px;
  }
}

/* Hero sections */
@media (max-width: 992px) {
  .hero {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }
  
  .hero-side {
    order: -1;
  }
}

/* Product grids */
@media (max-width: 576px) {
  .products-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (min-width: 577px) and (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

@media (min-width: 769px) and (max-width: 992px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

@media (min-width: 993px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
}

/* Modals */
@media (max-width: 576px) {
  .modal-content {
    width: 95% !important;
    padding: 20px !important;
    margin: 20px 10px;
    max-height: 90vh;
  }
}

/* Footer */
@media (max-width: 768px) {
  footer {
    padding: 32px 16px 20px !important;
  }
  
  footer .container > div {
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    text-align: center;
  }
  
  footer .footer-col {
    text-align: center;
  }
  
  footer nav {
    align-items: center;
  }
}

/* Forms */
@media (max-width: 576px) {
  .form-row {
    flex-direction: column;
    gap: 12px;
  }
  
  .form-row > * {
    width: 100%;
  }
}

/* Admin tables */
@media (max-width: 768px) {
  .admin-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .admin-table table {
    min-width: 600px;
  }
}

/* Buttons group */
@media (max-width: 576px) {
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
    margin-bottom: 8px;
  }
}

/* Cards */
@media (max-width: 576px) {
  .card {
    margin-bottom: 16px;
  }
}

/* Images */
@media (max-width: 576px) {
  img {
    border-radius: 8px;
  }
}

/* Spacing adjustments */
@media (max-width: 576px) {
  .section {
    padding: 24px 0;
  }
  
  .section-head {
    margin-bottom: 20px;
  }
}

/* Text alignment */
@media (max-width: 576px) {
  .text-center-mobile {
    text-align: center;
  }
}

/* Utility classes */
.hide-mobile {
  display: block;
}

.show-mobile {
  display: none;
}

@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
  
  .show-mobile {
    display: block;
  }
}

/* Safe area for mobile devices */
@supports (padding: max(0px)) {
  @media (max-width: 576px) {
    body {
      padding-left: max(12px, env(safe-area-inset-left));
      padding-right: max(12px, env(safe-area-inset-right));
    }
  }
}
