:root{
  --bg: #f6f8fb;
  --surface: #1f2937; /* dark nav */
  --muted: #6b7280;
  --accent: #0ea5a4; /* teal */
  --accent-2: #6366f1; /* indigo */
  --card: #ffffff;
  --text: #0f172a;
  --shadow: 0 6px 18px rgba(15,23,42,0.08);
}

*{box-sizing: border-box}
html,body{height:100%}
body{
  margin:0; padding:0; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
  color:var(--text); -webkit-font-smoothing:antialiased;
  font-size:13px; /* slightly more compact overall */
}

nav{ position:relative; background:linear-gradient(90deg,var(--accent-2),var(--accent)); color: white; padding: 12px 20px; display:block }

.nav-row{ display:flex; align-items:center; gap:12px; position:relative }

/* left area: only as wide as the tab buttons */
.nav-left{ display:flex; gap:8px; align-items:center; flex:0 0 auto }
.nav-left button{ background:transparent; border:none; color:rgba(255,255,255,0.95); font-size:13px; cursor:pointer; padding:6px 10px; border-radius:8px }
.nav-left button:hover{ background: rgba(255,255,255,0.06); }
.nav-left button.active{ background: rgba(255,255,255,0.12); box-shadow: var(--shadow); font-weight:600; }

/* center area expands to take remaining space and centers the title */
.nav-center{ display:flex; justify-content:center; align-items:center; flex:1 1 auto; min-width:0 }
.nav-title{ background: rgba(255,255,255,0.12); padding:10px 20px; border-radius:20px; font-weight:700; font-size:20px; box-shadow: var(--shadow); white-space:nowrap }

/* right area: only as wide as controls */
.nav-right{ display:flex; gap:10px; align-items:center; flex:0 0 auto }
.user-area{ display:flex; gap:8px; align-items:center }

/* theme toggle */
#theme-toggle{ background: rgba(255,255,255,0.06); padding:6px 8px; border-radius:8px; display:inline-flex; gap:8px; align-items:center }
#theme-toggle svg{ width:16px; height:16px }

/* ensure buttons inside nav follow consistent visual style when moved */
.nav-right button, .nav-left button{ color:rgba(255,255,255,0.95); }

.container{ max-width:1100px; margin:18px auto; padding:0 18px; }
section{ display:none; padding:18px 0; }
section.active{ display:block; }

/* Form styling */
form{ background:var(--card); padding:14px; border-radius:10px; box-shadow: var(--shadow); }
form > div{ margin-bottom:10px }
input[type="text"], input[type="number"], select, textarea{ width:100%; padding:8px 10px; border:1px solid #e6e9ef; border-radius:8px; outline:none; font-size:13px }
input[type="file"]{ font-size:13px }
button[type="submit"], button{ background:var(--accent); color:white; border:none; padding:8px 12px; border-radius:8px; cursor:pointer; }
button.secondary{ background:transparent; border:1px solid #e6e9ef; color:var(--text); padding:6px 10px }

/* utilities */
.hidden{ display:none !important }
.mb-10{ margin-bottom:10px }

/* Table */
.table-card{ margin-top:14px; background:var(--card); padding:12px; border-radius:10px; box-shadow: var(--shadow); }
table{ width:100%; border-collapse:collapse; }
th, td{ text-align:left; padding:8px; border-bottom:1px solid #f1f5f9; font-size:13px }
tr:nth-child(even) td{ background:transparent }

/* Gallery - keep slightly larger font for visual variety */
#gallery-wrapper{ display:flex; gap:20px; align-items:flex-start }
#gallery-cards-container{ flex-grow: 1; overflow-y: auto; max-height: 600px; }
#gallery-cards{ display:grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap:12px }
.gallery-card{ background:var(--card); border-radius:10px; padding:12px; min-height:120px; display:flex; flex-direction:column; justify-content:space-between; box-shadow: var(--shadow); transition: transform 0.16s ease, box-shadow 0.16s ease; border:1px solid #eef2f7; font-size:14px }
.gallery-card:hover{ transform: translateY(-6px); box-shadow: 0 12px 30px rgba(15,23,42,0.12); }
.gallery-card .thumbnail{ max-width:100%; max-height:110px; object-fit:cover; border-radius:6px; margin-top:8px }

/* small helpers for gallery card content */
.select-checkbox{ margin-bottom:8px }
.card-title{ font-weight:600 }
.card-summary{ font-size:13px; color:var(--muted) }

#gallery-detail{ background:var(--card); padding:12px; border-radius:10px; box-shadow: var(--shadow); width:320px; position:sticky; top:10px; height:600px; overflow-y:auto }

/* detailed image inside the detail pane */
.detail-image{ max-width:100%; margin-bottom:10px; border:1px solid #ccc; border-radius:6px }

/* Summary chart */
#summary-chart{ background:var(--card); padding:12px; border-radius:10px; box-shadow: var(--shadow); height:400px }

/* Map container and controls */
.map-controls{ margin-top:10px; display:flex; align-items:center; gap:8px }
#map-container{ height:320px; margin-top:8px; border-radius:10px; overflow:hidden; box-shadow: var(--shadow); }
#map-container .leaflet-container{ height:100% !important; }
#geocode-status{ margin-left:12px }


/* Responsive tweaks */
@media (max-width:900px){
  #gallery-wrapper{ flex-direction:column }
  #gallery-detail{ width:100%; position:static; height:auto }
  .nav-title{ position:static; transform:none; margin-right:auto }
}

/* Small utilities */
.muted{ color:var(--muted) }
.small{ font-size:12px }

/* improve delete button */
.delete-entry{ background:transparent; color:#ef4444; border:1px solid rgba(239,68,68,0.12); padding:6px 8px; border-radius:8px }
.delete-entry:hover{ background:rgba(239,68,68,0.06) }

/* Login overlay */
.login-screen{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(2,6,23,0.5); z-index:1000; }
.login-form{ background:var(--card); padding:20px; border-radius:12px; box-shadow:var(--shadow); min-width:280px }
.login-form h2{ margin:0 0 10px 0 }
.login-form input{ width:100%; margin-top:6px }

/* Confirm modal */
.confirm-modal{ position:fixed; inset:0; display:flex; align-items:center; justify-content:center; background:rgba(2,6,23,0.35); z-index:1100; opacity:0; pointer-events:none; transition:opacity 0.12s ease }
.confirm-modal.visible{ opacity:1; pointer-events:auto }
.confirm-box{ background:var(--card); padding:16px; border-radius:10px; box-shadow:var(--shadow); min-width:300px }
.confirm-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:12px }

/* Dark theme overrides */
[data-theme="dark"]{
  --bg: #0b1220;
  --surface: #0b1220;
  --muted: #9aa4b2;
  --accent: #06b6d4;
  --accent-2: #7c3aed;
  --card: #0f172a;
  --text: #e6eef6;
  --shadow: 0 10px 30px rgba(2,6,23,0.6);
}

[data-theme="dark"] body{ background: linear-gradient(180deg, #071022 0%, var(--bg) 100%); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea{ background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.06); color:var(--text) }
[data-theme="dark"] .table-card, [data-theme="dark"] .gallery-card, [data-theme="dark"] #gallery-detail, [data-theme="dark"] #summary-chart{ background:var(--card) }
