/* =============================================
   UAE Property Management – Design System v2
   =============================================
   Color Palette:
     Primary:
       Emerald Green: #0F5132  (buttons, links, active states)
       Charcoal:      #1F2933  (header, sidebar, table heads)
     Light Neutrals:
       Off White:     #F9FAFB  (page background)
       Light Gray:    #E5E7EB  (borders)
     Accent:
       Accent Silver: #9CA3AF  (secondary text, muted)
     Derived:
       Emerald Dark:  #0a3d25  (hover states)
       Emerald Light: #198754  (lighter accents)
       Emerald Subtle:#d1e7dd  (highlights, row hover)
       Charcoal Light:#2d3a46  (sidebar hover)
       Charcoal Deep: #151e27  (gradients)
   ============================================= */

:root {
    /* ── Primary ─────────────────────────────── */
    --emerald: #0F5132;
    --emerald-dark: #0a3d25;
    --emerald-light: #198754;
    --emerald-subtle: #d1e7dd;
    /* ── Dark Neutral ────────────────────────── */
    --charcoal: #0b3a24;
    --charcoal-light: #198754;
    --charcoal-deep: #0a3d25;
    /* ── Light Neutrals ──────────────────────── */
    --off-white: #F9FAFB;
    --light-gray: #022500;
    --silver: #9CA3AF;
    /* ── Semantic aliases ────────────────────── */
    --primary: var(--emerald);
    --primary-dark: var(--emerald-dark);
    --primary-light: var(--emerald-light);
    --primary-subtle: var(--emerald-subtle);
    --sidebar-bg: var(--charcoal);
    --sidebar-hover: var(--charcoal-light);
    --surface: #ffffff;
    --page-bg: var(--off-white);
    --text: #111827;
    --text-secondary: #4B5563;
    --muted: var(--silver);
    --border: var(--light-gray);
    /* ── Bootstrap variable overrides ────────── */
    --bs-primary: #0F5132;
    --bs-primary-rgb: 15, 81, 50;
    --bs-primary-bg-subtle: #d1e7dd;
    --bs-primary-text-emphasis: #0a3d25;
    --bs-primary-border-subtle: #198754;
    --bs-info: #1F2933;
    --bs-info-rgb: 31, 41, 51;
    --bs-info-bg-subtle: #e8eaed;
    --bs-info-text-emphasis: #151e27;
    --bs-info-border-subtle: #2d3a46;
    --bs-link-color: #0F5132;
    --bs-link-color-rgb: 15, 81, 50;
    --bs-link-hover-color: #0a3d25;
    --bs-link-hover-color-rgb: 10, 61, 37;
    --bs-focus-ring-color: rgba(15, 81, 50, 0.25);
    /* ── Elevation ───────────────────────────── */
    --shadow-xs: 0 1px 2px rgba(31,41,51,0.04);
    --shadow-sm: 0 1px 3px rgba(31,41,51,0.06), 0 1px 2px rgba(31,41,51,0.04);
    --shadow: 0 2px 4px rgba(31,41,51,0.06), 0 1px 3px rgba(31,41,51,0.04);
    --shadow-md: 0 4px 8px -1px rgba(31,41,51,0.07), 0 2px 4px -2px rgba(31,41,51,0.04);
    --shadow-lg: 0 12px 24px -4px rgba(31,41,51,0.08), 0 4px 8px -4px rgba(31,41,51,0.04);
    /* ── Shape & Motion ──────────────────────── */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --transition: 0.18s ease;
    --transition-slow: 0.3s ease;
}

/* ══════════════════════════════════════════════
   BASE
   ══════════════════════════════════════════════ */

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}

