/* RS Apparel & Sourcing - Production CSS
   Features: Cookie consent, back to top, WhatsApp float, page loader,
   accessibility, print styles, RTL support, animations */

/* ==========================================
   PAGE LOADER
   ========================================== */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #1a1d2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.loader-spinner {
  position: relative;
  width: 60px;
  height: 60px;
}
.spinner-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid transparent;
  border-radius: 50%;
  animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
.spinner-ring:nth-child(1) {
  border-top-color: #16864A;
  animation-delay: -0.45s;
}
.spinner-ring:nth-child(2) {
  border-top-color: #55B878;
  animation-delay: -0.3s;
}
.spinner-ring:nth-child(3) {
  border-top-color: #1a1d2e;
  animation-delay: -0.15s;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loader-text {
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
  margin-top: 20px;
  font-family: var(--font);
  letter-spacing: 0.05em;
}

/* ==========================================
   SKIP LINK (Accessibility)
   ========================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 12px 24px;
  background: #16864A;
  color: white;
  font-weight: 600;
  border-radius: 0 0 8px 8px;
  z-index: 100000;
  transition: top 0.3s ease;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #55B878;
  outline-offset: 2px;
}

/* ==========================================
   COOKIE CONSENT
   ========================================== */
.cookie-consent {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1a2a3a;
  border-top: 2px solid #16864A;
  padding: 20px 24px;
  z-index: 9998;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -4px 30px rgba(0,0,0,0.3);
}
.cookie-consent.show {
  transform: translateY(0);
}
.cookie-content {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
}
.cookie-icon {
  font-size: 2rem;
  flex-shrink: 0;
}
.cookie-text {
  flex: 1;
}
.cookie-text h4 {
  color: white;
  font-size: 1rem;
  margin-bottom: 4px;
}
.cookie-text p {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  line-height: 1.5;
}
.cookie-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.cookie-btn {
  padding: 10px 24px !important;
  font-size: 0.88rem !important;
  white-space: nowrap;
}
@media (max-width: 768px) {
  .cookie-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  .cookie-actions {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================
   BACK TO TOP
   ========================================== */
.back-to-top {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1a1d2e;
  color: white;
  border: 2px solid rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 997;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.back-to-top:hover {
  background: #16864A;
  border-color: #16864A;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(22,134,74,0.4);
}
.back-to-top:focus {
  outline: 3px solid #16864A;
  outline-offset: 3px;
}

/* ==========================================
   WHATSAPP FLOAT (Enhanced)
   ========================================== */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #25D366;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 998;
  box-shadow: 0 4px 20px rgba(37,211,102,0.4);
  transition: all 0.3s ease;
  animation: whatsapp-pulse 2s infinite;
}
.whatsapp-float:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(37,211,102,0.5);
}
.whatsapp-float:focus {
  outline: 3px solid #25D366;
  outline-offset: 3px;
}
.whatsapp-tooltip {
  position: absolute;
  right: 72px;
  background: #1a2a3a;
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: all 0.3s ease;
  pointer-events: none;
}
.whatsapp-float:hover .whatsapp-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
@keyframes whatsapp-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(37,211,102,0.4); }
  50% { box-shadow: 0 4px 30px rgba(37,211,102,0.6), 0 0 0 10px rgba(37,211,102,0.1); }
}
@media (max-width: 768px) {
  .whatsapp-float {
    width: 56px;
    height: 56px;
    bottom: 20px;
    right: 20px;
  }
  .whatsapp-float svg {
    width: 28px;
    height: 28px;
  }
  .whatsapp-tooltip {
    display: none;
  }
}

/* ==========================================
   ACCESSIBILITY
   ========================================== */
*:focus-visible {
  outline: 3px solid #16864A;
  outline-offset: 2px;
}
a:focus-visible, button:focus-visible {
  outline: 3px solid #16864A;
  outline-offset: 2px;
}
/* Ensure minimum tap target size for mobile */
@media (pointer: coarse) {
  a, button, [role="button"], input, select, textarea {
    min-height: 44px;
  }
}
/* Screen reader only text */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
  .nav, .mobile-nav, .hamburger, .footer, .whatsapp-float,
  .back-to-top, .cookie-consent, .scroll-progress, .page-loader,
  .hero-slider, .hero-dots, .hero-arrow, .skip-link,
  .social-links, .nav-cta, .btn, .inquiry-form-wrapper,
  .cta-section, .cert-scroll-wrapper, .lang-switcher,
  .nav-dropdown {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    line-height: 1.5;
  }
  .section {
    padding: 20px 0 !important;
    page-break-inside: avoid;
  }
  .container {
    max-width: 100%;
    padding: 0 20px;
  }
  h1, h2, h3, h4 {
    color: black !important;
    page-break-after: avoid;
  }
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: var(--muted-text-color, #666);
  }
  .footer-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    color: black;
    border-top: 1px solid #ccc;
    padding: 10px;
    text-align: center;
  }
  .page-banner, .about-hero, .section-dark {
    background: white !important;
    color: black !important;
  }
  .page-banner h1, .section-dark h2, .section-dark h3 {
    color: black !important;
  }
}

