/* assets/css/app.css - Custom Styles & Tailwind Integration */
@import url("fonts.css");

:root {
  --accent-blue: #38bdf8;
  --accent-green: #34d399;
  --accent-purple: #c084fc;
  --accent-amber: #fbbf24;
  --accent-rose: #fb7185;
}

/* Light / Dark Mode Color Tokens */
html.dark {
  --bg-main: #0b1120;
  --bg-card: #0f172a;
  --bg-card-sub: #1e293b;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #38bdf8;
  --text-primary: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: #1e293b;
  --modal-bg: #0f172a;
  --table-hover: rgba(255, 255, 255, 0.03);
}

html:not(.dark) {
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-sub: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #0284c7;
  --text-primary: #0f172a;
  --text-muted: #64748b;
  --input-bg: #ffffff;
  --modal-bg: #ffffff;
  --table-hover: rgba(2, 132, 199, 0.04);
}

body {
  font-family:
    "Prompt",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  background-color: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background-color 0.25s ease,
    color 0.25s ease;
}

/* Background Gradients */
html.dark body {
  background-image:
    radial-gradient(at 10% 10%, rgba(14, 165, 233, 0.1) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(52, 211, 153, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
}

html:not(.dark) body {
  background-image:
    radial-gradient(at 10% 10%, rgba(14, 165, 233, 0.05) 0px, transparent 50%),
    radial-gradient(at 90% 80%, rgba(52, 211, 153, 0.03) 0px, transparent 50%);
  background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* Glassmorphism Classes */
.glass-nav {
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.glass-card {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* DataTables Styling for Tailwind */
.dataTables_wrapper {
  width: 100%;
}
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: 0.875rem;
  color: var(--text-muted) !important;
  padding: 0.75rem 0;
}

.dataTables_wrapper .dataTables_filter input {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.35rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
  transition: all 0.2s ease;
}
.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.dataTables_wrapper .dataTables_length select {
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.35rem 1.75rem 0.35rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}

table.dataTable {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
table.dataTable thead th {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent-blue) !important;
  border-bottom: 1px solid var(--border-color) !important;
  padding: 0.75rem 1rem !important;
}
html:not(.dark) table.dataTable thead th {
  color: #0284c7 !important;
}

table.dataTable tbody td {
  padding: 0.85rem 1rem !important;
  border-bottom: 1px solid var(--border-color) !important;
  color: var(--text-primary);
  font-size: 0.9rem;
}
table.dataTable tbody tr:hover {
  background-color: var(--table-hover) !important;
}

/* DataTables Pagination Buttons */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 0.5rem !important;
  padding: 0.3rem 0.75rem !important;
  margin: 0 2px !important;
  font-size: 0.85rem !important;
  border: 1px solid var(--border-color) !important;
  background: var(--input-bg) !important;
  color: var(--text-primary) !important;
  cursor: pointer;
  transition: all 0.15s ease;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

/* Modals */
.modal-overlay {
  background-color: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-container.hidden {
  display: none !important;
}

.modal-container:not(.hidden) {
  display: flex !important;
}

/* ==========================================================================
   Modern SweetAlert2 Styling (Isolate Modals vs Toasts)
   ========================================================================== */

/* 1. Modal Dialogs (Alert & Confirm Modals only) */
.swal2-popup:not(.swal2-toast) {
  border-radius: 1.5rem !important;
  font-family:
    "Prompt",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif !important;
  padding: 1.75rem 1.5rem 1.5rem !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon {
  width: 4.75rem !important;
  height: 4.75rem !important;
  margin: 1rem auto 1.25rem !important;
  border-radius: 9999px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-width: 2px !important;
  border-style: solid !important;
  transition: all 0.25s ease !important;
}

.swal2-popup:not(.swal2-toast) .swal2-icon .swal2-icon-content {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 2rem !important;
  line-height: 1 !important;
}

/* Modal Question Icon Badge */
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question,
.swal2-popup:not(.swal2-toast) .swal2-icon.icon-question {
  border-color: rgba(14, 165, 233, 0.4) !important;
  color: #0284c7 !important;
  background-color: rgba(14, 165, 233, 0.08) !important;
  box-shadow:
    0 0 0 6px rgba(14, 165, 233, 0.08),
    0 8px 24px -4px rgba(14, 165, 233, 0.15) !important;
}
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-question,
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.icon-question {
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
  background-color: rgba(56, 189, 248, 0.12) !important;
  box-shadow:
    0 0 0 6px rgba(56, 189, 248, 0.1),
    0 8px 28px -4px rgba(56, 189, 248, 0.25) !important;
}

/* Modal Telegram / Notify Icon Badge */
.swal2-popup:not(.swal2-toast) .swal2-icon.icon-notify,
.swal2-popup:not(.swal2-toast) .swal2-icon.icon-telegram {
  border-color: rgba(2, 132, 199, 0.4) !important;
  color: #0284c7 !important;
  background-color: rgba(2, 132, 199, 0.08) !important;
  box-shadow:
    0 0 0 6px rgba(2, 132, 199, 0.08),
    0 8px 24px -4px rgba(2, 132, 199, 0.2) !important;
}
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.icon-notify,
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.icon-telegram {
  border-color: rgba(56, 189, 248, 0.4) !important;
  color: #38bdf8 !important;
  background-color: rgba(56, 189, 248, 0.12) !important;
  box-shadow:
    0 0 0 6px rgba(56, 189, 248, 0.1),
    0 8px 28px -4px rgba(56, 189, 248, 0.3) !important;
}

/* Modal Warning Icon Badge */
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning,
.swal2-popup:not(.swal2-toast) .swal2-icon.icon-warning {
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #d97706 !important;
  background-color: rgba(245, 158, 11, 0.08) !important;
  box-shadow:
    0 0 0 6px rgba(245, 158, 11, 0.08),
    0 8px 24px -4px rgba(245, 158, 11, 0.15) !important;
}
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-warning,
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.icon-warning {
  border-color: rgba(251, 191, 36, 0.4) !important;
  color: #fbbf24 !important;
  background-color: rgba(251, 191, 36, 0.12) !important;
  box-shadow:
    0 0 0 6px rgba(251, 191, 36, 0.1),
    0 8px 28px -4px rgba(251, 191, 36, 0.25) !important;
}

/* Modal Danger / Cancel Icon Badge */
.swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error,
.swal2-popup:not(.swal2-toast) .swal2-icon.icon-danger {
  border-color: rgba(244, 63, 94, 0.4) !important;
  color: #e11d48 !important;
  background-color: rgba(244, 63, 94, 0.08) !important;
  box-shadow:
    0 0 0 6px rgba(244, 63, 94, 0.08),
    0 8px 24px -4px rgba(244, 63, 94, 0.15) !important;
}
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.swal2-error,
html.dark .swal2-popup:not(.swal2-toast) .swal2-icon.icon-danger {
  border-color: rgba(251, 113, 133, 0.4) !important;
  color: #fb7185 !important;
  background-color: rgba(251, 113, 133, 0.12) !important;
  box-shadow:
    0 0 0 6px rgba(251, 113, 133, 0.1),
    0 8px 28px -4px rgba(251, 113, 133, 0.25) !important;
}

/* Modal Actions Buttons */
.swal2-popup:not(.swal2-toast) .swal2-actions {
  gap: 0.75rem !important;
  margin-top: 1.5rem !important;
}
.swal2-popup:not(.swal2-toast) .swal2-styled {
  border-radius: 0.75rem !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  padding: 0.625rem 1.25rem !important;
  margin: 0 !important;
  transition: all 0.2s ease !important;
}

/* ==========================================================================
   2. Toast Notifications: Top-Right Glassmorphism Pill (Compact & High Contrast)
   ========================================================================== */
body.swal2-toast-shown .swal2-container,
.swal2-container.swal2-top-end,
.swal2-container.swal2-top-right {
  position: fixed !important;
  top: 4.75rem !important; /* Original height below the profile name & h-16 navbar */
  right: 0.75rem !important; /* Crisp & compact right alignment (12px) */
  bottom: auto !important;
  left: auto !important;
  width: auto !important;
  max-width: calc(100vw - 1.5rem) !important;
  height: auto !important;
  padding: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  pointer-events: none !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: flex-start !important;
}

.swal2-popup.swal2-toast {
  position: relative !important;
  overflow: hidden !important;
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  grid-template-rows: auto auto !important;
  column-gap: 0.75rem !important;
  row-gap: 0.15rem !important;
  align-items: center !important;
  width: auto !important;
  min-width: 17rem !important;
  max-width: 25rem !important;
  padding: 0.75rem 1rem !important;
  border-radius: 1rem !important;
  font-family:
    "Prompt",
    -apple-system,
    BlinkMacSystemFont,
    sans-serif !important;
  margin: 0 0 0.5rem 0 !important;
  pointer-events: auto !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  box-sizing: border-box !important;
}

.swal2-popup.swal2-toast.swal2-show {
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

.swal2-popup.swal2-toast.swal2-hide {
  animation: toastSlideOut 0.2s ease-in forwards !important;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
}

/* Dark Mode Toast */
html.dark .swal2-popup.swal2-toast {
  background-color: rgba(15, 23, 42, 0.94) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  box-shadow:
    0 20px 25px -5px rgba(0, 0, 0, 0.5),
    0 8px 10px -6px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  color: #f8fafc !important;
}

/* Light Mode Toast */
html:not(.dark) .swal2-popup.swal2-toast {
  background-color: rgba(255, 255, 255, 0.97) !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow:
    0 14px 28px -4px rgba(15, 23, 42, 0.14),
    0 4px 10px -2px rgba(15, 23, 42, 0.08) !important;
  color: #0f172a !important;
}

/* Toast Soft Icon Badge */
.swal2-popup.swal2-toast .swal2-icon {
  grid-column: 1 !important;
  grid-row: 1 / -1 !important;
  align-self: center !important;
  width: 2.25rem !important;
  height: 2.25rem !important;
  min-width: 2.25rem !important;
  margin: 0 !important;
  border-radius: 0.75rem !important;
  border-width: 1.5px !important;
  border-style: solid !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  padding: 0 !important;
  flex-shrink: 0 !important;
}

.swal2-popup.swal2-toast .swal2-icon .swal2-icon-content {
  font-size: 1.05rem !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Toast Icon Accents */
.swal2-popup.swal2-toast .swal2-icon.swal2-success {
  border-color: rgba(16, 185, 129, 0.4) !important;
  color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.12) !important;
}
.swal2-popup.swal2-toast .swal2-icon.swal2-error {
  border-color: rgba(244, 63, 94, 0.4) !important;
  color: #f43f5e !important;
  background-color: rgba(244, 63, 94, 0.12) !important;
}
.swal2-popup.swal2-toast .swal2-icon.swal2-warning {
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #f59e0b !important;
  background-color: rgba(245, 158, 11, 0.12) !important;
}
.swal2-popup.swal2-toast .swal2-icon.swal2-info {
  border-color: rgba(14, 165, 233, 0.4) !important;
  color: #0ea5e9 !important;
  background-color: rgba(14, 165, 233, 0.12) !important;
}

/* Typography inside Toast */
.swal2-popup.swal2-toast .swal2-title {
  grid-column: 2 !important;
  grid-row: 1 !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.3 !important;
  text-align: left !important;
  word-break: break-word !important;
}
html.dark .swal2-popup.swal2-toast .swal2-title {
  color: #f8fafc !important;
}
html:not(.dark) .swal2-popup.swal2-toast .swal2-title {
  color: #0f172a !important;
}

.swal2-popup.swal2-toast .swal2-html-container {
  grid-column: 2 !important;
  grid-row: 2 !important;
  font-size: 0.8rem !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.35 !important;
  text-align: left !important;
  word-break: break-word !important;
}
.swal2-popup.swal2-toast .swal2-html-container:empty {
  display: none !important;
}
html.dark .swal2-popup.swal2-toast .swal2-html-container {
  color: #94a3b8 !important;
}
html:not(.dark) .swal2-popup.swal2-toast .swal2-html-container {
  color: #475569 !important;
}

/* If html-container is empty or missing, title takes full vertical height */
.swal2-popup.swal2-toast:has(.swal2-html-container:empty) .swal2-title {
  grid-row: 1 / -1 !important;
}

/* Close Button inside Toast */
.swal2-popup.swal2-toast .swal2-close {
  grid-column: 3 !important;
  grid-row: 1 / -1 !important;
  align-self: center !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  font-size: 1.15rem !important;
  margin: 0 0 0 0.25rem !important;
  color: #94a3b8 !important;
  border-radius: 0.5rem !important;
  transition: all 0.15s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}
.swal2-popup.swal2-toast .swal2-close:hover {
  color: #f43f5e !important;
  background-color: rgba(244, 63, 94, 0.1) !important;
}

/* Timer Progress Bar Container & Vibrant Status Bar */
.swal2-popup.swal2-toast .swal2-timer-progress-bar-container {
  position: absolute !important;
  right: 0 !important;
  bottom: 0 !important;
  left: 0 !important;
  height: 3.5px !important;
  overflow: hidden !important;
  border-radius: 0 0 1rem 1rem !important;
  background: rgba(148, 163, 184, 0.2) !important;
}

.swal2-popup.swal2-toast .swal2-timer-progress-bar {
  height: 100% !important;
  border-radius: 0 0 1rem 1rem !important;
  background-color: #38bdf8 !important;
}

/* Vibrant Status-Specific Color Gradients */
.swal2-popup.swal2-toast:has(.swal2-icon.swal2-success) .swal2-timer-progress-bar,
.swal2-popup.swal2-toast.swal2-icon-success .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #10b981, #34d399) !important;
}

.swal2-popup.swal2-toast:has(.swal2-icon.swal2-error) .swal2-timer-progress-bar,
.swal2-popup.swal2-toast.swal2-icon-error .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #f43f5e, #fb7185) !important;
}

.swal2-popup.swal2-toast:has(.swal2-icon.swal2-warning) .swal2-timer-progress-bar,
.swal2-popup.swal2-toast.swal2-icon-warning .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #f59e0b, #fbbf24) !important;
}

.swal2-popup.swal2-toast:has(.swal2-icon.swal2-info) .swal2-timer-progress-bar,
.swal2-popup.swal2-toast.swal2-icon-info .swal2-timer-progress-bar {
  background: linear-gradient(90deg, #0ea5e9, #38bdf8) !important;
}

/* ==========================================================================
   Light Mode High-Contrast & Readability Enhancements
   ========================================================================== */
html:not(.dark) {
  color: #0f172a;
}

/* Ensure secondary and muted text is crisp and WCAG AA accessible */
html:not(.dark) .text-slate-400 {
  color: #475569 !important; /* Upgraded from #94a3b8 to deep slate #475569 */
}

html:not(.dark) .text-slate-500 {
  color: #334155 !important; /* Upgraded from #64748b to #334155 */
}

/* Table Headers in Light Mode */
html:not(.dark) thead th,
html:not(.dark) table thead tr th {
  color: #0f172a !important;
  font-weight: 600 !important;
  background-color: #f1f5f9;
  border-bottom: 2px solid #cbd5e1 !important;
}

/* Table Cells in Light Mode */
html:not(.dark) table tbody td {
  color: #0f172a;
  border-bottom-color: #e2e8f0;
}

html:not(.dark) table tbody tr:hover {
  background-color: #f1f5f9 !important;
}

/* Badge Enhancements for Light Mode */
html:not(.dark) .bg-amber-100 {
  background-color: #fef3c7 !important;
  color: #78350f !important;
  border: 1px solid #fcd34d !important;
  font-weight: 600 !important;
}

html:not(.dark) .bg-emerald-100 {
  background-color: #d1fae5 !important;
  color: #064e3b !important;
  border: 1px solid #6ee7b7 !important;
  font-weight: 600 !important;
}

html:not(.dark) .bg-rose-100 {
  background-color: #ffe4e6 !important;
  color: #881337 !important;
  border: 1px solid #fda4af !important;
  font-weight: 600 !important;
}

html:not(.dark) .bg-sky-100 {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #7dd3fc !important;
  font-weight: 600 !important;
}

html:not(.dark) .bg-slate-100 {
  background-color: #f1f5f9 !important;
  color: #1e293b !important;
  border: 1px solid #cbd5e1 !important;
}

/* Light mode card borders and shadows */
html:not(.dark) .border-slate-200 {
  border-color: #cbd5e1 !important;
}

/* Form Inputs and Selects in Light Mode */
html:not(.dark) input:not([type="checkbox"]):not([type="radio"]),
html:not(.dark) select,
html:not(.dark) textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}

html:not(.dark) input::placeholder,
html:not(.dark) textarea::placeholder {
  color: #64748b !important;
}

/* Breadcrumb & Subtitle Headings in Light Mode */
html:not(.dark) p.text-slate-500 {
  color: #334155 !important;
}

/* Modal text contrast in Light Mode */
html:not(.dark) .modal-container strong {
  color: #1e293b !important;
}