body {
  margin-bottom: 60px;
  background-color: var(--page-bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a {
  color: var(--emerald);
  transition: color var(--transition);
  text-decoration: none;
}

a:hover {
  color: var(--emerald-dark);
}

::selection {
  background: var(--emerald-subtle);
  color: var(--charcoal);
}

/* ══════════════════════════════════════════════
   FOCUS / ACCESSIBILITY
   ══════════════════════════════════════════════ */

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(15, 81, 50, 0.2);
  border-color: var(--emerald-light);
  outline: none;
}

.form-check-input:checked {
  background-color: var(--emerald);
  border-color: var(--emerald);
}

/* ══════════════════════════════════════════════
   TOP NAVBAR  (Charcoal background)
   ══════════════════════════════════════════════ */

.navbar-top {
  background: var(--charcoal) !important;
  z-index: 1030;
  border-bottom: none;
  height: 56px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.navbar-top .container-fluid {
  height: 100%;
}

.navbar-top .navbar-brand {
  color: #fff !important;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.navbar-top .navbar-brand i {
  color: var(--emerald-light);
  font-size: 1.15rem;
}

.navbar-top .navbar-brand .brand-text {
  transition: opacity var(--transition);
}

/* Navbar action buttons (lang, logout) */
.navbar-collapse-btn {
  color: rgba(255,255,255,0.55) !important;
  font-size: 1.15rem;
  padding: 0.35rem !important;
  border-radius: var(--radius);
  transition: all var(--transition);
  text-decoration: none;
  border: none;
  line-height: 1;
}

.navbar-collapse-btn:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
}

.navbar-action-btn {
  color: rgba(255,255,255,0.6) !important;
  font-size: 0.82rem;
  transition: all var(--transition);
  padding: 0.4rem 0.65rem !important;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  text-decoration: none;
  border: none;
}

.navbar-action-btn:hover {
  color: #fff !important;
  background: rgba(255,255,255,0.08);
}

.navbar-action-btn i {
  font-size: 0.95rem;
}

.navbar-logout-btn:hover {
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.12);
}

/* Navbar user pill */
.navbar-user-pill {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem !important;
  border-radius: 2rem;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  cursor: default;
}

.navbar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--emerald);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.navbar-user-name {
  color: rgba(255,255,255,0.85);
  font-size: 0.82rem;
  font-weight: 500;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nav divider */
.nav-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.12);
  margin: 0 0.25rem;
  align-self: center;
}

/* ══════════════════════════════════════════════
   SIDEBAR  (Charcoal background)
   ══════════════════════════════════════════════ */

.sidebar {
  height: calc(100vh - 56px);
  background: var(--charcoal);
  color: #fff;
  width: 250px;
  position: fixed;
  top: 56px;
  left: 0;
  z-index: 100;
  transition: width var(--transition-slow);
  overflow: hidden;
  box-shadow: 1px 0 0 rgba(255,255,255,0.04);
}

.sidebar-inner {
  width: 250px;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 1.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-inner:hover {
  scrollbar-color: rgba(255,255,255,0.3) rgba(255,255,255,0.04);
}

.sidebar-inner::-webkit-scrollbar { width: 5px; }
.sidebar-inner::-webkit-scrollbar-track { background: transparent; }
.sidebar-inner::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
}
.sidebar-inner:hover::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.3);
}
.sidebar-inner::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.45);
}

/* Sidebar sections */
.sidebar-section {
  padding: 0;
}

.sidebar-section:first-child .sidebar-heading {
  padding-top: 1rem;
}

.sidebar-heading {
  color: rgba(255,255,255,0.3);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  padding: 1.25rem 1.25rem 0.35rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-slow), padding var(--transition-slow);
}

/* Nav links */
.sidebar .nav-link {
  color: rgba(255,255,255,0.5);
  padding: 0.5rem 1.25rem;
  font-size: 0.84rem;
  font-weight: 450;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  border-radius: 0;
  margin: 1px 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}

.sidebar .nav-link:hover {
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.06);
  border-left-color: rgba(255,255,255,0.12);
}

.sidebar .nav-link.active {
  color: #fff;
  background: rgba(25, 135, 84, 0.18);
  border-left-color: var(--emerald-light);
  font-weight: 600;
}

.sidebar .nav-link.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--emerald-light);
  border-radius: 3px 0 0 3px;
  opacity: 0.4;
}

.sidebar .nav-link i {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 1rem;
  opacity: 0.55;
  flex-shrink: 0;
  transition: opacity var(--transition), color var(--transition);
}

.sidebar .nav-link:hover i {
  opacity: 0.9;
  color: rgba(255,255,255,0.9);
}

.sidebar .nav-link.active i {
  opacity: 1;
  color: var(--emerald-light);
}

.sidebar .nav-text {
  transition: opacity var(--transition-slow), width var(--transition-slow);
  overflow: hidden;
}

/* ── Sidebar collapsed state (desktop) ────── */