/* ==========================================
   RTL SUPPORT (Arabic)
   ========================================== */
[dir="rtl"] body {
  font-family: 'Inter', 'Arial', sans-serif;
  direction: rtl;
  text-align: right;
}
[dir="rtl"] .nav-dropdown-menu {
  left: auto;
  right: 0;
}
[dir="rtl"] .mobile-dropdown-menu {
  padding-left: 0;
  padding-right: 16px;
}
[dir="rtl"] .category-list li::before {
  margin-right: 0;
  margin-left: 10px;
}
[dir="rtl"] .contact-item {
  flex-direction: row-reverse;
}
[dir="rtl"] .footer-contact-item {
  flex-direction: row-reverse;
}
[dir="rtl"] .timeline {
  padding-left: 0;
  padding-right: 40px;
}
[dir="rtl"] .process-step {
  flex-direction: row-reverse;
}

/* ==========================================
   LANGUAGE SWITCHER (Enhanced)
   ========================================== */
.lang-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lang-switcher-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font);
}
.lang-switcher-btn:hover {
  background: rgba(255,255,255,0.14);
  color: white;
}
.lang-switcher-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15);
  border: 1px solid rgba(0,0,0,0.08);
  min-width: 180px;
  z-index: 1002;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.25s ease;
  overflow: hidden;
}
.lang-switcher-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-switcher-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #17212B;
  transition: all 0.2s ease;
}
.lang-switcher-dropdown a:hover {
  background: #F3F6F8;
  color: #16864A;
}
.lang-switcher-dropdown a.active {
  color: #16864A;
  font-weight: 600;
  background: rgba(22,134,74,0.05);
}
.lang-switcher-dropdown a .flag {
  font-size: 1.1rem;
}

/* ==========================================
   ANIMATIONS (Enhanced)
   ========================================== */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}
.fade-up.delay-1 { transition-delay: 0.1s; }
.fade-up.delay-2 { transition-delay: 0.2s; }
.fade-up.delay-3 { transition-delay: 0.3s; }
.fade-in {
  opacity: 0;
  transition: opacity 0.8s ease;
}
.fade-in.visible {
  opacity: 1;
}
.slide-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.slide-left.visible {
  opacity: 1;
  transform: translateX(0);
}
.slide-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.slide-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* ==========================================
   FORM VALIDATION STYLES
   ========================================== */
.form-group.error input,
.form-group.error select,
.form-group.error textarea {
  border-color: #e53e3e;
  box-shadow: 0 0 0 3px rgba(229,62,62,0.1);
}
.form-group .error-message {
  color: #e53e3e;
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}
.form-group.error .error-message {
  display: block;
}
.form-success {
  background: #e6ffed;
  border: 1px solid #38a169;
  color: #22543d;
  padding: 16px 20px;
  border-radius: 12px;
  text-align: center;
  font-weight: 500;
}
.form-success::before {
  content: '✓ ';
  font-weight: 700;
}

/* ==========================================
   LAZY LOADING PLACEHOLDER
   ========================================== */
img[loading="lazy"] {
  background: #e8ecf0;
  transition: opacity 0.3s ease;
}
img[loading="lazy"].loaded {
  opacity: 1;
}

/* ==========================================
   404 PAGE
   ========================================== */
.page-404 {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px;
  background: linear-gradient(135deg, #1a1d2e, #1a1d2e);
}
.page-404 .error-code {
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: 800;
  color: #16864A;
  line-height: 1;
  margin-bottom: 16px;
  text-shadow: 0 4px 20px rgba(22,134,74,0.3);
}
.page-404 h1 {
  color: white;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: 16px;
}
.page-404 p {
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  margin-bottom: 40px;
  max-width: 500px;
}
.page-404 .search-form {
  max-width: 400px;
  margin: 0 auto 32px;
  display: flex;
  gap: 12px;
}
.page-404 .search-form input {
  flex: 1;
  padding: 14px 20px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: white;
  border-radius: 12px;
  font-size: 1rem;
  font-family: var(--font);
  transition: border-color 0.3s;
}
.page-404 .search-form input::placeholder {
  color: rgba(255,255,255,0.5);
}
.page-404 .search-form input:focus {
  border-color: #16864A;
  outline: none;
}
.page-404 .error-links {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.page-404 .error-links a {
  padding: 12px 28px;
  background: rgba(255,255,255,0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  font-weight: 500;
  transition: all 0.3s;
}
.page-404 .error-links a:hover {
  background: #16864A;
  border-color: #16864A;
}
.page-404 .error-links .btn-home {
  background: #16864A;
  border-color: #16864A;
}
