/* ========================================
   MASTER SPLINTER - RESPONSIVE STYLES
   Complete Responsive Design for All Devices
   ======================================== */

/* ========================================
   VIEWPORT & BASE RESPONSIVE SETTINGS
   ======================================== */

/* Ensure proper box-sizing for all elements */
*, *::before, *::after {
  box-sizing: border-box;
}

@media (max-width: 599px) {
  .shop-page .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
  }

  .shop-page .product-card {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  }

  .shop-page .product-card__image {
    height: 150px;
  }

  .shop-page .product-card__footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  .shop-page .add-to-cart-btn {
    width: 100%;
    justify-content: center;
  }
}

/* Prevent horizontal scroll on small screens */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Responsive images and media */
img, video, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================
   LARGE DESKTOP (1920px+)
   ======================================== */
@media (min-width: 1920px) {
  :root {
    --max-width: 1600px;
  }
  
  .container {
    max-width: 1600px;
  }
  
  .hero__title {
    font-size: 4rem;
  }
  
  .section__title {
    font-size: 3rem;
  }
}

/* ========================================
   DESKTOP (1440px - 1919px)
   ======================================== */
@media (min-width: 1440px) and (max-width: 1919px) {
  .container {
    max-width: 1400px;
  }
  
  .services-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========================================
   LAPTOP (1024px - 1439px)
   ======================================== */
@media (min-width: 1024px) and (max-width: 1439px) {
  .container {
    max-width: 1200px;
    padding: 0 2rem;
  }
  
  .hero__title {
    font-size: 2.5rem;
  }
  
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

/* ========================================
   TABLET LANDSCAPE (768px - 1023px)
   ======================================== */
@media (min-width: 768px) and (max-width: 1023px) {
  .container {
    max-width: 100%;
    padding: 0 1.5rem;
  }
  
  
  .hero {
    padding: 3rem 1.5rem;
  }
  
  .hero__title {
    font-size: 2rem;
  }
  
  .hero__subtitle {
    font-size: 1rem;
  }
  
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
  }
  
  .gallery-slide {
    min-width: calc(50% - 0.5rem);
  }
  
  .process-steps {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .trust-badges {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Header adjustments */
  .site-header {
    padding: 1rem 1.5rem;
  }
  
  body {
    padding-top: 75px;
  }
  
  .brand__logo {
    width: 45px;
    height: 45px;
  }
  
  /* Footer adjustments */
  .site-footer {
    padding: 2rem 1.5rem;
  }
  
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

/* ========================================
   TABLET PORTRAIT (600px - 767px)
   ======================================== */
@media (min-width: 600px) and (max-width: 767px) {
  .container {
    padding: 0 1.25rem;
  }
  
  .hero {
    padding: 2.5rem 1.25rem;
  }
  
  .hero__title {
    font-size: 1.75rem;
  }
  
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.25rem;
  }
  
  .service-card {
    padding: 1.25rem;
  }
  
  .service-card__icon {
    font-size: 2rem;
  }
  
  .button {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }
  
  .section {
    padding: 3rem 1.25rem;
  }
}

/* ========================================
   MOBILE LARGE (480px - 599px)
   ======================================== */
@media (min-width: 480px) and (max-width: 599px) {
  .container {
    padding: 0 1rem;
  }
  
  /* إصلاح عرض نص زر العودة في المتجر */
  .shop-close span {
    display: inline !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
  }
  
  .hero {
    padding: 2rem 1rem;
  }
  
  .hero__title {
    font-size: 1.5rem;
    line-height: 1.3;
  }
  
  .hero__subtitle {
    font-size: 0.9rem;
  }
  
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
  }
  
  .service-card {
    padding: 1rem;
  }
  
  .button {
    padding: 0.7rem 1.25rem;
    font-size: 0.9rem;
  }
  
  .section {
    padding: 2.5rem 1rem;
  }
  
  .section__title {
    font-size: 1.75rem;
  }
  
  /* Stack hero stats vertically */
  .hero__stats {
    flex-direction: column;
    gap: 1rem;
  }
  
  /* Single column layouts */
  .process-steps,
  .trust-badges,
  .footer-grid {
    grid-template-columns: 1fr;
  }
  
  /* Gallery adjustments */
  .gallery-slide {
    min-width: 100%;
  }
  
  .gallery-slider {
    padding: 0 1rem;
  }
}

/* ========================================
   MOBILE MEDIUM (375px - 479px)
   ======================================== */
@media (min-width: 375px) and (max-width: 479px) {
  .container {
    padding: 0 0.875rem;
  }
  
  /* إصلاح عرض نص زر العودة في المتجر */
  .shop-close span {
    display: inline !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
  }
  
  .hero {
    padding: 1.75rem 0.875rem;
  }
  
  .hero__title {
    font-size: 1.35rem;
  }
  
  .hero__subtitle {
    font-size: 0.85rem;
  }
  
  .services-grid {
    grid-template-columns: 1fr;
    gap: 0.875rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.875rem;
  }
  
  .service-card {
    padding: 0.875rem;
  }
  
  .service-card__icon {
    font-size: 1.75rem;
  }
  
  .button {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
  }
  
  .section {
    padding: 2rem 0.875rem;
  }
  
  .section__title {
    font-size: 1.5rem;
  }
  
  /* Header adjustments */
  .site-header {
    padding: 0.75rem 0.875rem;
  }
  
  body {
    padding-top: 70px;
  }
  
  .brand__logo {
    width: 40px;
    height: 40px;
  }
  
  .brand__text strong {
    font-size: 0.95rem;
  }
  
  .brand__text small {
    font-size: 0.65rem;
  }
  
  /* Modal adjustments */
  .service-modal {
    width: 95%;
    max-height: 85vh;
  }
  
  .service-modal__content {
    padding: 1.25rem 0.875rem;
  }
  
  /* Cart sidebar */
  .cart-sidebar {
    width: 100%;
  }
  
  /* Footer */
  .site-footer {
    padding: 1.5rem 0.875rem;
  }
}

/* ========================================
   MOBILE SMALL (320px - 374px)
   ======================================== */
@media (max-width: 374px) {
  .container {
    padding: 0 0.75rem;
  }
  
  /* إصلاح عرض نص زر العودة في المتجر */
  .shop-close {
    padding: 0.6rem 0.8rem !important;
    font-size: 0.9rem !important;
  }
  
  .shop-close span {
    display: inline !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
  }
  
  .shop-close i {
    margin-left: 0.4rem;
  }
  
  [dir="rtl"] .shop-close i {
    margin-left: 0;
    margin-right: 0.4rem;
  }
  
  .hero {
    padding: 1.5rem 0.75rem;
  }
  
  .hero__title {
    font-size: 1.2rem;
    line-height: 1.25;
  }
  
  .hero__subtitle {
    font-size: 0.8rem;
  }
  
  .services-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
  }
  
  .service-card {
    padding: 0.75rem;
  }
  
  .service-card__icon {
    font-size: 1.5rem;
  }
  
  .service-card__title {
    font-size: 0.95rem;
  }
  
  .button {
    padding: 0.6rem 0.875rem;
    font-size: 0.8rem;
  }
  
  .section {
    padding: 1.75rem 0.75rem;
  }
  
  .section__title {
    font-size: 1.35rem;
  }
  
  /* Header adjustments */
  .site-header {
    padding: 0.65rem 0.75rem;
  }
  
  body {
    padding-top: 65px;
  }
  
  .brand__logo {
    width: 35px;
    height: 35px;
  }
  
  .brand__text strong {
    font-size: 0.85rem;
  }
  
  .brand__text small {
    font-size: 0.6rem;
  }
  
  .header-controls {
    gap: 0.4rem;
  }
  
  /* Modal adjustments */
  .service-modal {
    width: 98%;
    max-height: 90vh;
  }
  
  .service-modal__content {
    padding: 1rem 0.75rem;
  }
  
  .service-modal h2 {
    font-size: 1.25rem;
  }
  
  /* Footer */
  .site-footer {
    padding: 1.25rem 0.75rem;
  }
  
  .footer-grid {
    gap: 1.5rem;
  }
  
  /* Floating WhatsApp button - مقابل زر الدردشة مع الحفاظ على الشكل */
  .floating-whatsapp {
    bottom: 8rem !important;
    bottom: calc(8rem + env(safe-area-inset-bottom, 0)) !important;
    right: clamp(0.75rem, 3vw, 1rem) !important;
    /* الحفاظ على الشكل الأصلي */
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    padding: 0.6rem 0.8rem !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    font-size: 0.8rem !important;
    width: auto !important;
    height: auto !important;
  }
  
  /* إصلاح السلة والمودال لتجنب تغطية شريط المتصفح السفلي */
  .cart-sidebar__footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 20px)) !important;
    margin-bottom: env(safe-area-inset-bottom, 0);
  }
  
  .checkout-modal {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 20px)) !important;
  }
  
  .checkout-modal__content {
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 20px)) !important;
  }
  
  .floating-whatsapp__icon {
    font-size: 1.1rem;
  }
}

