/**
 * VARASHREE LUXURY - RESPONSIVE DESIGN
 * Supports: Mobile (320px), Tablet (481px), iPad (768px), Laptop (1024px), Desktop (1440px+)
 */

:root {
  --safe-area-inset-left: env(safe-area-inset-left, 0);
  --safe-area-inset-right: env(safe-area-inset-right, 0);
  --safe-area-inset-top: env(safe-area-inset-top, 0);
  --safe-area-inset-bottom: env(safe-area-inset-bottom, 0);
}

/* ============================================
   GLOBAL RESPONSIVE FIXES
   ============================================ */

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

img, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ============================================
   VIDEO RESPONSIVE FIX
   ============================================ */

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Video containers */
.video-container,
#bg-video {
  width: 100vw;
  height: 100vh;
  max-width: 100%;
}

/* ============================================
   HEADER & NAVIGATION RESPONSIVE
   ============================================ */

header, .header, .topbar, .navbar {
  width: 100%;
  padding-left: var(--safe-area-inset-left);
  padding-right: var(--safe-area-inset-right);
}

/* Hamburger menu for mobile */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: block;
    background: none;
    border: none;
    color: var(--gold, #d4af37);
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    min-height: 48px;
    min-width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  nav, .nav-links {
    display: none;
  }

  nav.active, .nav-links.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    z-index: 999;
    padding: 20px 0;
  }

  nav a, .nav-links a {
    display: block;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

/* ============================================
   FORM RESPONSIVE FIXES
   ============================================ */

form {
  width: 100%;
}

input, textarea, select {
  width: 100%;
  font-size: 16px;
  padding: 14px;
  margin-bottom: 16px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 4px;
}

@media (max-width: 768px) {
  input, textarea, select {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 16px 12px;
    min-height: 44px;
    margin-bottom: 20px;
  }

  input[type="checkbox"],
  input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
  }

  label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
  }

  .checkbox-group {
    flex-direction: row;
    align-items: center;
  }

  .form-group {
    margin-bottom: 24px;
  }
}

/* ============================================
   BUTTONS RESPONSIVE
   ============================================ */

button, .btn, input[type="submit"], input[type="button"] {
  min-height: 44px;
  min-width: 44px;
  padding: 12px 24px;
  cursor: pointer;
  font-size: 14px;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  border-radius: 4px;
  transition: all 0.3s ease;
}

@media (max-width: 768px) {
  button, .btn, input[type="submit"], input[type="button"] {
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    font-size: 16px;
  }

  .btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .btn-group .btn {
    flex: 1;
  }
}

/* ============================================
   GRID RESPONSIVE - CATEGORY CARDS
   ============================================ */

.cat-grid, .grid, .product-grid {
  display: grid;
  gap: 20px;
  width: 100%;
}

/* Desktop: 3-4 columns */
@media (min-width: 1440px) {
  .cat-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
  }
}

/* Laptop: 2-3 columns */
@media (min-width: 1024px) and (max-width: 1439px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

/* iPad/Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .cat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* Mobile: 1 column */
@media (max-width: 767px) {
  .cat-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .cat-card {
    min-height: 300px;
  }
}

/* ============================================
   CARD RESPONSIVE
   ============================================ */

.card, .cat-card, .product-card, .lot {
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
}

@media (max-width: 768px) {
  .card, .cat-card, .product-card, .lot {
    border-radius: 6px;
  }

  .card-content, .cat-card .body {
    padding: 16px 12px;
  }

  .card-title, .cat-name, .nm {
    font-size: 18px;
    line-height: 1.3;
  }

  .card-desc, .cat-desc {
    font-size: 12px;
    line-height: 1.4;
  }
}

/* ============================================
   TYPOGRAPHY RESPONSIVE
   ============================================ */

h1 {
  font-size: clamp(28px, 5vw, 56px);
  line-height: 1.2;
  margin-bottom: 16px;
}

h2 {
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.2;
  margin-bottom: 12px;
}

h3 {
  font-size: clamp(20px, 3vw, 32px);
  line-height: 1.3;
  margin-bottom: 10px;
}

p, body {
  font-size: clamp(14px, 2vw, 16px);
  line-height: clamp(1.4, 2.5vw, 1.8);
}

@media (max-width: 480px) {
  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }

  h3 {
    font-size: 16px;
  }

  p, body {
    font-size: 13px;
    line-height: 1.5;
  }

  small {
    font-size: 11px;
  }
}

