/**
 * JUARA LIVING - Property Management System
 * Main Theme Stylesheet v1.1
 * Colors: Navy Blue (#0B2545), Living Red (#D90429), Swoop Gold (#F59E0B)
 */

:root {
  --primary:        #0B2545; /* Juara Navy */
  --primary-dark:   #06182C;
  --primary-light:  #134074;
  --accent-red:     #D90429; /* Living Red */
  --accent-gold:    #F59E0B; /* Swoop Gold */
  --secondary:      #64748B;
  --success:        #16A34A;
  --danger:         #D90429;
  --warning:        #D97706;
  --info:           #0284C7;
  --purple:         #7C3AED;
  --dark:           #07192F; /* Deep Navy Dark */
  --light:          #F8FAFC;
  --sidebar-width:  260px;
  --topbar-height:  64px;
}

body {
  background-color: #f1f5f9;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #1e293b;
  margin: 0;
  padding: 0;
}

/* ─── AUTH / LOGIN PAGE ─────────────────────────────────────────────────── */
body.auth-page, .login-wrapper {
  background: linear-gradient(135deg, #07192F 0%, #0B2545 60%, #134074 100%) !important;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #ffffff;
  border-radius: 20px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25) !important;
  max-width: 440px;
  width: 100%;
  margin: 1.5rem auto;
}

/* ─── SIDEBAR ───────────────────────────────────────────────────────────── */
#sidebar, nav.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--dark);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

#sidebar .sidebar-brand {
  padding: 1.25rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}
#sidebar .sidebar-brand img {
  max-height: 48px;
  width: auto;
  object-fit: contain;
}
#sidebar .sidebar-brand-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 5px;
}

#sidebar .sidebar-nav {
  padding: 0.5rem 0;
  flex-grow: 1;
}

#sidebar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  border-radius: 0;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
#sidebar .nav-link i {
  font-size: 1.05rem;
  min-width: 1.2rem;
  color: rgba(255, 255, 255, 0.7);
}
#sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}
#sidebar .nav-link:hover i {
  color: #ffffff;
}
#sidebar .nav-link.active {
  background: linear-gradient(90deg, rgba(19, 64, 116, 0.95) 0%, rgba(11, 37, 69, 0.7) 100%) !important;
  color: #ffffff !important;
  font-weight: 600;
  border-left: 3px solid var(--accent-red) !important;
}
#sidebar .nav-link.active i {
  color: #ffffff !important;
}

#sidebar .sidebar-divider {
  font-size: 0.68rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1.2rem 1.25rem 0.4rem;
  list-style: none;
}

#sidebar .sidebar-footer {
  margin-top: auto;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
#sidebar .sidebar-footer .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.82rem;
}
#sidebar .sidebar-footer .btn-outline-light:hover {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #ffffff;
}

/* ─── TOPBAR ────────────────────────────────────────────────────────────── */
.topbar, #topbar, nav.topbar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
}

.topbar .navbar-brand {
  text-decoration: none;
}
.topbar .navbar-brand img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

