/* =========================================================
   Apricus Dashboard Theme  —  Visual-only restyle
   Safe: no HTML / Python changes
   ========================================================= */

:root {
  --apricus-blue: #2563eb;
  --apricus-blue-dark: #1e3a8a;
  --apricus-orange: #f97316;
  --apricus-yellow: #facc15;
  --apricus-bg: #f9fafb;
  --apricus-surface: #ffffff;
  --apricus-border: #e5e7eb;
  --apricus-text: #0f172a;
}

/* ---------- GLOBAL ---------- */
body {
  background: var(--apricus-bg);
  color: var(--apricus-text);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  background: var(--apricus-bg);
}

/* ---------- DASHBOARD CARDS / TILES ---------- */
.tile,
.card,
div[class*="dashboard"] .bg-white,
div[class*="dashboard"] .shadow-xl {
  background: var(--apricus-surface) !important;
  border: 1px solid var(--apricus-border) !important;
  border-radius: 1rem !important;
  box-shadow: 0 6px 18px rgba(2,6,23,0.06);
  transition: all .25s ease;
}

.tile:hover,
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(2,6,23,0.12);
}

/* Headings inside cards */
.card h3, .tile h3, .card h2 {
  color: var(--apricus-blue-dark);
  font-weight: 600;
  margin-bottom: .25rem;
}

/* Paragraphs inside cards */
.card p, .tile p {
  color: #475569;
  font-size: .9rem;
}

/* ---------- HEADER & NAV ---------- */
header {
  background: linear-gradient(90deg, var(--apricus-yellow), var(--apricus-orange), var(--apricus-blue)) !important;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  color: #fff;
}

header h1 {
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}

/* ---------- SIDEBAR ---------- */
aside {
  background: linear-gradient(180deg, var(--apricus-blue-dark), #1e40af) !important;
  color: #e2e8f0 !important;
}

aside nav .menu-item {
  border-radius: .65rem;
  margin-bottom: .25rem;
  transition: background .2s ease, transform .2s ease;
}

aside nav .menu-item:hover {
  background: rgba(255,255,255,0.08);
  transform: translateX(2px);
}

aside nav .menu-item .icon {
  opacity: .9;
}

aside nav .menu-item.active,
aside nav .menu-item[aria-current="page"] {
  background: var(--apricus-blue);
  color: #fff !important;
  font-weight: 600;
}

/* ---------- BUTTONS ---------- */
.btn-primary,
.bg-blue-600 {
  background: var(--apricus-blue) !important;
  color: #fff !important;
  border-radius: .75rem;
  border: 1px solid var(--apricus-blue);
  transition: filter .2s ease;
}
.btn-primary:hover,
.bg-blue-600:hover { filter: brightness(0.95); }

/* ---------- TABLES ---------- */
table thead {
  background: #f1f5f9 !important;
  color: var(--apricus-text);
  font-weight: 600;
}
table th, table td {
  border-color: var(--apricus-border) !important;
  padding: .75rem .5rem !important;
}

/* ---------- STAT BOXES / KPI ---------- */
.stats-box {
  background: var(--apricus-surface);
  border: 1px solid var(--apricus-border);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 10px rgba(0,0,0,.04);
  transition: all .2s ease;
}
.stats-box:hover {
  background: linear-gradient(135deg, var(--apricus-yellow), var(--apricus-orange));
  color: #fff;
  transform: translateY(-4px);
}

/* ---------- TEXT ENHANCEMENT ---------- */
h2, h3, h4 {
  color: var(--apricus-blue-dark);
  font-weight: 600;
}
.text-muted { color: #64748b; }

/* ---------- FOOTER / SWITCH ---------- */
.relative.inline-block.text-left button {
  border-radius: .75rem;
  background: var(--apricus-surface);
  border: 1px solid var(--apricus-border);
  transition: background .2s ease;
}
.relative.inline-block.text-left button:hover {
  background: var(--apricus-bg);
}

/* ---------- ANIMATIONS ---------- */
.animate-tile-fade {
  animation: tileFade .6s ease;
}
@keyframes tileFade {
  from {opacity:0; transform:translateY(10px);}
  to {opacity:1; transform:translateY(0);}
}
/* ===== Universal Dashboard Tile Normaliser (works for Admin/Corporate/User) ===== */
/* Targets both <a> and <div> tiles inside grid containers, regardless of bg-* color. */

/* Base: apply consistent shape, depth, spacing */
main .grid > a,
main .grid > div {
  border-radius: 1rem !important;
  box-shadow: 0 8px 22px rgba(2,6,23,0.10) !important;
  transition: transform .22s ease, box-shadow .22s ease !important;
  overflow: hidden; /* for inner overlays */
  position: relative;
  min-height: 160px; /* makes all cards feel consistent */
}

/* Hover lift */
main .grid > a:hover,
main .grid > div:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 16px 34px rgba(2,6,23,0.20) !important;
}

/* Keep the existing Tailwind background colors, but ensure legible text on them */
main .grid > a[class*="bg-"],
main .grid > div[class*="bg-"] {
  color: #ffffff !important;
}

/* Headings & subtext on colored tiles */
main .grid > a[class*="bg-"] h2,
main .grid > a[class*="bg-"] h3,
main .grid > div[class*="bg-"] h2,
main .grid > div[class*="bg-"] h3 {
  color: #ffffff !important;
  font-weight: 700 !important;
  letter-spacing: .2px;
  text-shadow: 0 1px 2px rgba(0,0,0,.20);
}

main .grid > a[class*="bg-"] p,
main .grid > div[class*="bg-"] p {
  color: rgba(255,255,255,0.95) !important;
  font-weight: 500;
}

/* Optional subtle highlight overlay for colored tiles */
main .grid > a[class*="bg-"]::after,
main .grid > div[class*="bg-"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.08));
  mix-blend-mode: soft-light;
  opacity: .55;
}

