/* ==========================================================================
   Ewebbers Studio - Modern Night/Day Theme & Accessibility Stylesheet
   Designed with High Accessibility & Eye-Comfort Standards (WCAG 2.1 AA Compliant)
   ========================================================================== */

:root {
  /* Common Brand Colors */
  --ew-primary: #0d6efd;
  --ew-primary-hover: #0b5ed7;
  --ew-accent: #00d2ff;
  --ew-transition-speed: 0.3s;

  /* Day Mode (Light Theme - Soft & High Readability) */
  --ew-bg-base: #f8fafc;
  --ew-bg-surface: #ffffff;
  --ew-bg-card: #ffffff;
  --ew-bg-alt: #f1f5f9;
  --ew-bg-subtle: #e2e8f0;
  
  --ew-text-primary: #0f172a;
  --ew-text-secondary: #475569;
  --ew-text-muted: #64748b;
  --ew-text-inverse: #ffffff;

  --ew-border-color: rgba(0, 0, 0, 0.08);
  --ew-border-subtle: rgba(0, 0, 0, 0.04);
  --ew-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --ew-card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
  
  --ew-nav-bg: rgba(255, 255, 255, 0.95);
  --ew-nav-text: #1e293b;
  --ew-nav-border: #e2e8f0;

  --ew-footer-bg: #0a192f;
  --ew-footer-text: #ffffff;
}

/* ==========================================================================
   Night Mode (Dark Theme - Deep Navy & Slate, Eye-Relaxing, Zero Glare)
   ========================================================================== */
[data-bs-theme="dark"],
[data-theme="dark"] {
  --ew-bg-base: #0b1120;        /* Deep slate/midnight */
  --ew-bg-surface: #131c31;     /* Surface layer */
  --ew-bg-card: #18233c;        /* Elevated cards */
  --ew-bg-alt: #0e1628;         /* Alternate sections */
  --ew-bg-subtle: #243252;
  
  --ew-text-primary: #f8fafc;
  --ew-text-secondary: #cbd5e1;
  --ew-text-muted: #94a3b8;
  --ew-text-inverse: #0f172a;

  --ew-border-color: rgba(255, 255, 255, 0.12);
  --ew-border-subtle: rgba(255, 255, 255, 0.06);
  --ew-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --ew-card-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.6);

  --ew-nav-bg: rgba(11, 17, 32, 0.95);
  --ew-nav-text: #f8fafc;
  --ew-nav-border: rgba(255, 255, 255, 0.1);

  --ew-footer-bg: #070b14;
  --ew-footer-text: #e2e8f0;
}

/* Smooth Transition on Theme Switch */
body {
  transition: background-color var(--ew-transition-speed) ease, color var(--ew-transition-speed) ease;
}

/* Base Body Application */
[data-bs-theme="dark"] body,
[data-theme="dark"] body {
  background-color: var(--ew-bg-base) !important;
  color: var(--ew-text-primary) !important;
}

/* Dark Mode Overrides for Core UI Elements */
[data-bs-theme="dark"] .bg-white,
[data-theme="dark"] .bg-white {
  background-color: var(--ew-bg-surface) !important;
  color: var(--ew-text-primary) !important;
}

[data-bs-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light {
  background-color: var(--ew-bg-alt) !important;
  color: var(--ew-text-primary) !important;
}

[data-bs-theme="dark"] section[style*="#f8f9fa"],
[data-bs-theme="dark"] section[style*="background-color: #f8f9fa"],
[data-theme="dark"] section[style*="#f8f9fa"],
[data-theme="dark"] section[style*="background-color: #f8f9fa"] {
  background-color: var(--ew-bg-alt) !important;
}

[data-bs-theme="dark"] .card,
[data-theme="dark"] .card {
  background-color: var(--ew-bg-card) !important;
  border-color: var(--ew-border-color) !important;
  color: var(--ew-text-primary) !important;
  box-shadow: var(--ew-card-shadow) !important;
}

[data-bs-theme="dark"] .card-footer,
[data-theme="dark"] .card-footer {
  background-color: var(--ew-bg-card) !important;
  border-color: var(--ew-border-color) !important;
}

[data-bs-theme="dark"] .text-dark,
[data-theme="dark"] .text-dark {
  color: var(--ew-text-primary) !important;
}

[data-bs-theme="dark"] .text-muted,
[data-theme="dark"] .text-muted {
  color: var(--ew-text-muted) !important;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-start,
[data-bs-theme="dark"] .border-end,
[data-theme="dark"] .border,
[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom {
  border-color: var(--ew-border-color) !important;
}

/* Navbar in Dark Mode */
[data-bs-theme="dark"] .navbar.bg-white,
[data-theme="dark"] .navbar.bg-white,
[data-bs-theme="dark"] #siteHeader nav,
[data-theme="dark"] #siteHeader nav {
  background-color: var(--ew-nav-bg) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--ew-nav-border) !important;
}

[data-bs-theme="dark"] .navbar .nav-link,
[data-theme="dark"] .navbar .nav-link {
  color: var(--ew-nav-text) !important;
}

[data-bs-theme="dark"] .navbar .nav-link:hover,
[data-theme="dark"] .navbar .nav-link:hover {
  color: var(--ew-accent) !important;
}

/* Inputs & Form Controls in Dark Mode */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #0e1628 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  color: #f8fafc !important;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25) !important;
}

