/* ============================================================
   PTMS — Custom Theme Override
   Loaded AFTER style.css — overrides colors, fonts, card styles
   without touching any PHP logic or HTML structure.

   Theme:  Kicatex Green + Warm Off-White + Poppins + Flat Cards
   Version: 1.0
   ============================================================ */

/* ── CSS Variable Overrides ── */
:root {
  /* Brand green palette */
  --accent:       #3d7a1f;
  --accent-dark:  #2d5a0e;
  --accent-light: #f0fdf4;
  --accent-hover: #1a3d07;
  --accent-50:    #f0fdf4;
  --accent-100:   #dcfce7;
  --accent-200:   #bbf7d0;
  --accent-500:   #3d7a1f;
  --accent-600:   #2d5a0e;
  --accent-700:   #1a3d07;

  /* Backgrounds */
  --body-bg:      #faf9f6;
  --card-bg:      #ffffff;
  --sidebar-bg:   #1a2e0a;

  /* Cards — flat with subtle border, no shadow */
  --shadow:       none;
  --shadow-md:    none;
  --card-border:  1px solid #e8e5df;
  --radius:       14px;
  --radius-sm:    10px;

  /* Text */
  --text:         #1a1a1a;
  --text-muted:   #6b7280;
  --border:       #e8e5df;

  /* Font */
  --font-family:  'Poppins', sans-serif;
}

/* ── Global Font ── */
body,
input, select, textarea, button, .btn {
  font-family: 'Poppins', sans-serif !important;
}

/* ── Body Background ── */
body {
  background: #faf9f6 !important;
}
.page-body {
  background: #faf9f6 !important;
}
.bg-slate-100 {
  background: #faf9f6 !important;
}

/* ── Sidebar ── */
#sidebar,
aside[class*="bg-slate-900"],
nav[class*="bg-slate-900"] {
  background: #1a2e0a !important;
}
/* Sidebar scrollbar */
#sidebar::-webkit-scrollbar-thumb {
  background: #3d7a1f !important;
}

/* Sidebar nav — active state green */
#sidebar a.bg-blue-600,
#sidebar a[class*="bg-blue-600"] {
  background: #2d5a0e !important;
}
#sidebar a:hover:not(.bg-blue-600):not([class*="bg-blue-600"]) {
  background: rgba(61, 122, 31, 0.2) !important;
}
/* Sidebar sub-menu active items */
#sidebar a[class*="bg-blue-500"] {
  background: rgba(61, 122, 31, 0.2) !important;
}
#sidebar a[class*="text-blue-300"] {
  color: #a7d88e !important;
}
/* Sidebar section headings */
#sidebar p[class*="text-slate-600"] {
  color: #5a8a3a !important;
}
/* Sidebar border */
#sidebar div[class*="border-slate-800"] {
  border-color: #2d5a0e !important;
}

/* ── Cards — Flat with subtle border ── */
.card {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: none !important;
  border: 1px solid #e8e5df;
  overflow: hidden;
}
.card-header {
  border-bottom: 1px solid #f0ede8;
  background: #fdfcfa;
}