/* ========================================
   LANDSCAPE ORIENTATION (Mobile/Tablet)
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 1.5rem 1rem;
  }
  
  .hero__title {
    font-size: 1.5rem;
  }
  
  .hero__subtitle {
    font-size: 0.85rem;
  }
  
  .section {
    padding: 2rem 1rem;
  }
  
  .service-modal {
    max-height: 95vh;
    overflow-y: auto;
  }
  
  .site-header {
    padding: 0.75rem 1rem;
  }
  
  body {
    padding-top: 68px;
  }
}

/* ========================================
   MOBILE DEVICES - WHATSAPP BUTTON FIX
   ======================================== */
@media (max-width: 768px) {
  .floating-whatsapp {
    bottom: 8rem !important;
    /* الحفاظ على الشكل الأصلي للهواتف فقط */
    display: inline-flex !important;
    align-items: center !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    width: auto !important;
    height: auto !important;
  }
  
  /* عرض القائمة الثانوية على الأجهزة المحمولة والتابلت */
  .site-nav .secondary-nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    border-top: 1px solid var(--color-border);
    padding-top: 1rem;
  }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  /* لا تعديل لزر الواتساب في الأجهزة اللمسية الكبيرة */
  
  /* Increase touch targets */
  .button,
  .nav-link,
  .service-card,
  .product-card {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Remove hover effects on touch devices */
  .service-card:hover,
  .product-card:hover,
  .button:hover {
    transform: none;
  }
  
  /* Add active states instead */
  .service-card:active,
  .product-card:active,
  .button:active {
    transform: scale(0.98);
  }
  
  /* Larger tap areas for icons */
  .theme-toggle,
  .lang-toggle,
  .nav-toggle {
    padding: 0.75rem;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  .site-header,
  .floating-whatsapp,
  .live-chat-widget,
  .share-button,
  .theme-customizer,
  .nav-toggle {
    display: none !important;
  }
  
  .hero,
  .section {
    page-break-inside: avoid;
  }
  
  .service-card,
  .product-card {
    page-break-inside: avoid;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ========================================
   HIGH DPI / RETINA DISPLAYS
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimize images for retina displays */
  .brand__logo,
  .service-card__icon,
  .product-card__image img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ========================================
   REDUCED MOTION (Accessibility)
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   DARK MODE PREFERENCE
   ======================================== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0a0e13;
    --color-surface: #1a2332;
    --color-accent: #ffffff;
    --color-muted: #c5d0de;
    --color-border: #4a5568;
  }
}

/* ========================================
   SPECIFIC COMPONENT RESPONSIVE FIXES
   ======================================== */

/* Navigation Menu - Mobile */
@media (max-width: 960px) {
  /* Ensure header has proper z-index */
  .site-header {
    position: fixed;
    z-index: 10001;
  }
  
  /* Keep header layout same as desktop */
  .brand {
    order: 0;
  }
  
  .header-controls {
    order: 1;
    margin-left: auto;
  }
  
  .nav-toggle {
    order: 2;
    margin-left: 1rem;
  }
  
  [dir="rtl"] .nav-toggle {
    margin-left: 0;
    margin-right: 1rem;
  }
  
  /* Ensure menu starts hidden */
  .site-nav:not([aria-expanded="true"]) {
    transform: translateY(-120%);
    -webkit-transform: translateY(-120%);
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }
  
  /* Prevent body scroll when menu is open */
  body.nav-open {
    overflow: hidden;
  }
  
  /* Add overlay when menu is open */
  body.nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 800;
    animation: fadeIn 0.3s ease;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  .site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100vh;
    padding: 7rem 2rem 2rem;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: translateY(-120%);
    -webkit-transform: translateY(-120%);
    transition: transform 0.35s ease, -webkit-transform 0.35s ease;
    z-index: 850;
    border-bottom: 2px solid var(--color-primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    visibility: hidden;
    opacity: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  .site-nav[aria-expanded="true"] {
    transform: translateY(0);
    -webkit-transform: translateY(0);
    visibility: visible;
    opacity: 1;
  }
  
  .site-nav ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    font-size: 0.95rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .site-nav ul li {
    width: 100%;
  }

  .site-nav ul a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.6);
    text-align: center;
    font-size: 0.95rem;
    min-height: 70px;
  }

  .site-nav ul a i {
    margin-bottom: 0.35rem;
    font-size: 1.1rem;
  }

  .site-nav .secondary-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
  
  .site-nav li {
    width: 100%;
  }
  
  .site-nav a {
    display: block;
    padding: 1rem 1.5rem;
    background: rgba(130, 207, 226, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(130, 207, 226, 0.2);
    transition: all 0.3s ease;
    font-weight: 500;
  }
  
  .site-nav a:hover,
  .site-nav a:focus-visible {
    background: rgba(130, 207, 226, 0.2);
    border-color: var(--color-primary);
    transform: translateX(5px);
  }
  
  [dir="rtl"] .site-nav a:hover,
  [dir="rtl"] .site-nav a:focus-visible {
    transform: translateX(-5px);
  }
  
  .site-nav a::after {
    display: none;
  }
  
  .nav-toggle {
    display: flex;
    z-index: 10000;
    position: relative;
    background: var(--color-surface);
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    box-shadow: 0 2px 8px rgba(130, 207, 226, 0.2);
    transition: all 0.3s ease;
  }
  
  .nav-toggle:hover {
    box-shadow: 0 4px 16px rgba(130, 207, 226, 0.3);
    transform: translateY(-1px);
  }
  
  .nav-toggle span {
    width: 24px;
    height: 3px;
    background: var(--color-primary);
    transition: all 0.3s ease;
  }
  
  .nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }
  
  .nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  
  .nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
  }
  
  .site-header .cta-button {
    display: none;
  }
  
  /* Dark mode mobile navigation styles */
  [data-theme="dark"] .site-nav {
    background: var(--color-surface);
    border-bottom-color: var(--color-primary);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  }
  
  [data-theme="dark"] .site-nav a {
    background: rgba(130, 207, 226, 0.15);
    border-color: rgba(130, 207, 226, 0.3);
    color: var(--color-accent);
  }
  
  [data-theme="dark"] .site-nav a:hover,
  [data-theme="dark"] .site-nav a:focus-visible {
    background: rgba(130, 207, 226, 0.25);
    border-color: var(--color-primary);
  }
  
  /* Ensure header controls are visible */
  body.nav-open .header-controls {
    position: relative;
    z-index: 10002;
  }
  
  body.nav-open .theme-toggle,
  body.nav-open .lang-toggle {
    background: var(--color-surface);
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(130, 207, 226, 0.2);
  }
  
  /* Mobile navigation overlay */
  .site-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(180deg, 
      rgba(130, 207, 226, 0.05) 0%, 
      transparent 30%);
    pointer-events: none;
    z-index: -1;
  }
  
  [data-theme="dark"] .site-nav::before {
    background: linear-gradient(180deg, 
      rgba(130, 207, 226, 0.1) 0%, 
      transparent 30%);
  }
}