/* ─── DESKTOP LAYOUT (>= 992px) — SIDEBAR BESIDE CONTENT ──────────────── */
@media (min-width: 992px) {
  /* Body indents by sidebar width so content is NEVER overlapped */
  body.has-sidebar {
    padding-left: var(--sidebar-width) !important;
    transition: padding-left 0.25s ease;
  }

  /* When collapsed by user clicking toggle button */
  body.has-sidebar.sidebar-collapsed {
    padding-left: 0 !important;
  }
  body.has-sidebar.sidebar-collapsed #sidebar,
  body.has-sidebar.sidebar-collapsed nav.sidebar {
    transform: translateX(-100%) !important;
  }

  #sidebar, nav.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    z-index: 1040 !important;
    transform: translateX(0) !important;
    transition: transform 0.25s ease;
  }

  .topbar, #topbar, nav.topbar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: var(--topbar-height) !important;
    background: #ffffff !important;
    z-index: 1020 !important;
    border-bottom: 1px solid #e2e8f0;
  }

  /* Content fills 100% of the body's indented width without overlap */
  .wrapper,
  .content-wrapper,
  #main-content,
  .main-content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* ─── MOBILE LAYOUT (< 992px) ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  body.has-sidebar {
    padding-left: 0 !important;
  }

  #sidebar, nav.sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--sidebar-width) !important;
    height: 100vh !important;
    z-index: 1050 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s ease;
  }
  #sidebar.show, nav.sidebar.show {
    transform: translateX(0) !important;
  }

  .topbar, #topbar, nav.topbar {
    position: sticky !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: var(--topbar-height) !important;
    background: #ffffff !important;
    z-index: 1020 !important;
    border-bottom: 1px solid #e2e8f0;
  }

  .wrapper,
  .content-wrapper,
  #main-content,
  .main-content {
    margin-left: 0 !important;
    margin-top: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .wrapper .main-content {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* Overlay */
#overlay, #sidebarOverlay, .sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 25, 47, 0.6);
  backdrop-filter: blur(2px);
  z-index: 1045;
}
#overlay.show, #sidebarOverlay.show, .sidebar-overlay.show {
  display: block;
}

/* ─── THEME COLOR OVERRIDES ─────────────────────────────────────────────── */
.text-primary {
  color: var(--primary) !important;
}
.bg-primary {
  background-color: var(--primary) !important;
}
.border-primary {
  border-color: var(--primary) !important;
}

.btn-primary {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(11, 37, 69, 0.2);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--primary-light) !important;
  border-color: var(--primary-light) !important;
  color: #ffffff !important;
}

.btn-outline-primary {
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-outline-primary:hover {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}

.badge.bg-primary {
  background-color: var(--primary) !important;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(11, 37, 69, 0.25);
}

/* ─── CARDS & COMPONENTS ────────────────────────────────────────────────── */
.card {
  border: none !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
  background: #ffffff;
}
.card-header {
  background: #ffffff !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 1rem 1.25rem !important;
  font-weight: 600;
}
.stat-card {
  border-radius: 12px !important;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(11, 37, 69, 0.1) !important;
}

/* ─── ROOM GRID (VISUAL MONITORING) ─────────────────────────────────────── */
.room-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.room-card {
  min-width: 105px;
  max-width: 135px;
  flex: 1;
  border-radius: 10px;
  padding: 0.75rem 0.6rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  color: #ffffff;
  text-align: center;
  border: 2px solid transparent;
  position: relative;
}
.room-card:hover {
  transform: scale(1.04);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}
.room-card .room-number {
  font-size: 1.05rem;
  font-weight: 700;
}
.room-card .room-name {
  font-size: 0.68rem;
  margin-top: 0.25rem;
  opacity: 0.92;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.room-paid        { background: #15803D; } /* Hijau Lunas */
.room-unpaid      { background: #DC2626; } /* Merah Belum Bayar */
.room-partial     { background: #D97706; } /* Oranye Sebagian */
.room-pending     { background: #0284C7; } /* Biru Menunggu Verifikasi */
.room-occupied    { background: #0F766E; }
.room-available   { background: #94A3B8; } /* Abu-abu Kosong */
.room-maintenance { background: #7C3AED; } /* Ungu Perbaikan */

/* ─── TABLES & FORMS ────────────────────────────────────────────────────── */
.table th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--secondary);
  border-bottom-width: 1px !important;
  white-space: nowrap;
}
.table td {
  font-size: 0.875rem;
  vertical-align: middle;
}
.table-hover tbody tr:hover {
  background-color: #f8fafc;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark);
}
.form-control, .form-select {
  border-color: #e2e8f0;
  border-radius: 8px;
  font-size: 0.875rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(11, 37, 69, 0.15);
}

/* ─── SCROLLBAR ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
#sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}
