/* 
   CRM Unified Theme - Sevarat 
   A modern, premium, and clean design system.
*/

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Colors */
  --primary: #1e3c72;
  --primary-dark: #12254d;
  --primary-light: #2a5298;
  --accent: #00c9ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Backgrounds */
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  /* Text */
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --text-on-dark: #ffffff;
  
  /* Borders & Shadows */
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-lg: 16px;
  
  /* Layout */
  --navbar-height: 70px;
}

/* Global Styles */
body {
  margin: 0;
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--primary-dark);
}

/* Premium Card Style */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Glassmorphism Classes */
.glass {
  background: var(--bg-glass) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Buttons */
.btn {
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border: none;
  box-shadow: 0 4px 10px rgba(30, 60, 114, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(30, 60, 114, 0.3);
}

/* Modern Tables */
.table {
  border-collapse: separate;
  border-spacing: 0 8px;
}

.table thead th {
  background: #f1f5f9;
  border-bottom: none;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  padding: 1rem;
}

.table tbody tr {
  background: white;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}

.table tbody tr:hover {
  background: #f8fafc;
}

.table td {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.table td:first-child { 
  border-left: 1px solid var(--border-color);
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

.table td:last-child {
  border-right: 1px solid var(--border-color);
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Modern Forms */
.form-control, .form-select {
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.65rem 1rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background-color: var(--bg-card);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
  outline: none;
}

.form-label {
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.modal-content {
  border-radius: var(--radius-lg);
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Action Outline Buttons */
.btn-action-outline {
    border: 1px solid rgba(255,255,255,0.4);
    color: white;
    background: transparent;
    transition: all 0.3s ease;
    font-weight: 500;
    border-radius: var(--radius);
}
.btn-action-outline:hover {
    background: rgba(255,255,255,0.15);
    color: white;
    border-color: white;
}

/* Dashboard Chart Styles */
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
}

.chart-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#cityMap {
    width: 100%;
    height: 400px;
    border-radius: var(--radius-lg);
    z-index: 1;
}

.chart-container {
    position: relative;
    margin: auto;
    height: 250px;
}

/* Accessibility Focus Outlines */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible {
  outline: 3px solid var(--accent) !important;
  outline-offset: 2px;
}

/* Responsive Media Queries */
@media (max-width: 991.98px) {
  :root {
    --navbar-height: 60px;
  }
  .card {
    padding: 1rem;
    border-radius: var(--radius);
  }
  .table thead {
    font-size: 0.7rem;
  }
  .table td, .table th {
    padding: 0.75rem 0.5rem;
  }
}

@media (max-width: 767.98px) {
  .action-bar {
    padding: 1rem;
    margin-bottom: 1.25rem;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
  .action-bar h4 {
    font-size: 1.25rem;
  }
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  /* Responsive stacking for search & filtering grids */
  .filter-grid, .row.g-3 {
    --bs-gutter-y: 0.75rem;
  }
  /* Make tables scrollable horizontally or display cards on small screens */
  .table-responsive {
    border: 0;
    margin-bottom: 1.5rem;
  }
  .table thead th {
    letter-spacing: 0.02em;
    padding: 0.75rem 0.5rem;
  }
  .table td {
    padding: 0.75rem 0.5rem;
  }
}

/* Navbar & Dropdowns - moved from menubar.php for a single-theme source of truth */
nav.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1051;
  width: 100%;
  height: var(--navbar-height);
  background: linear-gradient(135deg, var(--primary), var(--primary-light)) !important;
  padding: 0 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

body {
  padding-top: var(--navbar-height);
}

.navbar-brand {
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  color: var(--text-on-dark) !important;
}

.navbar-nav .nav-link {
  font-weight: 600;
  color: rgba(255,255,255,0.85) !important;
  font-size: 0.95rem;
  padding: 0.5rem 1rem !important;
  transition: all 0.2s ease;
  border-radius: 8px;
}

.navbar-nav .nav-link:hover, .navbar-nav .nav-link.active {
  color: var(--text-on-dark) !important;
  background: rgba(255,255,255,0.15);
}

.dropdown-menu {
  border: none;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  padding: 0.75rem;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(8px);
  min-width: 210px;
}

.dropdown-menu.mega-menu {
  min-width: 940px;
  max-width: 1200px;
}

/* =====================================
   BOOTSTRAP 5 MULTI LEVEL MENU FIX
===================================== */

.navbar,
.navbar .container-fluid,
.navbar-collapse,
.navbar-nav,
.nav-item {
    overflow: visible !important;
}

.navbar .dropdown {
    position: relative;
}

.navbar .dropdown-menu {
    position: absolute;
    min-width: 260px;
    border-radius: 12px;
    border: none;
    box-shadow: 0 10px 30px rgba(0,0,0,.15);
    z-index: 9999;
}

.dropdown-menu .dropend {
    position: relative;
}

.dropdown-menu .dropend > .dropdown-menu {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: 4px;
    display: none;
    min-width: 260px;
    z-index: 10000;
}

.dropdown-menu .dropend > .dropdown-menu.show {
    display: block;
}

.dropdown-menu-end {
    right: 0 !important;
    left: auto !important;
}

@media (max-width: 991.98px) {

    .navbar .dropdown-menu {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .dropdown-menu .dropend > .dropdown-menu {
        position: static;
        margin-left: 20px;
        border-left: 2px solid #dee2e6;
        box-shadow: none;
        min-width: auto;
    }

    .dropdown-menu .dropend > .dropdown-menu.show {
        display: block;
    }
}

.dropdown-menu.mega-menu .dropdown-header {
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
}

.dropdown-menu.mega-menu .dropdown-item {
  border-radius: 6px;
  margin-bottom: 0.15rem;
  padding: 0.45rem 0.9rem;
}

.dropdown-item {
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-weight: 500;
  color: var(--text-main) !important;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background-color: #f1f5f9 !important;
  color: var(--primary) !important;
  transform: translateX(4px);
}

/* utility: alert container position */
#alertContainer2 {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 1050;
  max-width: 350px;
}

/* Bootstrap dropdown visibility fix */

.navbar .dropdown-menu {
    display: none;
}

.navbar .dropdown-menu.show {
    display: block;
}