/* Service Modal - Responsive */
@media (max-width: 768px) {
  .service-modal {
    width: 95%;
    max-height: 90vh;
  }
  
  .service-modal__content {
    padding: 1.5rem 1rem;
  }
  
  .service-modal h2 {
    font-size: 1.5rem;
  }
  
  .service-modal__close {
    top: 0.75rem;
    right: 0.75rem;
    width: 35px;
    height: 35px;
    font-size: 1.25rem;
  }
}

/* Cart Sidebar - Mobile */
@media (max-width: 768px) {
  .cart-sidebar {
    width: 100%;
    right: -100%;
  }
  
  [dir="rtl"] .cart-sidebar {
    left: -100%;
    right: auto;
  }
  
  /* إصلاح السلة لتجنب تغطية شريط المتصفح السفلي */
  .cart-sidebar__footer {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 15px)) !important;
    margin-bottom: env(safe-area-inset-bottom, 0);
    position: sticky;
    bottom: 0;
    background: var(--color-surface);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
  }
  
  .checkout-modal {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 15px)) !important;
  }
  
  .checkout-modal__content {
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 15px)) !important;
  }
}

/* Invoice Page - Responsive */
@media (max-width: 968px) {
  .invoice-preview-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .invoice-header {
    padding: 1rem;
    flex-direction: column;
    gap: 1rem;
  }
  
  .invoice-content {
    padding: 2rem 1rem;
  }
  
  .process-step {
    flex-direction: column;
    text-align: center;
  }
}

