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

/* LiveLefkada Admin Panel - Modern Clean Theme */
:root {
  /* Color Palette */
  --primary: #4f46e5;       /* Indigo 600 */
  --primary-dark: #4338ca;  /* Indigo 700 */
  --primary-light: #818cf8; /* Indigo 400 */
  --accent: #c7d2fe;        /* Indigo 200 */
  
  --success: #10b981;       /* Emerald 500 */
  --success-bg: #d1fae5;    /* Emerald 100 */
  --success-text: #065f46;  /* Emerald 800 */
  
  --warning: #f59e0b;       /* Amber 500 */
  --warning-bg: #fef3c7;    /* Amber 100 */
  --warning-text: #92400e;  /* Amber 800 */
  
  --danger: #ef4444;        /* Red 500 */
  --danger-bg: #fee2e2;     /* Red 100 */
  --danger-text: #991b1b;   /* Red 800 */

  --info-bg: #e0e7ff;       /* Indigo 100 */
  --info-text: #3730a3;     /* Indigo 800 */
  
  /* Gray Scale */
  --bg: #f8fafc;            /* Slate 50 */
  --white: #ffffff;
  --card: #ffffff;
  
  --text: #1e293b;          /* Slate 800 */
  --text-secondary: #64748b;/* Slate 500 */
  --border: #e2e8f0;        /* Slate 200 */
  
  /* Sidebar dark */
  --sidebar-bg: #0f172a;    /* Slate 900 */
  --sidebar-text: #94a3b8;  /* Slate 400 */
  --sidebar-text-hover: #f1f5f9; /* Slate 100 */
  --sidebar-active-bg: #1e293b; /* Slate 800 */
  --sidebar-active-border: #6366f1; /* Indigo 500 */
  
  /* Layout constraints */
  --sidebar-w: 260px;
  --header-h: 70px;
  
  /* Border Radius & Shadows */
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { 
  color: var(--primary); 
  text-decoration: none; 
  transition: color 0.2s;
}
a:hover { 
  color: var(--primary-dark); 
}

/* ── Login ─────────────────────────────────────────── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 400px;
  max-width: 90vw;
  box-shadow: var(--shadow-md);
  text-align: center;
  border: 1px solid var(--border);
}
.login-card h1 { 
  font-size: 24px; 
  margin-bottom: 8px; 
  font-weight: 700;
  color: var(--text);
}
.login-card .subtitle { 
  color: var(--text-secondary); 
  margin-bottom: 32px; 
  font-size: 14px; 
}
.login-card .logo { 
  font-size: 48px; 
  margin-bottom: 24px; 
}
.login-card .form-group {
  text-align: left;
}
.login-card .btn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  margin-top: 16px;
  font-size: 15px;
}

/* ── Layout ────────────────────────────────────────── */
.layout { 
  display: flex; 
  min-height: 100vh; 
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
  box-shadow: 4px 0 10px rgba(0,0,0,0.05);
}
.sidebar-brand {
  height: var(--header-h);
  padding: 0 24px;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand span { 
  font-size: 24px; 
}
.sidebar-nav { 
  flex: 1; 
  padding: 24px 0; 
  overflow-y: auto; 
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,0.03);
  color: var(--sidebar-text-hover);
}
.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--white);
  border-left-color: var(--sidebar-active-border);
}
.sidebar-nav a .icon { 
  font-size: 18px; 
  width: 24px; 
  text-align: center; 
  opacity: 0.8;
}
.sidebar-nav a.active .icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar h2 { 
  font-size: 18px; 
  font-weight: 600; 
  color: var(--text);
}
.topbar-right { 
  display: flex; 
  align-items: center; 
  gap: 20px; 
}

.page-content { 
  padding: 32px; 
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* ── Hamburger (mobile) ────────────────────────────── */
.hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text);
  padding: 4px;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 99;
}

