/* admin/styles.css */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --bg-dark: #0f172a;
  --sidebar-bg: #1e293b;
  --main-bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--main-bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--sidebar-bg);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon { font-size: 28px; }

.brand-title {
  font-size: 16px;
  font-weight: 700;
  display: block;
  color: #ffffff;
}

.brand-sub {
  font-size: 11px;
  color: #94a3b8;
  display: block;
}

.nav-menu {
  padding: 20px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.nav-item.active {
  background: var(--primary);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.nav-icon { font-size: 18px; }

.badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.green {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.api-link { margin-top: 10px; }
.api-link a { color: #60a5fa; text-decoration: none; }

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-header {
  background: #ffffff;
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.header-left h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.header-desc {
  font-size: 12px;
  color: var(--text-muted);
}

/* Content Views */
.content-view {
  display: none;
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

.content-view.active { display: block; }

/* Filter Panel */
.filter-panel {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  border: 1px solid var(--border);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.filter-item label {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.input-control, .select-control {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #ffffff;
  outline: none;
  font-size: 13px;
  transition: border-color 0.2s;
}

.input-control:focus, .select-control:focus {
  border-color: var(--primary);
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 4px;
}

.range-inputs input {
  width: 75px;
}

.action-btns {
  margin-left: auto;
}

.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-default {
  background: #f1f5f9;
  color: #475569;
}

.btn-default:hover {
  background: #e2e8f0;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  cursor: pointer;
}

/* Metrics Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.metric-card {
  border-radius: var(--radius-lg);
  padding: 24px;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.bg-blue-grad { background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%); }
.bg-emerald-grad { background: linear-gradient(135deg, #064e3b 0%, #10b981 100%); }
.bg-purple-grad { background: linear-gradient(135deg, #4c1d95 0%, #8b5cf6 100%); }
.bg-amber-grad { background: linear-gradient(135deg, #78350f 0%, #f59e0b 100%); }

.metric-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-title { font-size: 13px; opacity: 0.9; }
.metric-badge {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

.metric-value-row {
  margin-top: 14px;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.metric-val { font-size: 36px; font-weight: 800; }
.metric-unit { font-size: 14px; }
.metric-footer { margin-top: 12px; font-size: 12px; opacity: 0.85; }

/* Panels & Cards */
.panel-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.ml-2 { margin-left: 8px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h3 { font-size: 16px; font-weight: 700; }
.update-tag { font-size: 12px; color: var(--text-muted); }

.district-cards-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}

.district-card {
  background: var(--main-bg);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border);
  text-align: center;
}

.district-card .d-name { font-size: 13px; color: var(--text-muted); }
.district-card .d-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 6px;
}

/* Tables */
.table-container {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: #f1f5f9;
  color: #475569;
  font-weight: 600;
  padding: 14px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover { background: #f8fafc; }

.project-link {
  color: #2563eb;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.project-link:hover {
  color: #1d4ed8;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: #ffffff;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.page-info { color: var(--text-muted); }

.page-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  font-size: 12px;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
}

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

.page-num { color: var(--text-muted); margin: 0 4px; }

/* Badges & Tags */
.tag-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-green { background: #d1fae5; color: #065f46; }
.tag-orange { background: #ffedd5; color: #9a3412; }
.tag-purple { background: #f3e8ff; color: #6b21a8; }
.tag-gray { background: #f1f5f9; color: #475569; }

.price-text { color: #dc2626; font-weight: 700; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

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

.modal-container {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 920px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

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

.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-muted);
}

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

/* Building & House Matrix Styles */
.bldg-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
}

.bldg-tab-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.bldg-tab-btn:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.bldg-tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.house-matrix-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.house-matrix-table th {
  background: #f1f5f9;
  padding: 10px 14px;
  font-size: 12px;
  color: #475569;
  border: 1px solid var(--border);
}

.house-matrix-table td {
  padding: 10px 14px;
  font-size: 12px;
  border: 1px solid var(--border);
  text-align: center;
}

.room-card {
  padding: 6px;
  border-radius: 6px;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
}