/* Make neutral/white tiles match the Admin look as well */
main .grid > a.bg-white,
main .grid > div.bg-white,
main .grid > a.bg-gray-50,
main .grid > div.bg-gray-50 {
  background: var(--apricus-surface) !important;
  border: 1px solid var(--apricus-border) !important;
}

/* Universal inner layout polish */
main .grid > a > *,
main .grid > div > * {
  /* give the inner content consistent spacing even if template differs */
  padding-left: .25rem;
  padding-right: .25rem;
}

/* Responsive: keep consistency on smaller screens */
@media (max-width: 1024px) {
  main .grid > a,
  main .grid > div { min-height: 140px; }
}
@media (max-width: 640px) {
  main .grid > a,
  main .grid > div { min-height: 120px; }
}
/* === Restore Admin Dashboard White Font on Blue Tiles === */
main .grid > a.bg-blue-500,
main .grid > a.bg-blue-600,
main .grid > a.bg-blue-700,
main .grid > a.bg-blue-800,
main .grid > a.bg-blue-900,
main .grid > div.bg-blue-500,
main .grid > div.bg-blue-600,
main .grid > div.bg-blue-700,
main .grid > div.bg-blue-800,
main .grid > div.bg-blue-900 {
  color: #ffffff !important;
}

main .grid > a.bg-blue-500 h2,
main .grid > a.bg-blue-600 h2,
main .grid > a.bg-blue-700 h2,
main .grid > a.bg-blue-800 h2,
main .grid > a.bg-blue-900 h2,
main .grid > a.bg-blue-500 h3,
main .grid > a.bg-blue-600 h3,
main .grid > a.bg-blue-700 h3,
main .grid > a.bg-blue-800 h3,
main .grid > a.bg-blue-900 h3,
main .grid > div.bg-blue-500 h2,
main .grid > div.bg-blue-600 h2,
main .grid > div.bg-blue-700 h2,
main .grid > div.bg-blue-800 h2,
main .grid > div.bg-blue-900 h2,
main .grid > div.bg-blue-500 h3,
main .grid > div.bg-blue-600 h3,
main .grid > div.bg-blue-700 h3,
main .grid > div.bg-blue-800 h3,
main .grid > div.bg-blue-900 h3 {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

main .grid > a.bg-blue-500 p,
main .grid > a.bg-blue-600 p,
main .grid > a.bg-blue-700 p,
main .grid > a.bg-blue-800 p,
main .grid > a.bg-blue-900 p,
main .grid > div.bg-blue-500 p,
main .grid > div.bg-blue-600 p,
main .grid > div.bg-blue-700 p,
main .grid > div.bg-blue-800 p,
main .grid > div.bg-blue-900 p {
  color: rgba(255,255,255,0.95) !important;
}

/* --- Hard override of inline theme colors INSIDE blue tiles --- */
main .grid > a[class*="bg-blue-"] .text-blue-900,
main .grid > div[class*="bg-blue-"] .text-blue-900,
main .grid > a[class*="bg-blue-"] h1,
main .grid > a[class*="bg-blue-"] h2,
main .grid > a[class*="bg-blue-"] h3,
main .grid > div[class*="bg-blue-"] h1,
main .grid > div[class*="bg-blue-"] h2,
main .grid > div[class*="bg-blue-"] h3 {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

main .grid > a[class*="bg-blue-"] .text-gray-600,
main .grid > div[class*="bg-blue-"] .text-gray-600,
main .grid > a[class*="bg-blue-"] p,
main .grid > div[class*="bg-blue-"] p,
main .grid > a[class*="bg-blue-"] span,
main .grid > div[class*="bg-blue-"] span {
  color: rgba(255,255,255,.95) !important;
}

/* (Optional) ensure icons/emojis don’t inherit a dark color */
main .grid > a[class*="bg-blue-"] [class*="text-"],
main .grid > div[class*="bg-blue-"] [class*="text-"] {
  color: inherit !important;
}
/* === Fix: keep white text on Admin flip-card tiles === */
.flip-card .flip-card-front { 
  color: #ffffff !important;              /* base text color */
  background: #1d4ed8;                    /* keep your blue-700 */
}

/* Headings & copy inside the front face must stay white */
.flip-card .flip-card-front h1,
.flip-card .flip-card-front h2,
.flip-card .flip-card-front h3,
.flip-card .flip-card-front h4,
.flip-card .flip-card-front p,
.flip-card .flip-card-front span,
.flip-card .flip-card-front i,
.flip-card .flip-card-front strong {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* Slightly softer white for the small subtext line */
.flip-card .flip-card-front p {
  color: rgba(255,255,255,.92) !important;
}