/* ── Forms ──────────────────────────────────────────── */
.form-group { 
  margin-bottom: 20px; 
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.form-row { 
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 20px; 
}
.form-row-3 { 
  display: grid; 
  grid-template-columns: 1fr 1fr 1fr; 
  gap: 20px; 
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}
input::placeholder, textarea::placeholder {
  color: #94a3b8;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}
textarea { 
  resize: vertical; 
  min-height: 100px; 
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.switch-row:last-child {
  border-bottom: none;
}
.switch {
  position: relative;
  width: 44px;
  height: 24px;
}
.switch input { 
  opacity: 0; 
  width: 0; 
  height: 0; 
}
.switch .slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 24px;
  cursor: pointer;
  transition: 0.3s ease;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 18px; 
  height: 18px;
  left: 3px; 
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.switch input:checked + .slider { 
  background: var(--success); 
}
.switch input:checked + .slider::before { 
  transform: translateX(20px); 
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  line-height: 1.2;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary { 
  background: var(--primary); 
  color: white; 
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { 
  background: var(--primary-dark); 
}
.btn-success { 
  background: var(--success); 
  color: white; 
}
.btn-success:hover { background: #059669; }
.btn-warning { 
  background: var(--warning); 
  color: white; 
}
.btn-warning:hover { background: #d97706; }
.btn-danger { 
  background: var(--danger); 
  color: white; 
}
.btn-danger:hover { background: #dc2626; }
.btn-outline {
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover { 
  background: var(--bg); 
  border-color: #cbd5e1;
}
.btn-sm { 
  padding: 8px 14px; 
  font-size: 13px; 
}
.btn-icon { 
  padding: 8px; 
  min-width: 36px; 
}

/* ── Cards & Stats ─────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.03);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: transform 0.2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.stat-icon.blue { background: var(--info-bg); color: var(--info-text); }
.stat-icon.green { background: var(--success-bg); color: var(--success-text); }
.stat-icon.orange { background: var(--warning-bg); color: var(--warning-text); }
.stat-icon.cyan { background: #e0f2fe; color: #0369a1; }
.stat-icon.red { background: var(--danger-bg); color: var(--danger-text); }
.stat-info h3 { 
  font-size: 28px; 
  font-weight: 700; 
  line-height: 1.1; 
  color: var(--text);
  letter-spacing: -0.5px;
}
.stat-info p { 
  font-size: 13px; 
  font-weight: 500;
  color: var(--text-secondary); 
  margin-top: 4px; 
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid rgba(0,0,0,0.03);
  margin-bottom: 24px;
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { 
  font-size: 16px; 
  font-weight: 600; 
  color: var(--text);
}
.card-body { 
  padding: 24px; 
}

/* ── Tables ────────────────────────────────────────── */
.table-wrapper { 
  overflow-x: auto; 
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}
thead th {
  padding: 16px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
tbody tr {
  transition: background-color 0.15s ease;
}
tbody tr:hover { 
  background: #f1f5f9; 
}
tbody tr:last-child td { 
  border-bottom: none; 
}
td .actions {
  display: flex;
  gap: 8px;
}

/* ── Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.badge-active { background: var(--success-bg); color: var(--success-text); }
.badge-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-rejected { background: var(--danger-bg); color: var(--danger-text); }
.badge-paused { background: #f1f5f9; color: var(--text-secondary); }
.badge-admin { background: var(--danger-bg); color: var(--danger-text); }
.badge-superuser { background: #f3e8ff; color: #7e22ce; }
.badge-operator { background: var(--warning-bg); color: var(--warning-text); }
.badge-user { background: var(--info-bg); color: var(--info-text); }
.badge-verified { background: var(--success-bg); color: var(--success-text); }
.badge-unverified { background: #f1f5f9; color: var(--text-secondary); }

/* ── Search / Toolbar ──────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.toolbar > div {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.search-input {
  min-width: 300px;
  position: relative;
}
.search-input input { 
  padding-left: 40px; 
  padding-right: 16px;
  height: 40px;
  border-radius: var(--radius-sm);
}
.search-input .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 16px;
}
.filter-select { 
  min-width: 180px; 
  height: 40px;
}

/* ── Modal ─────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.modal-backdrop.show { 
  display: flex; 
  opacity: 1;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 600px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateY(20px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-backdrop.show .modal {
  transform: translateY(0);
}
.modal-lg { width: 900px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
  position: sticky;
  top: 0;
  z-index: 10;
}
.modal-header h3 { 
  font-size: 18px; 
  font-weight: 600; 
  color: var(--text);
}
.modal-close {
  background: var(--bg);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}
.modal-close:hover {
  background: #e2e8f0;
  color: var(--text);
}
.modal-body { 
  padding: 24px; 
}
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* ── Map ───────────────────────────────────────────── */
#polygon-map {
  width: 100%;
  height: 400px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ── Toast ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.toast {
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  background-size: contain;
}
.toast-success { background: var(--text); }
.toast-success::before { content: '✅'; }
.toast-error { background: var(--danger); }
.toast-error::before { content: '❌'; }
.toast-info { background: var(--primary); }
.toast-info::before { content: 'ℹ️'; }

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

/* ── Loading ───────────────────────────────────────── */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}
@keyframes spin { 
  to { transform: rotate(360deg); } 
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius);
}

/* ── Empty State ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}
.empty-state .icon { 
  font-size: 48px; 
  margin-bottom: 16px; 
  opacity: 0.8;
}
.empty-state h3 { 
  font-size: 18px; 
  color: var(--text); 
  margin-bottom: 8px; 
  font-weight: 600;
}
.empty-state p {
  font-size: 14px;
}

/* ── Utilities ─────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .hamburger { display: block; }
  .page-content { padding: 24px; }
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .modal-lg { width: 95vw; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search-input { min-width: 100%; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .toast-container { right: 16px; left: 16px; top: 16px; }
  .toast { min-width: 100%; }
}