/* Tables in Dark Mode */
[data-bs-theme="dark"] .table,
[data-theme="dark"] .table {
  color: var(--ew-text-primary) !important;
  border-color: var(--ew-border-color) !important;
}

[data-bs-theme="dark"] .table > :not(caption) > * > *,
[data-theme="dark"] .table > :not(caption) > * > * {
  background-color: transparent;
  color: inherit;
  border-color: var(--ew-border-color) !important;
}

/* Admin Dashboard in Dark Mode */
[data-bs-theme="dark"] .admin-header,
[data-theme="dark"] .admin-header {
  background-color: var(--ew-bg-surface) !important;
  border-bottom: 1px solid var(--ew-border-color) !important;
  color: var(--ew-text-primary) !important;
}

[data-bs-theme="dark"] .admin-header h5,
[data-theme="dark"] .admin-header h5 {
  color: var(--ew-text-primary) !important;
}

/* ==========================================================================
   Day/Night Toggle Button Styles
   ========================================================================== */
.ew-theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--ew-border-color);
  background: var(--ew-bg-surface);
  color: var(--ew-text-primary);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.ew-theme-toggle-btn:hover {
  transform: scale(1.1);
  border-color: var(--ew-primary);
  color: var(--ew-primary);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.25);
}

.ew-theme-toggle-btn i {
  font-size: 1.15rem;
  transition: transform 0.4s ease;
}

[data-bs-theme="dark"] .ew-theme-toggle-btn i.bi-moon-stars-fill {
  display: none;
}
[data-bs-theme="dark"] .ew-theme-toggle-btn i.bi-sun-fill {
  display: inline-block !important;
  color: #fbbf24;
}

[data-bs-theme="light"] .ew-theme-toggle-btn i.bi-sun-fill,
:root:not([data-bs-theme="dark"]) .ew-theme-toggle-btn i.bi-sun-fill {
  display: none;
}
[data-bs-theme="light"] .ew-theme-toggle-btn i.bi-moon-stars-fill,
:root:not([data-bs-theme="dark"]) .ew-theme-toggle-btn i.bi-moon-stars-fill {
  display: inline-block !important;
  color: #3b82f6;
}

/* ==========================================================================
   Day / Night Responsive Brand Logo Switching
   - On white / light backgrounds: show Day logo (ewebbersstudio-daymode-logo.png)
   - On dark / night backgrounds: show Night logo (ewebbersstudio-nightmode-logo.png)
   ========================================================================== */
.ew-logo-day {
  display: inline-block !important;
}
.ew-logo-night {
  display: none !important;
}

[data-bs-theme="dark"] .ew-logo-day,
[data-theme="dark"] .ew-logo-day {
  display: none !important;
}

[data-bs-theme="dark"] .ew-logo-night,
[data-theme="dark"] .ew-logo-night {
  display: inline-block !important;
}

/* Specific dark background sections (e.g. sidebar, footer, dark hero) always use night logo */
.sidebar .ew-logo-night,
.ew-footer .ew-logo-night,
.bg-dark .ew-logo-night,
.bg-black .ew-logo-night,
.ew-dark-bg .ew-logo-night {
  display: inline-block !important;
}

.sidebar .ew-logo-day,
.ew-footer .ew-logo-day,
.bg-dark .ew-logo-day,
.bg-black .ew-logo-day,
.ew-dark-bg .ew-logo-day {
  display: none !important;
}

/* ==========================================================================
   Accessibility Floating Trigger & Menu (Disability Options)
   ========================================================================== */