/* ── Stat Cards ── */
.stat-card {
  background: #ffffff !important;
  box-shadow: none !important;
  border: 1px solid #e8e5df !important;
  border-radius: 14px !important;
  border-top: 3px solid transparent !important;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.06) !important;
  border-color: #d4d0c8 !important;
}
/* Green-branded stat cards */
.stat-card.blue   { border-top-color: #3d7a1f !important; }
.stat-card.blue   .stat-icon { background: #f0fdf4 !important; color: #3d7a1f !important; }

/* ── Buttons — Green brand ── */
.btn-primary {
  background: #2d5a0e !important;
  color: #fff !important;
  border-radius: 10px;
}
.btn-primary:hover {
  background: #1a3d07 !important;
  color: #fff !important;
}
.btn-outline {
  border-color: #3d7a1f !important;
  color: #3d7a1f !important;
}
.btn-outline:hover {
  background: #3d7a1f !important;
  color: #fff !important;
}
.btn {
  border-radius: 10px;
  font-weight: 600;
}

/* ── Form Inputs ── */
input[type=text], input[type=email], input[type=password],
input[type=tel], input[type=date], input[type=number],
select, textarea {
  border: 1.5px solid #e8e5df;
  border-radius: 10px;
  background: #fff;
  font-family: 'Poppins', sans-serif !important;
}
input:focus, select:focus, textarea:focus {
  border-color: #3d7a1f !important;
  box-shadow: 0 0 0 3px rgba(61, 122, 31, 0.12) !important;
}

/* ── Tables ── */
.data-table thead tr {
  background: #fdfcfa;
  border-bottom: 2px solid #e8e5df;
}
.data-table th {
  color: #6b7280;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
}
.data-table td {
  border-bottom: 1px solid #f5f3ef;
}
.data-table tbody tr:hover {
  background: #fdfcfa;
}

/* ── Badges ── */
.badge-primary {
  background: #f0fdf4;
  color: #2d5a0e;
}

/* ── Alerts ── */
.alert {
  border-radius: 10px;
}

/* ── Progress Bars ── */
.bg-primary {
  background: #3d7a1f !important;
}

/* ── Page Header ── */
.page-header h1 {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 22px;
  color: #1a1a1a;
}
.page-header .text-muted {
  font-size: 13px;
  color: #6b7280;
}

/* ── Top Bar / Header Bar ── */
header[class*="bg-white"],
div[class*="border-b"][class*="bg-white"] {
  background: #ffffff !important;
  border-bottom-color: #e8e5df !important;
}
/* Search box focus → green */
.focus-within\:border-blue-500:focus-within {
  border-color: #3d7a1f !important;
}
.focus-within\:ring-blue-100:focus-within {
  --tw-ring-color: rgba(61, 122, 31, 0.12) !important;
}

/* ── Links — green accent ── */
a.text-blue-600, a[class*="text-blue-600"] {
  color: #3d7a1f !important;
}
a.text-blue-600:hover, a[class*="text-blue-600"]:hover {
  color: #2d5a0e !important;
}
.view-all {
  color: #3d7a1f;
}
.view-all:hover {
  color: #2d5a0e;
}

/* ── Notification badge on sidebar ── */
.bg-red-500 {
  background: #dc2626 !important;
}

/* ── Avatar colors — green-tinted palette ── */
.bg-blue-500 { background: #3d7a1f !important; }
.bg-emerald-500 { background: #059669 !important; }
.bg-violet-500 { background: #6d28d9 !important; }

/* ── Focus ring for accessibility ── */
*:focus-visible {
  outline: 2px solid #3d7a1f;
  outline-offset: 2px;
}

/* ── Inline style overrides ──
   Many module pages use inline background colors for
   section headers, stat icons, etc. These selectors
   target common patterns without changing PHP. */

/* Blue accent text used inline → green */
[style*="color:#3b82f6"] { color: #3d7a1f !important; }
[style*="color: #3b82f6"] { color: #3d7a1f !important; }

/* Blue accent backgrounds used inline → green */
[style*="background:#3b82f6"] { background: #3d7a1f !important; }
[style*="background: #3b82f6"] { background: #3d7a1f !important; }
[style*="background-color:#3b82f6"] { background-color: #3d7a1f !important; }

/* Blue border colors → green */
[style*="border-color:#3b82f6"] { border-color: #3d7a1f !important; }
[style*="border-left:4px solid #3b82f6"] { border-left-color: #3d7a1f !important; }
[style*="border-left: 4px solid #3b82f6"] { border-left-color: #3d7a1f !important; }

/* Blue icon backgrounds → green tint */
[style*="background:#eff6ff"] { background: #f0fdf4 !important; }
[style*="background: #eff6ff"] { background: #f0fdf4 !important; }

/* Blue 600/700 shades → green */
[style*="color:#2563eb"] { color: #2d5a0e !important; }
[style*="color: #2563eb"] { color: #2d5a0e !important; }
[style*="color:#1d4ed8"] { color: #1a3d07 !important; }
[style*="color: #1d4ed8"] { color: #1a3d07 !important; }
[style*="background:#2563eb"] { background: #2d5a0e !important; }
[style*="background: #2563eb"] { background: #2d5a0e !important; }

/* Light blue info backgrounds → light green */
[style*="background:#eff6ff;"] { background: #f0fdf4 !important; }

/* ── Blue→Green Badge Readability Fix ──
   The single-attribute overrides above convert #3b82f6 to #3d7a1f
   for BOTH color and background. A badge whose inline style uses
   #3b82f6 for both (e.g. background:#3b82f618;color:#3b82f6) therefore
   ends up as green text on green background — unreadable.
   This more-specific selector (2 attribute selectors) takes precedence
   and gives such badges solid brand green + white text. */

[style*="background:#3b82f6"][style*="color:#3b82f6"],
[style*="background: #3b82f6"][style*="color: #3b82f6"] {
  background: #3d7a1f !important;
  color: #fff !important;
  border-color: #2d5a0e !important;
}

/* ── Smooth transitions on interactive elements ── */
.card, .stat-card, .btn, a {
  transition: all 0.2s ease;
}

/* ── Login Page ── */
.login-page {
  background: #1a2e0a !important;
}
.login-left {
  background: linear-gradient(135deg, #1a2e0a 0%, #2d5a0e 50%, #1a3d07 100%) !important;
}
.login-right {
  background: #faf9f6 !important;
}
.login-right input:focus {
  border-color: #3d7a1f !important;
  box-shadow: 0 0 0 3px rgba(61, 122, 31, 0.12) !important;
}
.logo-icon {
  background: #2d5a0e !important;
}

/* ── Scrollbar styling ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c4bfb6; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #9c9789; }

/* ── Print ── */
@media print {
  .card { border: 1px solid #ddd; box-shadow: none !important; }
  body { background: #fff !important; }
}
