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

:root {
  --navy: #1a2332;
  --navy-light: #243347;
  --navy-dark: #111927;
  --gold: #c9a84c;
  --gold-light: #e0c06a;
  --gold-dark: #a8882e;
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f0f2f5;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --sidebar-width: 250px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 14px;
}

a { text-decoration: none; color: inherit; }

/* ===== AUTH / LOGIN ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  padding: 20px;
}

.auth-card {
  background: white;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .logo-icon {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.auth-logo .logo-icon svg { width: 32px; height: 32px; fill: var(--gold); }
.auth-logo h1 { font-size: 24px; font-weight: 700; color: var(--navy); }
.auth-logo p { font-size: 13px; color: var(--gray-500); margin-top: 4px; }

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-header {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo .logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gold);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo .logo-icon svg { width: 20px; height: 20px; fill: var(--navy); }
.sidebar-logo .logo-text h2 { font-size: 16px; font-weight: 700; color: white; }
.sidebar-logo .logo-text p { font-size: 11px; color: var(--gold); }

.sidebar-nav {
  flex: 1;
  padding: 16px 0;
  overflow-y: auto;
}

.nav-section {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
  font-size: 13px;
  font-weight: 500;
}

.nav-item:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-item.active { color: var(--gold); background: rgba(201,168,76,0.1); border-left-color: var(--gold); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-details .user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details .user-role { font-size: 11px; color: var(--gold); }

.btn-logout {
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}
.btn-logout:hover { color: var(--danger); }
.btn-logout svg { width: 18px; height: 18px; }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
}

.topbar-left p { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

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

.page-content {
  padding: 24px;
  flex: 1;
}

/* ===== CARDS ===== */
.card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 15px; font-weight: 600; color: var(--navy); }
.card-body { padding: 20px; }

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.navy { background: rgba(26,35,50,0.1); }
.stat-icon.navy svg { fill: var(--navy); }
.stat-icon.gold { background: rgba(201,168,76,0.15); }
.stat-icon.gold svg { fill: var(--gold-dark); }
.stat-icon.success { background: rgba(34,197,94,0.12); }
.stat-icon.success svg { fill: var(--success); }
.stat-icon.info { background: rgba(59,130,246,0.12); }
.stat-icon.info svg { fill: var(--info); }

.stat-info .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
}
.stat-info .stat-label {
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: var(--gray-50);
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending { background: rgba(245,158,11,0.12); color: #b45309; }
.badge-confirmed { background: rgba(59,130,246,0.12); color: #1d4ed8; }
.badge-completed { background: rgba(34,197,94,0.12); color: #15803d; }
.badge-cancelled { background: rgba(239,68,68,0.12); color: #b91c1c; }
.badge-active { background: rgba(34,197,94,0.12); color: #15803d; }
.badge-inactive { background: rgba(156,163,175,0.2); color: #4b5563; }
.badge-admin { background: rgba(201,168,76,0.2); color: var(--gold-dark); }
.badge-agent { background: rgba(59,130,246,0.12); color: #1d4ed8; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.form-label .required { color: var(--danger); margin-left: 3px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 13px;
  color: var(--gray-700);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-hint { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-light); }

.btn-navy { background: var(--navy); color: white; border-color: var(--navy); }
.btn-navy:hover { background: var(--navy-light); }

.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; }

.btn-outline { background: white; color: var(--navy); border-color: var(--gray-300); }
.btn-outline:hover { border-color: var(--navy); background: var(--gray-50); }

.btn-ghost { background: none; border-color: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

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

.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: transform 0.2s;
}

.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 720px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 600; color: var(--navy); }

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all 0.2s;
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-700); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; gap: 8px; justify-content: flex-end; }

/* ===== SEARCH & FILTERS ===== */
.filters-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}

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

.search-input svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  fill: var(--gray-400);
}

.search-input input {
  padding-left: 34px;
  width: 100%;
}

/* ===== CALENDAR ===== */
.calendar-container { background: white; border-radius: 12px; border: 1px solid var(--gray-200); }
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.calendar-title { font-size: 16px; font-weight: 600; color: var(--navy); }
.calendar-grid { padding: 16px; }
.calendar-header-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 4px; }
.calendar-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  padding: 6px 0;
  text-transform: uppercase;
}
.calendar-days-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.calendar-day {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
  font-weight: 500;
}
.calendar-day.empty { cursor: default; }
.calendar-day.available { color: var(--gray-700); }
.calendar-day.available:hover { background: var(--gray-100); }
.calendar-day.reserved { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.calendar-day.reserved:hover { background: rgba(59,130,246,0.25); }
.calendar-day.blocked { background: rgba(239,68,68,0.12); color: #b91c1c; }
.calendar-day.today { border: 2px solid var(--gold); }
.calendar-day.past { color: var(--gray-300); cursor: default; }

.calendar-legend {
  display: flex;
  gap: 16px;
  padding: 12px 20px;
  border-top: 1px solid var(--gray-200);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-600); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; }
.legend-dot.available { background: var(--success); }
.legend-dot.reserved { background: var(--info); }
.legend-dot.blocked { background: var(--danger); }

/* ===== PROPERTY CARD ===== */
.properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.property-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.property-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.1); }