.sidebar.collapsed {
  width: 64px;
}

.sidebar.collapsed .sidebar-inner {
  width: 64px;
}

.sidebar.collapsed .sidebar-heading {
  opacity: 0;
  padding-top: 0.6rem;
  padding-bottom: 0;
  height: 0.6rem;
}

.sidebar.collapsed .sidebar-section:first-child .sidebar-heading {
  padding-top: 0.6rem;
}

.sidebar.collapsed .nav-link {
  padding: 0.6rem 0;
  justify-content: center;
  border-left-color: transparent !important;
  gap: 0;
}

.sidebar.collapsed .nav-link i {
  width: 64px;
  min-width: 64px;
  font-size: 1.1rem;
}

.sidebar.collapsed .nav-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-link.active::after {
  display: none;
}

.sidebar.collapsed .nav-link.active {
  background: rgba(25, 135, 84, 0.22);
  border-left: 3px solid transparent;
}

.sidebar.collapsed .nav-link.active i {
  color: var(--emerald-light);
  opacity: 1;
}

/* Tooltip for collapsed icons */
.sidebar.collapsed .nav-link {
  position: relative;
}

.sidebar.collapsed .nav-link:hover::before {
  content: attr(title);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: var(--charcoal-deep);
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  margin-left: 6px;
  pointer-events: none;
}

/* Mobile overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* ══════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════ */

.main-content {
  margin-left: 250px;
  padding: 2rem 2.25rem;
  min-height: calc(100vh - 56px);
  max-width: 100%;
  transition: margin-left var(--transition-slow);
}

.sidebar.collapsed ~ .main-content {
  margin-left: 64px;
}

/* ══════════════════════════════════════════════
   MOBILE RESPONSIVE
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {
  .sidebar {
    width: 0;
    overflow: hidden;
  }
  .sidebar.show {
    width: 260px;
    box-shadow: 4px 0 30px rgba(0,0,0,0.35);
  }
  .sidebar.show .sidebar-inner {
    width: 260px;
  }
  /* Undo any collapsed state on mobile */
  .sidebar.collapsed { width: 0; }
  .sidebar.collapsed.show { width: 260px; }
  .sidebar.collapsed.show .sidebar-inner { width: 260px; }
  .sidebar.collapsed.show .sidebar-heading {
    opacity: 1;
    height: auto;
    padding: 1.25rem 1.25rem 0.35rem;
  }
  .sidebar.collapsed.show .nav-link {
    padding: 0.5rem 1.25rem;
    justify-content: flex-start;
    gap: 0.75rem;
  }
  .sidebar.collapsed.show .nav-link i {
    width: 20px;
    min-width: 20px;
    font-size: 1rem;
  }
  .sidebar.collapsed.show .nav-text {
    opacity: 1;
    width: auto;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 1.25rem 1rem;
  }
}

@media (max-width: 576px) {
  .main-content { padding: 1rem 0.75rem; }
  .navbar-user-name { display: none; }
}

/* ══════════════════════════════════════════════
   PAGE HEADER
   ══════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  color: var(--charcoal);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Page title row — standardize the d-flex headers across all views */
.main-content > .d-flex:first-child,
.main-content > div > .d-flex:first-child {
  margin-bottom: 1.5rem !important;
}

.main-content > .d-flex:first-child h4,
.main-content > div > .d-flex:first-child h4,
.main-content > .mb-4:first-child h4 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--charcoal);
}

.main-content > .d-flex:first-child h4 i,
.main-content > div > .d-flex:first-child h4 i,
.main-content > .mb-4:first-child h4 i {
  color: var(--emerald);
  font-size: 1.1rem;
}

/* ══════════════════════════════════════════════
   CARDS – STAT / DASHBOARD
   ══════════════════════════════════════════════ */

.stat-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform var(--transition), box-shadow var(--transition);
  overflow: hidden;
  background: var(--surface);
  border-top: none;
  position: relative;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--emerald);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .card-body {
  padding: 1.25rem 1.5rem;
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  background: var(--emerald-subtle);
  color: var(--emerald);
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--charcoal);
  margin-top: 0.125rem;
}

.stat-card .stat-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Financial stat cards — left colored border variant */
.stat-card.border-start.border-3 {
  border-top: none;
}
.stat-card.border-start.border-3::before {
  display: none;
}