/* Floating Button (Side Trigger) - Perfectly Aligned & Sized with Chat Support Button */
.ew-a11y-trigger {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1060;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #0d6efd;
  color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 8px 25px rgba(13, 110, 253, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

html[dir="rtl"] .ew-a11y-trigger {
  left: 24px;
  right: auto;
}

.ew-a11y-trigger:hover {
  transform: scale(1.08);
  background: #0b5ed7;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(13, 110, 253, 0.6);
}

.ew-a11y-trigger i {
  font-size: 1.65rem;
  line-height: 1;
}

/* Accessibility Offcanvas Modal / Drawer */
.ew-a11y-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 360px;
  max-width: 90vw;
  background: #ffffff;
  color: #1e293b;
  z-index: 1070;
  box-shadow: 5px 0 35px rgba(0, 0, 0, 0.25);
  transform: translateX(-105%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

html[dir="rtl"] .ew-a11y-panel {
  left: auto;
  right: 0;
  transform: translateX(105%);
  box-shadow: -5px 0 35px rgba(0, 0, 0, 0.25);
}

.ew-a11y-panel.is-open {
  transform: translateX(0) !important;
}

/* Backdrop */
.ew-a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1065;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.ew-a11y-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

/* Dark theme inside panel */
[data-bs-theme="dark"] .ew-a11y-panel {
  background: #10182b;
  color: #f8fafc;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}
html[dir="rtl"][data-bs-theme="dark"] .ew-a11y-panel {
  border-right: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

/* Panel Header */
.ew-a11y-header {
  padding: 1.15rem 1.25rem;
  background: #0d6efd;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ew-a11y-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  text-transform: none;
}

.ew-a11y-close {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.85;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ew-a11y-close:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* Panel Body */
.ew-a11y-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.ew-a11y-section-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  margin-top: 1rem;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-bs-theme="dark"] .ew-a11y-section-title {
  color: #94a3b8;
}

.ew-a11y-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 0.75rem;
}

.ew-a11y-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 0.5rem;
  background: #f1f5f9;
  color: #1e293b;
  border: 2px solid transparent;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  gap: 6px;
  transition: all 0.2s ease;
}

[data-bs-theme="dark"] .ew-a11y-btn {
  background: #18233c;
  color: #e2e8f0;
}

.ew-a11y-btn i {
  font-size: 1.35rem;
  color: #0d6efd;
}

[data-bs-theme="dark"] .ew-a11y-btn i {
  color: #60a5fa;
}

.ew-a11y-btn:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
}

[data-bs-theme="dark"] .ew-a11y-btn:hover {
  background: #243252;
}

.ew-a11y-btn.is-active {
  background: rgba(13, 110, 253, 0.12);
  border-color: #0d6efd;
  color: #0d6efd;
}

[data-bs-theme="dark"] .ew-a11y-btn.is-active {
  background: rgba(59, 130, 246, 0.2);
  border-color: #60a5fa;
  color: #93c5fd;
}

/* Panel Footer (Reset) */
.ew-a11y-footer {
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
}

[data-bs-theme="dark"] .ew-a11y-footer {
  background: #0b1120;
  border-color: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Active Accessibility Modes (Applied to <html> or <body>)
   ========================================================================== */

/* Font Size Scales */
html.a11y-font-lg {
  font-size: 112% !important;
}
html.a11y-font-xl {
  font-size: 124% !important;
}
html.a11y-font-xxl {
  font-size: 136% !important;
}

/* Text & Letter Spacing (Dyslexia Friendly) */
html.a11y-text-spacing * {
  letter-spacing: 0.12em !important;
  word-spacing: 0.25em !important;
  line-height: 2 !important;
}

/* Readable Dyslexic Font */
html.a11y-readable-font * {
  font-family: Arial, Tahoma, 'Segoe UI', sans-serif !important;
  font-weight: 500 !important;
}

/* High Contrast Mode */
html.a11y-high-contrast {
  filter: contrast(140%) !important;
}
html.a11y-high-contrast body {
  background: #000000 !important;
  color: #ffffff !important;
}
html.a11y-high-contrast .card,
html.a11y-high-contrast .navbar,
html.a11y-high-contrast section {
  background: #000000 !important;
  border: 1px solid #ffffff !important;
  color: #ffffff !important;
}
html.a11y-high-contrast h1, 
html.a11y-high-contrast h2, 
html.a11y-high-contrast h3, 
html.a11y-high-contrast h4,
html.a11y-high-contrast a {
  color: #ffff00 !important;
}

/* Grayscale Mode */
html.a11y-grayscale {
  filter: grayscale(100%) !important;
}

/* Invert Colors Mode */
html.a11y-invert {
  filter: invert(100%) hue-rotate(180deg) !important;
}
html.a11y-invert img,
html.a11y-invert video {
  filter: invert(100%) hue-rotate(180deg) !important;
}

/* Pause Animations (Reduced Motion) */
html.a11y-pause-animations *,
html.a11y-pause-animations *:before,
html.a11y-pause-animations *:after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Highlight Links */
html.a11y-highlight-links a {
  background-color: #ffeb3b !important;
  color: #000000 !important;
  text-decoration: underline !important;
  font-weight: 700 !important;
  padding: 0 3px !important;
  border-radius: 2px !important;
}

/* Big Cursor */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24" fill="%230d6efd" stroke="%23ffffff" stroke-width="2"><path d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"/></svg>'), auto !important;
}

/* Reading Mask / Guide */
#ewA11yReadingGuide {
  position: fixed;
  left: 0;
  width: 100%;
  height: 48px;
  background: rgba(255, 235, 59, 0.22);
  border-top: 2px solid #fbc02d;
  border-bottom: 2px solid #fbc02d;
  pointer-events: none;
  z-index: 999999;
  display: none;
  transform: translateY(-50%);
  transition: top 0.05s linear;
}

