:root {
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --border: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --primary: #f59e0b; /* Amber/Gold */
  --primary-hover: #d97706;
  --accent: #3b82f6; /* Blue */
  
  --status-available: #10b981; /* Green */
  --status-hold: #eab308; /* Yellow */
  --status-sold: #ef4444; /* Red */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
  user-select: none;
}

body {
  background-color: #020617;
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
  overflow-x: hidden;
}

/* Device Frame centering for desktop viewports */
.phone-container {
  width: 375px;
  height: 780px;
  border: 10px solid #1e293b;
  border-radius: 40px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  background-color: var(--bg-app);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

@media (max-width: 480px) {
  body {
    padding: 0;
    background-color: var(--bg-app);
  }
  .phone-container {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

/* Header design */
header {
  padding: 24px 20px 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-app);
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.brand i {
  color: var(--primary);
  width: 22px;
  height: 22px;
}

.brand h2 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.2px;
}

.sub-brand {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  font-weight: 600;
  text-transform: uppercase;
}

.role-badge {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--primary);
  border: 1px solid rgba(245, 158, 11, 0.2);
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.role-badge.admin {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  border-color: rgba(59, 130, 246, 0.2);
}

/* Pages Section Scrollable */
.app-pages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: 85px; /* space for tab bar */
}

/* Hide scrollbars but keep functionality */
.app-pages::-webkit-scrollbar {
  display: none;
}

.app-page {
  display: none;
  flex-direction: column;
  gap: 18px;
}

.app-page.active {
  display: flex;
}

/* Headings */
h3 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Interactive Plot map layout */
.page-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.page-title-row select {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.block-map-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.legend-item {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-item .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.green { background-color: var(--status-available); }
.dot.yellow { background-color: var(--status-hold); }
.dot.red { background-color: var(--status-sold); }

/* Plot Grid Map Layout */
.plots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.plot-item {
  aspect-ratio: 1;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.plot-item:active {
  transform: scale(0.92);
}

.plot-item .number {
  font-size: 12px;
  font-weight: 800;
  color: #fff;
}

.plot-item .status-label {
  font-size: 8px;
  font-weight: 600;
  opacity: 0.85;
  text-transform: uppercase;
}

.plot-item.available { background-color: rgba(16, 185, 129, 0.15); border-color: var(--status-available); color: var(--status-available); }
.plot-item.hold { background-color: rgba(234, 179, 8, 0.15); border-color: var(--status-hold); color: var(--status-hold); }
.plot-item.sold { background-color: rgba(239, 68, 68, 0.15); border-color: var(--status-sold); color: var(--status-sold); }

/* Plot Details slide up panel */
.plot-details-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.plot-details-panel.hidden {
  display: none !important;
}

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

.panel-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.close-panel-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.detail-row.hidden {
  display: none !important;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-val {
  font-weight: 600;
}

.status-indicator {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-indicator.available { background-color: rgba(16, 185, 129, 0.15); color: var(--status-available); }
.status-indicator.hold { background-color: rgba(234, 179, 8, 0.15); color: var(--status-hold); }
.status-indicator.sold { background-color: rgba(239, 68, 68, 0.15); color: var(--status-sold); }

.status-action-group {
  margin-top: 8px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-action-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.status-btn {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.status-btn:hover {
  opacity: 0.9;
}

.btn-green { background-color: var(--status-available); color: #fff; }
.btn-yellow { background-color: var(--status-hold); color: #000; }
.btn-red { background-color: var(--status-sold); color: #fff; }

/* Activity Log Form styles */
form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.activity-type-selector {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--bg-card);
}

.activity-type-selector input[type="radio"] {
  display: none;
}

.activity-type-selector label {
  flex: 1;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.activity-type-selector input[type="radio"]:checked + label {
  background-color: var(--primary);
  color: #000;
}

.form-group input, .form-group textarea {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  width: 100%;
}

.form-group input:focus, .form-group textarea:focus {
  border-color: var(--primary);
}

.form-group textarea {
  resize: none;
  min-height: 100px;
}

.submit-btn {
  background-color: var(--primary);
  color: #000;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s ease;
}

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

/* KPI Scorecard layout */
.kpi-scorecard {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kpi-gauge {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gauge-value {
  font-size: 20px;
  font-weight: 800;
  color: #fff;
}

.gauge-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.progress-bar-container {
  height: 6px;
  background-color: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease-in-out;
}

.progress-bar.bg-blue { background-color: var(--accent); }
.progress-bar.bg-purple { background-color: #a855f7; }
.progress-bar.bg-green { background-color: var(--status-available); }

.recent-activities-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
}

.recent-activities-card h4 {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.activities-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  font-size: 12px;
}

.activity-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.activity-item-header {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  margin-bottom: 2px;
}

.activity-notes {
  color: var(--text-secondary);
  font-size: 11px;
}

/* Admin Dashboard widgets */
.admin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.admin-metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-metric-lbl {
  font-size: 11px;
  color: var(--text-secondary);
}

.admin-metric-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.admin-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-section h4 {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.agent-table-wrapper {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

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

th {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  padding: 10px;
  font-weight: 700;
}

td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

tr:last-child td {
  border-bottom: none;
}

.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: monospace; }

/* Bottom navigation tab bar */
.tab-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 68px;
  border-top: 1px solid var(--border);
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 10;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  flex: 1;
}

.tab-item i {
  width: 20px;
  height: 20px;
}

.tab-item.active {
  color: var(--primary);
  font-weight: 700;
}

.tab-item.hidden {
  display: none !important;
}

/* Toast Notifications */
.toast {
  position: absolute;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 8px 16px rgba(0,0,0,0.4);
  z-index: 20;
}

.toast.show {
  opacity: 1;
  visibility: visible;
  bottom: 95px;
}

/* Keyframes */
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Generic Hidden Utility */
.hidden {
  display: none !important;
}

/* Modal Overlay & Card styling */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(2, 6, 23, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;
  animation: fadeIn 0.2s ease-out;
}

.modal-card {
  width: 320px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-body select {
  background-color: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  width: 100%;
}

/* DB Config Card styling */
.db-config-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.db-config-card select {
  background-color: var(--bg-app);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px;
  border-radius: 8px;
  font-size: 12px;
  outline: none;
  width: 100%;
}

.db-config-card input {
  background-color: var(--bg-app);
}

.action-btn {
  transition: all 0.2s ease;
}

.action-btn:active {
  transform: scale(0.97);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* View Toggle Buttons */
.view-toggle-buttons {
  display: flex;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  padding: 2px;
}

.toggle-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background-color: var(--primary);
  color: #000;
}

/* Map View Container */
.map-view-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-scroll-pane {
  width: 100%;
  height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background-color: #020617;
  display: flex;
  position: relative;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.map-scroll-pane::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.map-scroll-pane::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

.society-map-canvas {
  width: 650px;
  height: 650px;
  background-image: url('society_map.jpg');
  background-size: cover;
  background-position: center;
  position: relative;
  flex-shrink: 0;
}

/* Plot Markers / Pins */
.plot-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7px;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  transform: translate(-50%, -50%);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.plot-dot:hover {
  transform: translate(-50%, -50%) scale(1.3);
  z-index: 20;
}

.plot-dot.available {
  background-color: var(--status-available);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
}

.plot-dot.hold {
  background-color: var(--status-hold);
  color: #000;
  box-shadow: 0 0 8px rgba(234, 179, 8, 0.7);
}

.plot-dot.sold {
  background-color: var(--status-sold);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.7);
}

.plot-dot.selected {
  outline: 3px solid #ffffff;
  border-color: var(--primary);
  transform: translate(-50%, -50%) scale(1.3);
  z-index: 25;
}