/* ══════════════════════════════════════════════
   PROPERTY CARDS
   ══════════════════════════════════════════════ */

.property-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  background: var(--surface);
}

.property-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.property-card .card-img-top {
  height: 200px;
  object-fit: cover;
}

.property-card .card-body {
  padding: 1.125rem 1.25rem;
}

.property-card .badge-status {
  position: absolute;
  top: 12px;
  right: 12px;
}

.property-card .badge-featured {
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--emerald);
  color: #fff;
}

.property-card .property-price {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--charcoal);
}

.property-card .property-meta {
  font-size: 0.82rem;
  color: var(--muted);
}

.property-card .property-meta i {
  color: var(--emerald-light);
}

.property-card .card-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
}

.property-card .card-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
}

/* ══════════════════════════════════════════════
   STATUS BADGES
   ══════════════════════════════════════════════ */

.badge-available { background-color: var(--emerald); }
.badge-rented { background-color: var(--charcoal); }
.badge-sold { background-color: #7c3aed; }
.badge-maintenance { background-color: #f59e0b; color: #1F2933; }
.badge-reserved { background-color: #ea580c; }

/* ══════════════════════════════════════════════
   PRIORITY BADGES
   ══════════════════════════════════════════════ */

.badge-low { background-color: var(--emerald); }
.badge-medium { background-color: #f59e0b; color: #1F2933; }
.badge-high { background-color: #ea580c; }
.badge-emergency { background-color: #dc2626; }

/* ══════════════════════════════════════════════
   TABLES  (Charcoal headers, white text)
   ══════════════════════════════════════════════ */

.table-custom {
  font-size: 0.855rem;
  border-collapse: separate;
  border-spacing: 0;
}

.table-custom thead th {
  background-color: var(--charcoal);
  color: rgba(255,255,255,0.88);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: none;
  padding: 0.8rem 1rem;
  white-space: nowrap;
}

.table-custom thead th:first-child { border-radius: var(--radius) 0 0 0; }
.table-custom thead th:last-child  { border-radius: 0 var(--radius) 0 0; }

.table-custom tbody td {
  vertical-align: middle;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  background: var(--surface);
  transition: background-color var(--transition);
}

.table-custom tbody tr:hover td {
  background-color: var(--off-white);
}

.table-custom tbody tr:last-child td {
  border-bottom: none;
}

/* Table action buttons — consistent alignment */
.table-custom td:last-child {
  white-space: nowrap;
}

.table-custom td .btn + .btn {
  margin-left: 0.25rem;
}

.table-custom td .fw-semibold {
  color: var(--text);
}

/* ══════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════ */

.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--charcoal-deep) 0%, var(--charcoal) 60%, var(--charcoal-light) 100%);
  padding: 1rem;
}

.login-card {
  border: none;
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
  max-width: 420px;
  width: 100%;
  overflow: hidden;
  background: #fff;
}

.login-card .card-header {
  background: var(--charcoal);
  border-radius: 0 !important;
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  border-bottom: 3px solid var(--emerald);
}

.login-card .card-header i {
  color: var(--emerald-light);
}

.login-card .card-header h4 {
  color: #fff;
  font-size: 1.15rem;
}

.login-card .card-body {
  padding: 2rem 2rem 1.5rem;
  background: #fff;
}

.login-card .btn-primary {
  background-color: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
  font-weight: 600;
  padding: 0.625rem 1rem;
}

.login-card .btn-primary:hover {
  background-color: var(--emerald-dark);
  border-color: var(--emerald-dark);
  color: #fff;
}

.login-card .card-footer {
  background: var(--off-white);
  border-top: 1px solid var(--border);
}

.login-card .input-group-text {
  background: var(--off-white);
  border-color: var(--border);
  color: var(--silver);
}

/* ══════════════════════════════════════════════
   FORM SECTIONS
   ══════════════════════════════════════════════ */

.form-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.form-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 1.25rem;
  padding-bottom: 0.625rem;
  border-bottom: 2px solid var(--emerald-subtle);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ══════════════════════════════════════════════
   FORM CONTROLS
   ══════════════════════════════════════════════ */

.form-control,
.form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  color: var(--text);
  background: #fff;
}

.form-control:hover,
.form-select:hover {
  border-color: #d1d5db;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--emerald-light);
  box-shadow: 0 0 0 3px rgba(15, 81, 50, 0.1);
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Required field indicator for labels ending with * */
.form-label:has(+ .form-control[required]),
.form-label:has(+ .form-select[required]) {
  color: var(--text);
}

textarea.form-control {
  min-height: 80px;
}

/* Validation messages */
.text-danger.small,
span[class*="field-validation"] {
  font-size: 0.75rem;
  margin-top: 0.25rem;
  display: block;
}

.input-validation-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.validation-summary-errors {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

/* Form check improvements */
.form-check {
  padding-top: 0.125rem;
  padding-bottom: 0.125rem;
}

.form-check-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* File input */
.form-control[type="file"] {
  padding: 0.375rem 0.75rem;
  font-size: 0.82rem;
}

/* ══════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════ */

.btn {
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.84rem;
  padding: 0.5rem 1rem;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
}

.btn i {
  font-size: 0.9em;
  line-height: 1;
}

.btn-lg {
  padding: 0.625rem 1.35rem;
  font-size: 0.95rem;
  border-radius: var(--radius);
  gap: 0.5rem;
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  gap: 0.25rem;
}

/* Primary: Emerald Green bg, white text */
.btn-primary {
  background-color: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:active {
  background-color: var(--emerald-dark);
  border-color: var(--emerald-dark);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15, 81, 50, 0.25);
}

.btn-primary:disabled {
  background-color: #6eb896;
  border-color: #6eb896;
  color: rgba(255,255,255,0.7);
  opacity: 0.65;
}

/* Outline Primary */
.btn-outline-primary {
  color: var(--emerald);
  border-color: var(--emerald);
  background: transparent;
}

.btn-outline-primary:hover {
  background-color: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
}

/* Outline Secondary */
.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--light-gray);
  background: var(--surface);
}

.btn-outline-secondary:hover {
  background-color: var(--off-white);
  border-color: var(--silver);
  color: var(--charcoal);
}

/* Success override */
.btn-success {
  background-color: var(--emerald);
  border-color: var(--emerald);
}

.btn-success:hover {
  background-color: var(--emerald-dark);
  border-color: var(--emerald-dark);
}

/* Info → Charcoal override */
.btn-info {
  background-color: var(--charcoal);
  border-color: var(--charcoal);
  color: #fff;
}

.btn-info:hover,
.btn-info:active {
  background-color: var(--charcoal-light);
  border-color: var(--charcoal-light);
  color: #fff;
}

.btn-outline-info {
  color: var(--charcoal);
  border-color: var(--charcoal);
  background: transparent;
}

.btn-outline-info:hover {
  background-color: var(--charcoal);
  border-color: var(--charcoal);
  color: #fff;
}

/* Warning outline */
.btn-outline-warning {
  color: #92400e;
  border-color: #f59e0b;
}

.btn-outline-warning:hover {
  background-color: #f59e0b;
  border-color: #f59e0b;
  color: #fff;
}

/* Danger outline */
.btn-outline-danger {
  color: #991b1b;
}

/* d-grid buttons — full width form actions */
.d-grid .btn-lg {
  font-size: 0.92rem;
  padding: 0.7rem 1.25rem;
}

/* ══════════════════════════════════════════════
   GENERAL CARDS
   ══════════════════════════════════════════════ */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--transition);
}

