/* AbsenOnline Admin Dashboard - Professional Stylesheet */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Colors */
  --bg-main: #f1f5f9;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: rgba(255,255,255,0.07);
  --bg-sidebar-active: rgba(37,99,235,0.9);

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #94a3b8;
  --border-color: #e2e8f0;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  /* Sidebar dimensions */
  --sidebar-collapsed-width: 68px;
  --sidebar-expanded-width: 256px;
  --topbar-height: 60px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================
   LAYOUT
   ================================ */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ================================
   SIDEBAR
   ================================ */
.sidebar {
  width: var(--sidebar-collapsed-width);
  flex-shrink: 0;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 200;
  overflow: visible; /* IMPORTANT: allow toggle to stick outside */
}

/* Expanded state */
.sidebar.expanded {
  width: var(--sidebar-expanded-width);
}

/* Inner wrapper handles the visual sidebar and overflow:hidden for animation */
.sidebar-inner {
  width: 100%;
  height: 100%;
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header */
.sidebar-header {
  height: var(--topbar-height);
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  overflow: hidden;
  white-space: nowrap;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.brand-icon svg {
  width: 20px;
  height: 20px;
}

.brand-text {
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s ease 0.05s, transform 0.2s ease 0.05s;
}

.sidebar.expanded .brand-text {
  opacity: 1;
  transform: translateX(0);
}

/* =========================================
   FLOATING SIDEBAR TOGGLE — Tab/Flap style
   Same color as sidebar, rounds only right
   ========================================= */
.sidebar-toggle {
  position: absolute;
  top: 6px;                    /* aligned with topbar header height (60px - 48px) / 2 */
  right: -15px;
  width: 15px;
  height: 48px;
  border-radius: 0 6px 6px 0;
  background-color: var(--bg-sidebar);
  border: none;
  box-shadow: 2px 0 6px rgba(0,0,0,0.25);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  transition: background 0.2s, color 0.2s, width 0.2s, right 0.2s;
  padding: 0;
}

.sidebar-toggle:hover {
  background-color: #1e293b;
  color: #f8fafc;
  width: 18px;
  right: -18px;
}

.sidebar-toggle svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

/* Icon visibility based on sidebar state */
.icon-expand  { display: none; }
.icon-collapse { display: block; }

.sidebar:not(.expanded) .icon-collapse { display: none; }
.sidebar:not(.expanded) .icon-expand   { display: block; }

/* Navigation */
.sidebar-nav {
  flex: 1;
  min-height: 0;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

/* Section labels */
.nav-section {
  padding: 14px 6px 8px 6px;
  display: flex;
  align-items: center;
}

/* Collapsed: show as a thin horizontal divider line */
.sidebar:not(.expanded) .nav-section {
  padding: 10px 10px;
}

.sidebar:not(.expanded) .nav-section::after {
  content: '';
  display: block;
  height: 1px;
  width: 100%;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 1px;
}

/* Paling atas tidak perlu garis */
.sidebar:not(.expanded) .nav-section:first-child::after {
  display: none;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #475569;
  white-space: nowrap;
  display: none;           /* hidden by default (collapsed) */
}

/* Expanded: show text label */
.sidebar.expanded .nav-section-label {
  display: block;
}

/* Expanded: hide the line */
.sidebar.expanded .nav-section::after {
  display: none;
}

/* Nav Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  height: 42px;
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  position: relative;
  overflow: visible;   /* MUST be visible so tooltip ::after can show outside */
  white-space: nowrap;
}

/* Center nav icons and logout button when sidebar is collapsed */
.sidebar:not(.expanded) .nav-link,
.sidebar:not(.expanded) .sidebar-logout-link {
  padding: 0;
  justify-content: center;
}

.sidebar:not(.expanded) .nav-label {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.nav-link:hover {
  background: var(--bg-sidebar-hover);
  color: #f1f5f9;
}

.nav-link.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(37,99,235,0.35);
}

.nav-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-label {
  font-size: 13.5px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease 0.05s, transform 0.18s ease 0.05s;
}

.sidebar.expanded .nav-label {
  position: static;
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Tooltip handled by JS (see app.js initTooltips)
   CSS pseudo-element tooltips are blocked by sidebar-inner overflow:hidden */

/* Sidebar nav scrolling enabled */
.sidebar-nav {
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logout-link {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  border-radius: var(--radius-md);
  transition: background 0.15s ease;
}

.sidebar-logout-link:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
  cursor: default;
  overflow: hidden;
  position: relative;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.user-info {
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.sidebar.expanded .user-info {
  opacity: 1;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 11px;
  color: #60a5fa;
  white-space: nowrap;
}

/* Tooltip for user badge when collapsed */
.user-profile-badge[data-tooltip] {
  position: relative;
}

.sidebar:not(.expanded) .user-profile-badge[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  z-index: 9999;
}

/* ================================
   MAIN WRAPPER
   ================================ */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ================================
   TOPBAR
   ================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.page-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.company-tag {
  background-color: var(--primary-light);
  color: var(--primary);
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--danger);
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-logout:hover {
  background-color: var(--danger-light);
  border-color: var(--danger);
}

/* ================================
   CONTENT BODY
   ================================ */
.content-body {
  padding: 28px;
  flex: 1;
}

/* ================================
   STAT CARDS
   ================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.stat-val {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-main);
  margin-top: 4px;
  letter-spacing: -1px;
  line-height: 1;
}

.stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-icon-wrapper {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-wrapper svg {
  width: 22px;
  height: 22px;
}

.stat-icon-primary { background-color: var(--primary-light); color: var(--primary); }
.stat-icon-success { background-color: var(--success-light); color: var(--success); }
.stat-icon-warning { background-color: var(--warning-light); color: var(--warning); }

/* ================================
   CONTENT CARD
   ================================ */
.content-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header-bar {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.card-header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.card-body-padding {
  padding: 22px 24px;
}

/* ================================
   TABLES
   ================================ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.custom-table th {
  background-color: #f8fafc;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tbody tr:last-child td {
  border-bottom: none;
}

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

/* ================================
   BADGES
   ================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}

.badge-active   { background: var(--success-light); color: #059669; }
.badge-inactive { background: var(--danger-light);  color: var(--danger); }
.badge-master   { background: #f3e8ff; color: #7e22ce; }
.badge-admin    { background: var(--primary-light); color: var(--primary); }
.badge-employee { background: #e0f2fe; color: #0284c7; }

/* ================================
   BUTTONS
   ================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
}

.btn-block { width: 100%; }

/* ================================
   FORMS
   ================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 15px;
  padding-right: 34px;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.invalid-feedback {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* ================================
   ALERTS
   ================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background-color: var(--success-light);
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.alert-danger {
  background-color: var(--danger-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ================================
   UTILITY CLASSES
   ================================ */
.form-section-bg {
  padding: 22px 24px;
  background-color: #f8fafc;
  border-bottom: 1px solid var(--border-color);
}

.form-section-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 18px;
}

.form-info-note {
  font-size: 13px;
  color: var(--primary);
  background-color: var(--primary-light);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  margin-bottom: 18px;
  border: 1px solid #bfdbfe;
}

.form-action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.card-filter-row {
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  background-color: #fafafa;
}

.filter-box {
  margin-bottom: 20px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.search-input-wrapper svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  width: 18px;
  height: 18px;
  z-index: 2;
}

.search-input-wrapper .form-control {
  padding-left: 42px;
  height: 42px;
  font-size: 13.5px;
}

/* Schedule Table Enhancements */
.schedule-table-container {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.schedule-select {
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  min-width: 135px;
  transition: all 0.2s ease;
  outline: none;
  font-family: inherit;
}

.schedule-select-off {
  background-color: #fef2f2 !important;
  color: #dc2626 !important;
  border: 1px solid #fca5a5 !important;
}

.schedule-select-off:focus {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

.schedule-select-active {
  background-color: #f0fdf4 !important;
  color: #166534 !important;
  border: 1px solid #86efac !important;
}

.schedule-select-active:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.td-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 13.5px;
}

.col-action { text-align: right; }

/* ================================
   LOGIN PAGE
   ================================ */
.login-page-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f172a 100%);
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: #ffffff;
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px auto;
  box-shadow: 0 8px 20px rgba(37,99,235,0.35);
}

.login-brand-icon svg {
  width: 26px;
  height: 26px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 768px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding: 0 16px;
  }
  .content-body {
    padding: 16px;
  }
  .sidebar {
    position: fixed;
    height: 100vh;
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 750px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.98);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.modal-container form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  flex-shrink: 0;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  flex-shrink: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 9px;
  background: #ffffff;
  color: var(--text-main);
  transition: all 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.map-picker-container {
  height: 250px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-top: 6px;
  z-index: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: #ffffff;
  color: #475569;
  border-color: var(--border-color);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn-secondary:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
}

.badge-info {
  background: var(--primary-light);
  color: var(--primary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
}

.badge-inactive {
  background: #fee2e2;
  color: #b91c1c;
}

/* ================================
   PREMIUM MODAL COMPONENT & SCROLLBAR
   ================================ */
@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  animation: modalFadeIn 0.2s ease-out;
}

/* Static non-Livewire modals hidden until .active class added */
.modal-overlay[id]:not(.active) {
  display: none !important;
}

.modal-container {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-container-sm { max-width: 520px; }
.modal-container-md { max-width: 650px; }
.modal-container-lg { max-width: 780px; }
.modal-container-xl { max-width: 920px; }

.modal-header {
  padding: 16px 24px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #ffffff !important;
  letter-spacing: -0.2px;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: all 0.18s ease;
}

.modal-close-btn:hover {
  background: #ef4444;
  color: #ffffff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

/* Custom Sleek Scrollbar */
.modal-body::-webkit-scrollbar,
.custom-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.modal-body::-webkit-scrollbar-track,
.custom-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb,
.custom-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover,
.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
}

/* ================================
   UNIFORM TABLE ACTION BUTTONS & BADGES
   ================================ */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.badge-status-active {
  background-color: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.badge-status-inactive {
  background-color: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.btn-action-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-action-edit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-action-edit:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.btn-action-danger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #dc2626;
  background-color: #ffffff;
  border: 1px solid #fecaca;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-action-danger:hover {
  background-color: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.btn-action-success {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  background-color: #ffffff;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-action-success:hover {
  background-color: #ecfdf5;
  border-color: #6ee7b7;
  color: #065f46;
}

/* ================================
   SELECT2 CUSTOM THEME & OVERRIDES
   ================================ */
.select2-container--default .select2-selection--single {
  height: 42px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  background-color: #ffffff !important;
  display: flex !important;
  align-items: center !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: normal !important;
  color: #0f172a !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  padding-left: 0 !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 40px !important;
  top: 1px !important;
  right: 8px !important;
}

.select2-container--default .select2-selection--single[aria-disabled="true"] {
  background-color: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  opacity: 0.7 !important;
  cursor: not-allowed !important;
}

.select2-dropdown {
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
  overflow: hidden !important;
  z-index: 99999 !important;
}

.select2-search--dropdown {
  padding: 6px !important;
}

.select2-search--dropdown .select2-search__field {
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  padding: 6px 10px !important;
  font-size: 13px !important;
  outline: none !important;
}

.select2-results__option {
  font-size: 13px !important;
  padding: 8px 12px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

/* ================================
   LEAFLET & LOCATION COMPONENT STYLES
   ================================ */
.leaflet-container {
  font-family: inherit;
  border-radius: 12px;
}

.filter-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-input-wrapper svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.search-input-wrapper .form-control {
  padding-left: 40px;
}

.empty-state-box {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  background: #eff6ff;
  color: #2563eb;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 4px;
}

.empty-state-text {
  font-size: 13px;
  color: #64748b;
  max-width: 400px;
  margin: 0 auto 20px auto;
}

.coord-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  color: #334155;
  font-weight: 500;
}

.radius-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* ================================
   UPGRADE LIMIT MODAL DIALOG
   ================================ */
.upgrade-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.upgrade-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.upgrade-modal-card {
  background: #ffffff;
  border-radius: var(--radius-xl);
  max-width: 480px;
  width: 100%;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transform: scale(0.92) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

.upgrade-modal-overlay.active .upgrade-modal-card {
  transform: scale(1) translateY(0);
}

.upgrade-modal-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 32px 24px 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.upgrade-modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.upgrade-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.upgrade-modal-icon-wrapper {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
  margin-bottom: 14px;
}

.upgrade-modal-title {
  font-size: 19px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.upgrade-modal-subtitle {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.upgrade-modal-body {
  padding: 24px 28px;
  color: #334155;
  font-size: 14px;
  line-height: 1.6;
}

.upgrade-modal-info-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.upgrade-modal-info-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upgrade-modal-info-value {
  font-size: 14px;
  font-weight: 800;
  color: #0284c7;
}

.upgrade-modal-footer {
  padding: 18px 28px 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-upgrade-dismiss {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-upgrade-dismiss:hover {
  background: #f1f5f9;
}

.btn-upgrade-confirm {
  padding: 10px 22px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-upgrade-confirm:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}



