/* Light and Dark mode color variables for alerts/modals */
:root{
  --ds-surface:#f0fdf4;--ds-text:#166534;--ds-shadow:rgba(0,0,0,0.15);
  --ds-border:rgba(22,101,52,0.2);
  --ds-info:#0ea5e9;--ds-success:#22c55e;--ds-warning:#f59e0b;--ds-error:#ef4444;
  /* Light mode modal colors */
  --ds-modal-bg: #ffffff;
  --ds-modal-text: #1f2937;
  --ds-modal-border: rgba(31, 41, 55, 0.1);
}
[data-bs-theme="dark"],[data-rehlati-theme="dark"],.dark,.dark-mode{
  --ds-surface:#0f2415;--ds-text:#dcfce7;--ds-shadow:rgba(0,0,0,0.5);
  --ds-border:rgba(220,252,231,0.2);
  /* Dark mode modal colors - Slate Green theme */
  --ds-modal-bg: #1e293b;
  --ds-modal-text: #e2e8f0;
  --ds-modal-border: rgba(148, 163, 184, 0.2);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme]){--ds-surface:#152621;--ds-text:#e8f2f0;--ds-shadow:rgba(0,0,0,0.5);--ds-border:rgba(255,255,255,0.08)}
}

/* SweetAlert2 toast theming */
.swal2-container.ds-swal-container{z-index:1080!important}
.swal2-container.swal2-top-end{z-index:1080!important}
.swal2-popup.swal2-toast.ds-swal-toast{
  background:var(--ds-surface)!important;color:var(--ds-text)!important;border-radius:12px;
  border:1px solid var(--ds-border);box-shadow:0 10px 30px var(--ds-shadow);
  backdrop-filter:saturate(180%) blur(10px);padding:10px 14px
}
.ds-swal-title{font-weight:600;color:var(--ds-text)!important}
.ds-swal-text{color:var(--ds-text)!important;opacity:.9}
.swal2-timer-progress-bar{background:linear-gradient(90deg,rgba(255,255,255,.35),rgba(255,255,255,.15))}
.swal2-icon.swal2-success{border-color:var(--ds-success)!important;color:var(--ds-success)!important}
.swal2-icon.swal2-info{border-color:var(--ds-info)!important;color:var(--ds-info)!important}
.swal2-icon.swal2-warning{border-color:var(--ds-warning)!important;color:var(--ds-warning)!important}
.swal2-icon.swal2-error{border-color:var(--ds-error)!important;color:var(--ds-error)!important}

/* SweetAlert2 modal theming - Override default black/purple colors */
.swal2-popup.ds-swal-modal{
  background:var(--ds-modal-bg)!important;
  color:var(--ds-modal-text)!important;
  border-radius:14px;
  border:1px solid var(--ds-modal-border);
  box-shadow:0 12px 40px var(--ds-shadow)
}
.swal2-confirm.ds-swal-confirm{
  background:var(--ds-info)!important;
  border:none;
  color: #ffffff !important;
}
.swal2-cancel.ds-swal-cancel{
  background:transparent!important;
  color:var(--ds-text)!important;
  border:1px solid var(--ds-border)!important
}

/* CRITICAL: Override SweetAlert2 default colors (removes black/purple) */
.swal2-popup {
  background: var(--ds-modal-bg) !important;
  color: var(--ds-modal-text) !important;
  border: 1px solid var(--ds-modal-border) !important;
}

.swal2-title {
  color: var(--ds-modal-text) !important;
}

.swal2-html-container {
  color: var(--ds-modal-text) !important;
  opacity: 0.9;
}

/* Light mode - Clean white background with proper contrast */
:root .swal2-popup,
[data-bs-theme="light"] .swal2-popup {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-color: rgba(31, 41, 55, 0.15) !important;
}

/* Dark mode optimizations for SweetAlert2 elements - Slate Green */
[data-bs-theme="dark"] .swal2-popup,
[data-rehlati-theme="dark"] .swal2-popup,
body.dark-mode .swal2-popup {
  background: #1e293b !important; /* Slate 800 */
  color: #e2e8f0 !important; /* Slate 200 */
  border-color: rgba(148, 163, 184, 0.2) !important; /* Slate 400 */
}

[data-bs-theme="dark"] .swal2-title,
[data-rehlati-theme="dark"] .swal2-title,
body.dark-mode .swal2-title {
  color: #f1f5f9 !important; /* Slate 100 */
}

[data-bs-theme="dark"] .swal2-html-container,
[data-rehlati-theme="dark"] .swal2-html-container,
body.dark-mode .swal2-html-container {
  color: #cbd5e1 !important; /* Slate 300 */
}

/* Light mode inputs */
.swal2-input,
.swal2-textarea,
.swal2-select {
  background: #ffffff !important;
  color: #1f2937 !important;
  border-color: rgba(209, 213, 219, 0.8) !important; /* Gray 300 */
}