.card-header {
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  background: var(--surface);
  padding: 0.875rem 1.25rem;
}

.card-header h6 {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.card-header h6 i {
  color: var(--emerald-light);
  font-size: 0.95rem;
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  background: var(--off-white);
  border-top: 1px solid var(--border);
}

/* Filter cards */
.card.shadow-sm.mb-4 > .card-body > form.row {
  align-items: end;
}

/* ══════════════════════════════════════════════
   ALERTS
   ══════════════════════════════════════════════ */

.alert {
  border-radius: var(--radius);
  font-size: 0.855rem;
  padding: 0.875rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert i {
  font-size: 1rem;
  flex-shrink: 0;
}

.alert-success {
  background-color: var(--emerald-subtle);
  color: var(--emerald-dark);
  border: 1px solid rgba(25, 135, 84, 0.2);
}

.alert-success .btn-close { filter: none; }

.alert-danger {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert-warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* ══════════════════════════════════════════════
   RTL SUPPORT
   ══════════════════════════════════════════════ */

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
  box-shadow: -1px 0 0 rgba(255,255,255,0.04);
}

[dir="rtl"] .sidebar .nav-link {
  border-left: none;
  border-right: 3px solid transparent;
}

[dir="rtl"] .sidebar .nav-link:hover {
  border-right-color: rgba(255,255,255,0.12);
}

[dir="rtl"] .sidebar .nav-link.active {
  border-right-color: var(--emerald-light);
}

[dir="rtl"] .sidebar .nav-link.active::after {
  right: auto;
  left: 0;
  border-radius: 0 3px 3px 0;
}

[dir="rtl"] .main-content {
  margin-left: 0;
  margin-right: 250px;
  transition: margin-right var(--transition-slow);
}

[dir="rtl"] .sidebar.collapsed ~ .main-content {
  margin-right: 64px;
}

[dir="rtl"] .table-custom td .btn + .btn {
  margin-left: 0;
  margin-right: 0.25rem;
}

/* RTL collapsed tooltips */
[dir="rtl"] .sidebar.collapsed .nav-link:hover::before {
  left: auto;
  right: 100%;
  margin-left: 0;
  margin-right: 6px;
}

[dir="rtl"] .sidebar.collapsed .nav-link {
  border-right-color: transparent !important;
}

/* RTL navbar user pill */
[dir="rtl"] .navbar-user-pill {
  padding: 0.3rem 0.35rem 0.3rem 0.75rem !important;
}

@media (max-width: 768px) {
  [dir="rtl"] .main-content { margin-right: 0 !important; }
  [dir="rtl"] .sidebar.show { box-shadow: -4px 0 30px rgba(0,0,0,0.35); }
}

/* ══════════════════════════════════════════════
   ACTIVITY TIMELINE
   ══════════════════════════════════════════════ */

.activity-timeline {
  position: relative;
  padding-left: 1.75rem;
}

.activity-timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0.25rem;
  bottom: 0.25rem;
  width: 2px;
  background: var(--light-gray);
  border-radius: 1px;
}

.activity-item {
  position: relative;
  padding-bottom: 0.875rem;
}

.activity-item:last-child {
  padding-bottom: 0;
}

.activity-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--emerald);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 2px var(--light-gray);
}