.property-image {
  height: 160px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.property-image img { width: 100%; height: 100%; object-fit: cover; }
.property-image .no-photo { color: rgba(255,255,255,0.3); }
.property-image .no-photo svg { width: 48px; height: 48px; fill: currentColor; }

.property-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
}

.property-info { padding: 16px; }
.property-name { font-size: 15px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.property-location { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.property-location svg { width: 12px; height: 12px; fill: var(--gray-400); }

.property-meta { display: flex; gap: 12px; margin-bottom: 12px; }
.property-meta-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gray-600); }
.property-meta-item svg { width: 14px; height: 14px; fill: var(--gray-400); }

.property-price { font-size: 18px; font-weight: 700; color: var(--navy); }
.property-price span { font-size: 12px; font-weight: 400; color: var(--gray-500); }

.property-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-success { background: #ecfdf5; color: #065f46; border-left: 4px solid var(--success); }
.toast-error { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.toast-info { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info); }
.toast-warning { background: #fffbeb; color: #92400e; border-left: 4px solid var(--warning); }
.toast svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state svg { width: 48px; height: 48px; fill: var(--gray-300); margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--gray-600); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ===== RESPONSIVE ===== */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger svg { width: 24px; height: 24px; fill: var(--navy); }

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .hamburger {
    display: flex;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }
  .sidebar-overlay.open {
    display: block;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .page-content { padding: 16px; }
}

/* ===== MISC ===== */
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }

.text-gold { color: var(--gold-dark); }
.text-navy { color: var(--navy); }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 12px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--gray-400);
  gap: 10px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.photo-thumb {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--gray-200);
}

.photo-thumb-wrap {
  position: relative;
}

.photo-thumb-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  background: var(--danger);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
}

/* Charts */
.chart-bar-wrap { margin-top: 8px; }
.chart-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.chart-label { width: 30px; font-size: 11px; color: var(--gray-500); text-align: right; flex-shrink: 0; }
.chart-bar-bg { flex: 1; height: 28px; background: var(--gray-100); border-radius: 6px; overflow: hidden; }
.chart-bar-fill { height: 100%; background: linear-gradient(90deg, var(--navy), var(--navy-light)); border-radius: 6px; display: flex; align-items: center; padding: 0 8px; min-width: 40px; }
.chart-bar-fill span { font-size: 11px; color: white; font-weight: 600; }
.chart-bar-val { width: 70px; font-size: 12px; color: var(--gray-600); flex-shrink: 0; }

/* Tab nav */
.tab-nav { display: flex; border-bottom: 1px solid var(--gray-200); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--gold-dark); border-bottom-color: var(--gold); }