.swal2-input:focus,
.swal2-textarea:focus,
.swal2-select:focus {
  border-color: #0ea5e9 !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1) !important;
}

/* Dark mode inputs - Slate theme */
[data-bs-theme="dark"] .swal2-input,
[data-rehlati-theme="dark"] .swal2-input,
body.dark-mode .swal2-input {
  background: rgba(51, 65, 85, 0.8) !important; /* Slate 700 */
  color: #e2e8f0 !important;
  border-color: rgba(100, 116, 139, 0.5) !important; /* Slate 500 */
}

[data-bs-theme="dark"] .swal2-input:focus,
}

[data-bs-theme="dark"] .swal2-select,
[data-rehlati-theme="dark"] .swal2-select,
body.dark-mode .swal2-select {
  background: rgba(51, 65, 85, 0.8) !important; /* Slate 700 */
  color: #e2e8f0 !important;
  border-color: rgba(100, 116, 139, 0.5) !important; /* Slate 500 */
}

[data-bs-theme="dark"] .swal2-checkbox,
[data-rehlati-theme="dark"] .swal2-checkbox,
body.dark-mode .swal2-checkbox {
  background: rgba(51, 65, 85, 0.8) !important;
  border-color: rgba(100, 116, 139, 0.5) !important;
}

[data-bs-theme="dark"] .swal2-radio,
[data-rehlati-theme="dark"] .swal2-radio,
body.dark-mode .swal2-radio {
  background: rgba(51, 65, 85, 0.8) !important;
  border-color: rgba(100, 116, 139, 0.5) !important;
}

[data-bs-theme="dark"] .swal2-textarea,
[data-rehlati-theme="dark"] .swal2-textarea,
body.dark-mode .swal2-textarea {
  background: rgba(51, 65, 85, 0.8) !important;
  color: #e2e8f0 !important;
  border-color: rgba(100, 116, 139, 0.5) !important;
}

/* Modal backdrop for dark mode */
[data-bs-theme="dark"] .swal2-container,
[data-rehlati-theme="dark"] .swal2-container,
body.dark-mode .swal2-container {
  background: rgba(15, 23, 42, 0.75) !important; /* Slate 900 with transparency */
}

/* Close button styling */
.swal2-close {
  color: #6b7280 !important;
}

.swal2-close:hover {
  color: #374151 !important;
}

[data-bs-theme="dark"] .swal2-close,
[data-rehlati-theme="dark"] .swal2-close,
body.dark-mode .swal2-close {
  color: #94a3b8 !important; /* Slate 400 */
}

[data-bs-theme="dark"] .swal2-close:hover,
[data-rehlati-theme="dark"] .swal2-close:hover,
body.dark-mode .swal2-close:hover {
  color: #cbd5e1 !important; /* Slate 300 */
}

.swal2-deny {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.swal2-deny:hover {
  background: #dc2626 !important;
}

.swal2-cancel {
  background: transparent !important;
  color: #6b7280 !important;
  border: 1px solid rgba(107, 114, 128, 0.3) !important;
}

.swal2-cancel:hover {
  background: rgba(107, 114, 128, 0.1) !important;
}

/* Dark mode button improvements */
[data-bs-theme="dark"] .swal2-confirm,
[data-rehlati-theme="dark"] .swal2-confirm,
body.dark-mode .swal2-confirm {
  background: #10b981 !important; /* Emerald 500 */
  color: #ffffff !important;
}

[data-bs-theme="dark"] .swal2-confirm:hover,
[data-rehlati-theme="dark"] .swal2-confirm:hover,
body.dark-mode .swal2-confirm:hover {
  background: #059669 !important; /* Emerald 600 */
}

/* Override default SweetAlert2 button colors (removes purple) */
.swal2-confirm {
  background: #10b981 !important; /* Emerald 500 - Green */
  color: #ffffff !important;
}

.swal2-confirm:hover {
  background: #059669 !important; /* Emerald 600 */
}

[data-bs-theme="dark"] .swal2-deny,
[data-rehlati-theme="dark"] .swal2-deny,
body.dark-mode .swal2-deny {
  background: #ef4444 !important;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .swal2-deny:hover,
[data-rehlati-theme="dark"] .swal2-deny:hover,
body.dark-mode .swal2-deny:hover {
  background: #dc2626 !important;
}

[data-bs-theme="dark"] .swal2-cancel,
[data-rehlati-theme="dark"] .swal2-cancel,
body.dark-mode .swal2-cancel {
  background: transparent !important;
  color: #cbd5e1 !important; /* Slate 300 */
  border: 1px solid rgba(148, 163, 184, 0.4) !important; /* Slate 400 */
}

[data-bs-theme="dark"] .swal2-cancel:hover,
[data-rehlati-theme="dark"] .swal2-cancel:hover,
body.dark-mode .swal2-cancel:hover {
  background: rgba(71, 85, 105, 0.2) !important; /* Slate 600 */
}