.activity-item small {
  line-height: 1.5;
}

/* ══════════════════════════════════════════════
   EMPTY STATE
   ══════════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}

.empty-state i {
  font-size: 2.5rem;
  margin-bottom: 0.875rem;
  opacity: 0.25;
  color: var(--silver);
}

.empty-state h5 {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.375rem;
}

.empty-state span,
.empty-state p {
  font-size: 0.85rem;
}

.empty-state .btn {
  margin-top: 0.75rem;
}

/* ══════════════════════════════════════════════
   PAGINATION
   ══════════════════════════════════════════════ */

.pagination {
  gap: 0.25rem;
}

.pagination .page-link {
  border-radius: var(--radius);
  margin: 0;
  font-size: 0.82rem;
  border-color: var(--border);
  color: var(--text-secondary);
  padding: 0.375rem 0.75rem;
  font-weight: 500;
  transition: all var(--transition);
}

.pagination .page-item.active .page-link {
  background-color: var(--emerald);
  border-color: var(--emerald);
  color: #fff;
  box-shadow: 0 1px 3px rgba(15, 81, 50, 0.2);
}

.pagination .page-link:hover {
  background-color: var(--emerald-subtle);
  color: var(--emerald);
  border-color: var(--emerald-subtle);
}

.pagination .page-item.disabled .page-link {
  color: var(--silver);
  background: var(--off-white);
}

/* Pagination result count */
.text-muted.text-center {
  font-size: 0.8rem;
  margin-top: 0.75rem;
}

/* ══════════════════════════════════════════════
   BADGE OVERRIDES
   ══════════════════════════════════════════════ */

.badge {
  font-weight: 600;
  font-size: 0.7rem;
  padding: 0.3em 0.6em;
  border-radius: var(--radius-sm);
  letter-spacing: 0.3px;
}

.bg-primary     { background-color: var(--emerald) !important; }
.text-primary   { color: var(--emerald) !important; }
.bg-dark        { background-color: var(--charcoal) !important; }
.border-primary { border-color: var(--emerald) !important; }