/* ============================================
   CONTAINER RESPONSIVE
   ============================================ */

.container, .content, .page-wrap, .wrap {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: var(--safe-area-inset-left);
  padding-right: var(--safe-area-inset-right);
}

@media (max-width: 1024px) {
  .container, .content, .page-wrap, .wrap {
    max-width: 100%;
  }
}

@media (max-width: 768px) {
  .container, .content, .page-wrap, .wrap {
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .container, .content, .page-wrap, .wrap {
    padding: 0 12px;
  }
}

/* ============================================
   SPACING RESPONSIVE
   ============================================ */

.section {
  padding: clamp(40px, 10vw, 80px) 0;
}

@media (max-width: 768px) {
  .section {
    padding: 30px 0;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 20px 0;
  }
}

/* ============================================
   FLEX LAYOUT RESPONSIVE
   ============================================ */

.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.flex-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (max-width: 768px) {
  .flex-row {
    flex-direction: column;
  }

  .flex-row > * {
    flex: 1 1 100% !important;
  }
}

/* ============================================
   MODAL & OVERLAY RESPONSIVE
   ============================================ */

.modal, .overlay, .popup {
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  padding: 0;
  margin: 0;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
  .modal-content {
    max-width: 100%;
    border-radius: 0;
  }
}

/* ============================================
   TABLE RESPONSIVE
   ============================================ */

table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  table {
    font-size: 12px;
  }

  table th, table td {
    padding: 8px;
  }

  /* Stack table on mobile */
  table.responsive {
    display: block;
    border: 0;
  }

  table.responsive thead {
    display: none;
  }

  table.responsive tr {
    display: block;
    border-bottom: 2px solid #ddd;
    margin-bottom: 15px;
  }

  table.responsive td {
    display: block;
    text-align: right;
    padding-left: 50%;
    position: relative;
  }

  table.responsive td:before {
    content: attr(data-label);
    position: absolute;
    left: 6px;
    font-weight: bold;
    text-align: left;
  }
}

/* ============================================
   ANIMATION RESPONSIVE
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Disable heavy animations on mobile */
@media (max-width: 768px) {
  .reveal, .fadeInUp, .slideIn {
    animation: none;
    opacity: 1;
  }

  *[data-tilt] {
    transform: none !important;
  }

  .particle {
    display: none;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  button:hover,
  .btn:hover,
  a:hover,
  .card:hover {
    transform: none;
    box-shadow: none;
  }

  /* Add active states instead */
  button:active,
  .btn:active,
  a:active,
  .card:active {
    opacity: 0.8;
  }

  /* Increase tap target sizes */
  a, button, input[type="button"], input[type="submit"], label {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
  }
}

/* ============================================
   LANDSCAPE MODE FIX
   ============================================ */

@media (max-height: 600px) and (orientation: landscape) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }

  .section {
    padding: 20px 0;
  }

  header, footer {
    position: sticky;
  }
}

/* ============================================
   RETINA/HIGH DPI OPTIMIZATION
   ============================================ */

@media (min-resolution: 2dppx) {
  img, video, canvas {
    image-rendering: crisp-edges;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  * {
    background: transparent !important;
    color: #000 !important;
    text-shadow: none !important;
    box-shadow: none !important;
  }

  a, a:visited {
    text-decoration: underline;
  }

  a[href]:after {
    content: " (" attr(href) ")";
  }

  img {
    max-width: 100% !important;
  }

  @page {
    margin: 0.5cm;
  }
}

/* ============================================
   UTILITIES
   ============================================ */

.hidden-mobile {
  display: none !important;
}

@media (min-width: 769px) {
  .hidden-mobile {
    display: block !important;
  }

  .hidden-desktop {
    display: none !important;
  }
}

.text-center {
  text-align: center;
}

.mt-auto {
  margin-top: auto;
}

.mb-auto {
  margin-bottom: auto;
}

/* Safe area support for notched devices */
.safe-area-top {
  padding-top: var(--safe-area-inset-top);
}

.safe-area-bottom {
  padding-bottom: var(--safe-area-inset-bottom);
}

/* ============================================
   DEVICE-SPECIFIC FIXES
   ============================================ */

/* iOS Safari fix */
input, textarea, select {
  font-size: 16px;
  -webkit-user-select: text;
  user-select: text;
}

/* Android Chrome fix */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent zoom on input focus */
@media (max-width: 768px) {
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px; /* Prevents automatic zoom on iOS */
  }
}