/* Newsletter Form - Mobile */
@media (max-width: 768px) {
  .newsletter-form {
    flex-direction: column;
  }
  
  .newsletter-form input {
    min-width: 100%;
  }
}

/* Gallery - Responsive */
@media (max-width: 1199px) {
  .gallery-slide {
    min-width: calc(33.333% - 0.67rem);
  }
}

@media (max-width: 767px) {
  .gallery-slide {
    min-width: calc(50% - 0.5rem);
  }
  
  .gallery-slider {
    padding: 0 2rem;
  }
  
  .gallery-nav {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
}

@media (max-width: 479px) {
  .gallery-slide {
    min-width: 100%;
  }
  
  .gallery-slider {
    padding: 0 1.5rem;
  }
}

/* Chat Widget - Mobile */
@media (max-width: 768px) {
  /* Overlay behind chat window */
  .chat-window::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .chat-window.active::before {
    opacity: 1;
  }
  
  .chat-window {
    position: fixed;
    width: calc(100vw - 2rem);
    max-width: 400px;
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%) scale(0.95);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 10000;
  }
  
  .chat-window.active {
    transform: translate(-50%, -50%) scale(1);
  }
  
  .chat-body {
    max-height: calc(80vh - 120px);
    overflow-y: auto;
  }
  /* Smaller chat toggle button for mobile */
  .chat-toggle {
    width: 50px;
    height: 50px;
    font-size: 1.3rem;
  }
  
  /* Extra small screens */
  @media (max-width: 480px) {
    .chat-toggle {
      width: 45px;
      height: 45px;
      font-size: 1.2rem;
    }
    
    .share-button,
    .theme-customizer {
      transform: translateY(-50%) scale(0.7);
    }
  }
  
  /* Show share and theme buttons on mobile but smaller */
  .share-button,
  .theme-customizer {
    display: block;
    transform: translateY(-50%) scale(0.8);
  }
  
  .share-button {
    right: -5px;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
  }
  
  .theme-customizer .customizer-toggle {
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
  }
}

/* ========================================
   BROWSER-SPECIFIC FIXES
   ======================================== */

/* Safari iOS - Fix viewport units */
@supports (-webkit-touch-callout: none) {
  .hero,
  .section {
    min-height: -webkit-fill-available;
  }
}

/* Firefox - Smooth scrolling */
@-moz-document url-prefix() {
  html {
    scroll-behavior: smooth;
  }
}

/* Edge - Grid layout fix */
@supports (-ms-ime-align: auto) {
  .services-grid,
  .products-grid {
    display: -ms-grid;
  }
}