/* Info utilities → Charcoal */
.bg-info     { background-color: var(--charcoal) !important; }
.text-info   { color: var(--charcoal) !important; }
.border-info { border-color: var(--charcoal) !important; }

/* Opacity variants */
.bg-primary.bg-opacity-10 { background-color: var(--emerald-subtle) !important; }
.bg-info.bg-opacity-10    { background-color: rgba(31, 41, 51, 0.06) !important; }

/* ══════════════════════════════════════════════
   FOOTER
   ══════════════════════════════════════════════ */

.footer {
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border) !important;
  background: var(--surface);
  margin-left: 250px;
  transition: margin-left var(--transition-slow);
}

.sidebar.collapsed ~ .main-content ~ .footer,
.sidebar.collapsed ~ .footer {
  margin-left: 64px;
}

@media (max-width: 768px) {
  .footer { margin-left: 0 !important; }
}

[dir="rtl"] .footer {
  margin-left: 0;
  margin-right: 250px;
  transition: margin-right var(--transition-slow);
}

[dir="rtl"] .sidebar.collapsed ~ .main-content ~ .footer,
[dir="rtl"] .sidebar.collapsed ~ .footer {
  margin-right: 64px;
}

@media (max-width: 768px) {
  [dir="rtl"] .footer { margin-right: 0 !important; }
}

/* ══════════════════════════════════════════════
   DASHBOARD-SPECIFIC
   ══════════════════════════════════════════════ */

/* Summary big number cards (Open Maintenance, Scheduled Appointments) */
.display-4 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.display-5 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Quick action buttons — vertical stack */
.d-grid.gap-2 .btn {
  text-align: start;
  justify-content: flex-start;
}

/* Appointment date callout */
.bg-light.rounded {
  background-color: var(--off-white) !important;
  border: 1px solid var(--border);
  transition: background-color var(--transition);
}

.bg-light.rounded:hover {
  background-color: var(--emerald-subtle) !important;
}

/* ══════════════════════════════════════════════
   REPORTS PAGE – ICON CIRCLES
   ══════════════════════════════════════════════ */

.rounded-circle.d-inline-flex {
  transition: transform var(--transition);
}

.card:hover .rounded-circle.d-inline-flex {
  transform: scale(1.05);
}

/* ══════════════════════════════════════════════
   DETAIL PAGE REFINEMENTS
   ══════════════════════════════════════════════ */

/* DL-style detail lists */
dt, .fw-semibold {
  font-weight: 600;
}

/* ══════════════════════════════════════════════
   FORM FLOATING PLACEHOLDERS
   ══════════════════════════════════════════════ */

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ══════════════════════════════════════════════
   UTILITY ENHANCEMENTS
   ══════════════════════════════════════════════ */

/* Smoother shadow class */
.shadow-sm {
  box-shadow: var(--shadow-sm) !important;
}

/* bg-white card headers — ensure consistency */
.card-header.bg-white,
.bg-white {
  background-color: var(--surface) !important;
}

/* Table-responsive inside cards — no extra padding */
.card > .table-responsive {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.card > .table-responsive .table {
  margin-bottom: 0;
}

/* ══════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════ */

@media print {
  .sidebar, .navbar-top, .footer, .sidebar-overlay, .no-print { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; break-inside: avoid; }
  .table { font-size: 11px; }
  body { font-size: 12px; background: #fff !important; }
  a[href]:after { content: none !important; }
  .badge { border: 1px solid #999; }
  /* When a print-section exists, hide everything else and show only it */
  body:has(.print-section) .main-content > *:not(:has(.print-section)):not(.print-section) { display: none !important; }
  .print-section { display: block !important; }
}

/* Dashboard clickable cards */
.dashboard-clickable { transition: transform 0.15s, box-shadow 0.15s; cursor: pointer; }
.dashboard-clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; }

/* Global Search */
.search-result-item { transition: background-color 0.15s; }
.search-result-item:hover { background-color: var(--emerald-subtle, #d1e7dd); }

/* Notification dropdown */
.notification-dropdown .dropdown-item { transition: background-color 0.15s; }
.notification-dropdown .dropdown-item:hover { background-color: #f0f0f0; }
.notification-dropdown .dropdown-item.bg-light:hover { background-color: #e8e8e8 !important; }