/* Main styles for Al-Haq Digital Services */

/* Base styles */
body {
  font-family: 'Inter', sans-serif;
  background-color: #f8f9fa;
  color: #333333;
}

/* Dark mode: high-contrast base */
html.dark body {
  background-color: #0b1220; /* deep navy */
  color: #e5e7eb; /* light text */
}
/* Hint browsers to render form controls in dark where supported */
html.dark { color-scheme: dark; }
/* Support pages that use body.dark selectors */
body.dark { background-color: #0b1220; color: #e5e7eb; }
html.dark a { color: #dbeafe; }
html.dark .text-brand-blue { color: #f1f5f9; }
html.dark .text-gray-700,
html.dark .text-gray-600,
html.dark .text-gray-500 { color: #e5e7eb !important; }
html.dark .text-gray-800,
html.dark .text-gray-900 { color: #f1f5f9 !important; }

/* Dark mode backgrounds and borders for common utility classes */
html.dark .bg-white { background-color: #0f1a2b !important; }
html.dark .bg-gray-50 { background-color: #0e1726 !important; }
html.dark .bg-gray-100 { background-color: #0f172a !important; }
html.dark .border-gray-100,
html.dark .border-gray-200,
html.dark .border-gray-300 { border-color: #334155 !important; }
html.dark .divide-gray-100,
html.dark .divide-gray-200 { border-color: #334155 !important; }

/* Dark mode for glassmorphism elements used across pages */
html.dark .glass-container,
html.dark .glass-card,
html.dark .glass-card-with-logo,
html.dark .project-glass-card {
  background: rgba(17, 34, 64, 0.75) !important; /* deep indigo glass */
  -webkit-backdrop-filter: blur(14px) !important;
  backdrop-filter: blur(14px) !important;
  border: 1px solid rgba(212, 175, 55, 0.25) !important;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45) !important;
  color: #e5e7eb !important;
}
/* Tame the faint logo watermark in dark */
html.dark .glass-container-with-logo::before,
html.dark .glass-card-with-logo::before,
html.dark .project-glass-card::before {
  opacity: 0.03 !important;
  filter: grayscale(100%) blur(1px) !important;
}

/* Inputs inside glass surfaces */
html.dark .glass-input,
html.dark input.glass-input,
html.dark textarea.glass-input {
  background: rgba(17, 34, 64, 0.85) !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}
html.dark .glass-input::placeholder { color: #94a3b8 !important; }

/* Buttons on glass */
html.dark .glass-button {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.9), rgba(184, 148, 31, 0.9)) !important;
  color: #0a2540 !important;
  border-color: rgba(212,175,55,0.55) !important;
}
html.dark .glass-button:hover { box-shadow: 0 6px 18px rgba(212, 175, 55, 0.35) !important; }
html.dark .glass-button-gray {
  background: rgba(71, 85, 105, 0.85) !important; /* slate-600 */
  border-color: rgba(71, 85, 105, 0.5) !important;
  color: #f8fafc !important;
}

/* Misc glass surfaces */
html.dark .glass-verse-display {
  background: rgba(17, 34, 64, 0.6) !important;
  border-color: rgba(212, 175, 55, 0.35) !important;
}
html.dark .glass-feedback {
  background: rgba(17, 34, 64, 0.5) !important;
  border-color: rgba(51, 65, 85, 0.6) !important;
}

/* Navigation and headers with blur */
html.dark .backdrop-blur-nav {
  background: rgba(11, 18, 32, 0.7) !important;
  -webkit-backdrop-filter: saturate(160%) blur(16px) !important;
  backdrop-filter: saturate(160%) blur(16px) !important;
}

/* Form controls */
html.dark input[type="text"],
html.dark input[type="email"],
html.dark input[type="tel"],
html.dark input[type="search"],
html.dark input[type="url"],
html.dark input[type="password"],
html.dark textarea,
html.dark select {
  background-color: #0f1a2b !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}
html.dark input::placeholder,
html.dark textarea::placeholder { color: #94a3b8 !important; }

/* Dropdowns/menus commonly using white */
html.dark .menu, html.dark .dropdown, html.dark .popover, html.dark .modal {
  background-color: #0f1a2b !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}

/* Dark mode: ensure common text elements are readable even if pages set their own colors */
html.dark h1, html.dark h2, html.dark h3, html.dark h4, html.dark h5, html.dark h6 {
  color: #f8fafc !important;
}
html.dark p, html.dark li, html.dark small, html.dark blockquote, html.dark label, html.dark dt, html.dark dd {
  color: #e5e7eb !important;
}

/* Brand colors */
.bg-brand-blue {
  background-color: #0a2540;
}
.text-brand-blue {
  color: #0a2540;
}
.bg-brand-gold {
  background-color: #d4af37;
}
.text-brand-gold {
  color: #d4af37;
}
.border-brand-gold {
  border-color: #d4af37;
}

/* Islamic Styling */
.islamic-header {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.95),
    rgba(255, 255, 255, 0.9)
  );
  -webkit-backdrop-filter: blur(10px);
  -moz-backdrop-filter: blur(10px);
  -ms-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(212, 175, 55, 0.2);
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

html.dark .islamic-header {
  background: linear-gradient(135deg, rgba(16, 31, 53, 0.9), rgba(11, 25, 43, 0.88));
  border-bottom: 2px solid rgba(212, 175, 55, 0.3);
  color: #f1f5f9;
}

.islamic-section {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  position: relative;
}

html.dark .islamic-section {
  background: linear-gradient(135deg, #10243b, #0b1a2b);
}

.islamic-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #d4af37, #0a2540, #d4af37);
}

html.dark .islamic-section::before {
  background: linear-gradient(90deg, #d4af37, #1e3a8a, #d4af37);
}

.islamic-footer {
  background: linear-gradient(135deg, #2d3748, #1a202c);
  border-top: 3px solid #d4af37;
}

html.dark .islamic-footer {
  background: linear-gradient(135deg, #0e1726, #0b1220);
  color: #cbd5e1;
}

.islamic-card {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.7)
  );
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(10, 37, 64, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html.dark .islamic-card {
  background: linear-gradient(135deg, rgba(23, 53, 83, 0.92), rgba(15, 39, 64, 0.88)) !important;
  border: 1px solid rgba(212, 175, 55, 0.35) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35) !important;
  color: #e5e7eb !important;
}
html.dark .islamic-card h3 { color: #f8fafc !important; }
html.dark .islamic-card p, html.dark .islamic-card li { color: #e5e7eb !important; }

/* Components baseline dark tweaks */
html.dark .modal-content { background-color: #0f1a2b !important; color: #e5e7eb !important; border-color: #334155 !important; }
html.dark .small-text { color: #cbd5e1 !important; }
html.dark .standard-link { color: #dbeafe !important; }

/* Generic card/section overrides for pages with custom inline styles */
html.dark .card, html.dark .panel, html.dark .box, html.dark .value-card, html.dark .feature-card, html.dark .content-card {
  background-color: #0f1a2b !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}


/* Gradients and highlights */
html.dark .hero-gradient { background: linear-gradient(135deg, #0f172a 0%, #111827 100%) !important; }
html.dark .integration-highlight { background: linear-gradient(135deg, #1f2937, #111827) !important; color: #e5e7eb !important; }

/* Modern Navigation Styles */
.active-nav {
  position: relative;
}

.active-nav:after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background-color: #d4af37;
  border-radius: 4px;
}

.nav-link {
  position: relative;
  transition: all 0.3s ease;
}

.nav-link:hover:after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background-color: #d4af37;
  border-radius: 4px;
  opacity: 0.5;
}

/* Icons */
.inline-icon {
  height: 1.2em;
  width: auto;
  vertical-align: middle;
  margin-right: 0.4em;
}

/* Ko-fi button */
.kofi-button {
  background-color: #29abe0;
  color: white !important;
}

/* Accessibility improvements */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus styles for accessibility */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

/* Language switcher */
.lang-switcher-btn:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

.lang-option[aria-selected='true'] {
  background-color: rgba(212, 175, 55, 0.1);
}

/* Mobile menu button */
.mobile-menu-button:focus {
  outline: 2px solid #d4af37;
  outline-offset: 2px;
}

/* Cross-browser compatibility */
@supports (-webkit-backdrop-filter: none) or (backdrop-filter: none) {
  .glass-effect {
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

/* RTL support: keep layout and spacing consistent in Arabic/Dari */
/* Direction is also set via <html dir>, but we add a class for scoped overrides */
body.rtl {
  direction: rtl;
}

/* Text alignment swaps */
body.rtl .text-left {
  text-align: right !important;
}
body.rtl .text-right {
  text-align: left !important;
}

/* Common margin swaps */
body.rtl .ml-1 {
  margin-left: 0 !important;
  margin-right: 0.25rem !important;
}
body.rtl .ml-2 {
  margin-left: 0 !important;
  margin-right: 0.5rem !important;
}
body.rtl .ml-3 {
  margin-left: 0 !important;
  margin-right: 0.75rem !important;
}
body.rtl .ml-4 {
  margin-left: 0 !important;
  margin-right: 1rem !important;
}
body.rtl .mr-1 {
  margin-right: 0 !important;
  margin-left: 0.25rem !important;
}
body.rtl .mr-2 {
  margin-right: 0 !important;
  margin-left: 0.5rem !important;
}
body.rtl .mr-3 {
  margin-right: 0 !important;
  margin-left: 0.75rem !important;
}
body.rtl .mr-4 {
  margin-right: 0 !important;
  margin-left: 1rem !important;
}

/* Common padding swaps */
body.rtl .pl-2 {
  padding-left: 0 !important;
  padding-right: 0.5rem !important;
}
body.rtl .pl-3 {
  padding-left: 0 !important;
  padding-right: 0.75rem !important;
}
body.rtl .pl-4 {
  padding-left: 0 !important;
  padding-right: 1rem !important;
}
body.rtl .pr-2 {
  padding-right: 0 !important;
  padding-left: 0.5rem !important;
}
body.rtl .pr-3 {
  padding-right: 0 !important;
  padding-left: 0.75rem !important;
}
body.rtl .pr-4 {
  padding-right: 0 !important;
  padding-left: 1rem !important;
}

/* Border side swaps (as used in quotes/notes) */
body.rtl .border-l-4 {
  border-left-width: 0 !important;
  border-right-width: 4px !important;
}
body.rtl .border-r-4 {
  border-right-width: 0 !important;
  border-left-width: 4px !important;
}

/* Flex gap reversal for Tailwind space-x utilities */
/* Tailwind uses --tw-space-x-reverse variable; set it to 1 in RTL to flip */
body.rtl .space-x-0,
body.rtl .space-x-1,
body.rtl .space-x-2,
body.rtl .space-x-3,
body.rtl .space-x-4,
body.rtl .space-x-6,
body.rtl .space-x-8 {
  --tw-space-x-reverse: 1;
}

/* Ensure lists with list-inside align bullets properly */
body.rtl .list-inside {
  padding-right: 1rem;
  padding-left: 0;
}
