/* ============================================================
   TARAVEE - Global Mobile Responsive Overrides
   File: public/css/responsive.css
   ============================================================ */

/* ---------- Base / Global ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
img, video, canvas, svg { max-width: 100%; height: auto; display: block; }
body { overflow-x: hidden; }

/* Container safety */
.container, .wrapper, .main-wrapper, .content-wrapper {
  width: 100%;
  max-width: 100%;
  padding-left: 16px;
  padding-right: 16px;
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Navigation ---------- */
@media (max-width: 992px) {
  header, .navbar, .site-header, .top-nav {
    flex-wrap: wrap !important;
    padding: 10px 16px !important;
  }
  .nav-links, .menu, .nav-menu {
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100%;
    justify-content: center;
  }
  .nav-links a, .menu a, .nav-menu a {
    font-size: 13px !important;
    padding: 6px 8px !important;
  }
  .btn-nav, .btn-visit-site {
    font-size: 12px !important;
    padding: 8px 14px !important;
  }
}

@media (max-width: 600px) {
  header, .navbar, .site-header, .top-nav {
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
  }
  .logo, .brand, .site-logo {
    font-size: 22px !important;
  }
  .nav-links, .menu, .nav-menu {
    gap: 6px !important;
  }
  .nav-links a, .menu a, .nav-menu a {
    font-size: 12px !important;
    padding: 4px 6px !important;
  }
  .btn-nav, .btn-visit-site, .btn-primary, .btn-outline {
    font-size: 12px !important;
    padding: 10px 16px !important;
    width: auto !important;
  }
  .btn-visit-site { width: 100% !important; text-align: center; }
}

/* ---------- Hero / Headings ---------- */
@media (max-width: 768px) {
  h1, .hero-title, .hero h1 { font-size: 34px !important; line-height: 1.15 !important; }
  h2 { font-size: 26px !important; }
  h3 { font-size: 20px !important; }
  .hero, .hero-section, .banner {
    padding: 40px 16px !important;
    text-align: center;
  }
  .hero p, .hero-subtitle { font-size: 15px !important; padding: 0 8px; }
  .hero-buttons, .cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }
  .hero-buttons a, .cta-buttons a { width: 90% !important; max-width: 320px; }
}

@media (max-width: 480px) {
  h1, .hero-title { font-size: 26px !important; }
  h2 { font-size: 22px !important; }
  .hero p, .hero-subtitle { font-size: 14px !important; }
}

/* ---------- Buttons ---------- */
@media (max-width: 600px) {
  .btn-primary, .btn-outline, .btn-nav, .btn {
    display: inline-block;
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
  }
}

/* ---------- Images (gift box, etc.) ---------- */
@media (max-width: 768px) {
  .hero-image, .hero-img, .banner-image, .gift-image, .product-image {
    max-width: 180px !important;
    margin: 20px auto !important;
  }
}

/* ---------- Marquee / banner strips ---------- */
.marquee, .scrolling-banner, .ticker {
  white-space: nowrap;
  overflow: hidden;
}
.marquee-content { display: inline-block; animation: none !important; }

/* ---------- Footer ---------- */
@media (max-width: 768px) {
  footer, .footer {
    flex-direction: column !important;
    text-align: center;
    padding: 24px 16px !important;
  }
  .footer-links, .footer-menu {
    flex-wrap: wrap !important;
    justify-content: center;
    gap: 10px !important;
  }
}

/* ---------- Admin / Tables ---------- */
@media (max-width: 992px) {
  .sidebar, .admin-sidebar, .creator-sidebar {
    width: 100% !important;
    position: relative !important;
    min-height: auto !important;
  }
  .main-content, .content-area, .dashboard-main {
    width: 100% !important;
    margin-left: 0 !important;
    padding: 16px !important;
  }
}

@media (max-width: 768px) {
  .row, .grid, .cards, .stats-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
  }
  .card, .stat-card, .box { width: 100% !important; }
  table, .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  table thead, table tbody, table th, table td { white-space: nowrap; }
  .form-group input, .form-group select, .form-group textarea {
    width: 100% !important;
    font-size: 16px !important; /* prevents iOS zoom */
  }
}

/* ---------- Forms / Inputs ---------- */
@media (max-width: 600px) {
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="tel"], input[type="url"],
  select, textarea {
    font-size: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .form-row, .form-inline { flex-direction: column !important; }
}

/* ---------- Helper utility classes ---------- */
.hide-mobile { display: block; }
.show-mobile { display: none; }
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .show-mobile { display: block !important; }
}
/* ============================================================
   DASHBOARD / CREATOR / ADMIN SPECIFIC FIXES (Tailwind Overrides)
   ============================================================ */

@media (max-width: 768px) {
  /* 1. Force the main body flex container to stack vertically */
  body.flex.h-screen,
  body.min-h-screen.flex {
    flex-direction: column !important;
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
  }

  /* 2. Fix the Sidebar: Make it full width and auto height */
  aside.w-\[260px\], 
  aside.flex-shrink-0,
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    flex-shrink: 1 !important;
    height: auto !important;
    min-height: auto !important;
    position: relative !important;
    /* Optional: remove sticky positioning on mobile so it scrolls with the page */
    position: static !important; 
    padding-bottom: 20px !important;
  }

  /* 3. Fix the Main Content Area */
  div.flex-1.flex.flex-col.h-screen.overflow-hidden,
  .main-content,
  .content-area {
    width: 100% !important;
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
    margin-left: 0 !important;
  }

  /* 4. Fix the top header inside the main content */
  header, .top-header {
    padding: 15px !important;
    flex-wrap: wrap !important;
  }

  /* 5. Fix the dashboard grid/cards so they don't squish */
  .grid, .grid-cols-1, .grid-cols-2, .grid-cols-3, .grid-cols-4 {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    width: 100% !important;
  }
  
  .card, .stat-card, .bg-white.rounded-xl {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    margin-bottom: 10px !important;
  }

  /* 6. Ensure text doesn't cause horizontal scrolling */
  h1, h2, h3, p, span {
    word-wrap: break-word !important;
    white-space: normal !important;
  }
}

/* ============================================================
   MOBILE DASHBOARD FIX (Matches Next.js Layout)
   ============================================================ */

@media (max-width: 1024px) {
  /* 1. Completely hide the sidebar on mobile/tablet (just like Next.js) */
  aside.w-\[260px\], 
  aside.flex-shrink-0,
  aside.hidden.lg\:block,
  .sidebar {
    display: none !important;
  }

  /* 2. Force the main body to be a normal column */
  body {
    display: block !important;
    background-color: #f9fafb !important; /* Light background like Next.js */
  }

  /* 3. Make the main content wrapper take 100% width */
  div.flex-1.flex.flex-col.h-screen.overflow-hidden,
  .main-content,
  .content-area {
    width: 100% !important;
    height: auto !important;
    min-height: 100vh !important;
    display: block !important;
    overflow-y: auto !important;
  }

  /* 4. Add the Top Header (Hamburger + Profile) styling */
  header, .top-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    background: #ffffff !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e5e7eb !important;
    width: 100% !important;
  }

  /* 5. Stack the stat cards (Clicks, Orders, etc.) */
  .grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    width: 100% !important;
  }
  .grid > div, .card {
    width: 100% !important;
    margin: 0 !important;
  }

  /* 6. Ensure the main padding looks like the Next.js app */
  main, .p-6, .p-4 {
    padding: 16px !important;
    width: 100% !important;
  }
}
