/* ===== DESA RAME - STYLES ===== */
:root {
  --green-900: #1a3c2a;
  --green-800: #234d36;
  --green-700: #2d6a4f;
  --green-600: #40916c;
  --green-500: #52b788;
  --green-100: #d8f3dc;
  --green-50: #f0fdf4;
  --earth: #8b5e3c;
  --earth-light: #c4a484;
  --gold: #e9c46a;
  --cream: #fefae0;
  --white: #ffffff;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-500: #6c757d;
  --gray-800: #212529;
  --danger: #e63946;
  --shadow: 0 4px 20px rgba(0,0,0,0.12);
  --radius: 16px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--green-50);
  color: var(--gray-800);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  color: white;
  box-shadow: var(--shadow);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.tagline {
  font-size: 0.7rem;
  opacity: 0.85;
  margin-top: 2px;
}

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

.warga-badge {
  background: rgba(255,255,255,0.18);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
}

.warga-count {
  font-weight: 700;
  font-size: 1.1rem;
}

.warga-label {
  font-size: 0.75rem;
  opacity: 0.9;
}

.btn-admin {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.2rem;
  transition: background 0.2s;
}

.btn-admin:hover {
  background: rgba(255,255,255,0.35);
}

/* ===== MAP ===== */
.map-container {
  position: relative;
  width: 100%;
  height: 100vh;
  padding-top: 64px;
  overflow: hidden;
  background: linear-gradient(180deg, #a8e6cf 0%, #88d4ab 40%, #6bbf8a 100%);
}

.map-wrapper {
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  position: relative;
}

.map-wrapper:active {
  cursor: grabbing;
}

.map-canvas {
  position: absolute;
  width: 1200px;
  height: 900px;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0.85);
  transform-origin: center center;
  transition: transform 0.15s ease-out;
  background: 
    radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.25) 0%, transparent 50%),
    linear-gradient(180deg, #7dcea0 0%, #52b788 60%, #40916c 100%);
  border-radius: 24px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.08);
  border: 6px solid var(--earth);
}

/* Decorative elements on map */
.map-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(circle at 15% 25%, rgba(255,255,255,0.15) 0%, transparent 8%),
    radial-gradient(circle at 80% 15%, rgba(255,255,255,0.12) 0%, transparent 6%),
    radial-gradient(circle at 60% 70%, rgba(0,0,0,0.04) 0%, transparent 12%);
  pointer-events: none;
  border-radius: 18px;
}

/* Building markers */
.building {
  position: absolute;
  width: 64px;
  height: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, filter 0.2s;
  z-index: 10;
  user-select: none;
}

.building:hover {
  transform: scale(1.2) translateY(-4px);
  z-index: 20;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.25));
}

.building-icon {
  font-size: 2.2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.building-name {
  font-size: 0.65rem;
  font-weight: 600;
  background: rgba(255,255,255,0.92);
  color: var(--green-900);
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 2px;
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Map Controls */
.map-controls {
  position: absolute;
  right: 16px;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}

.ctrl-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: none;
  background: white;
  box-shadow: var(--shadow);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--green-800);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.ctrl-btn:hover {
  background: var(--green-100);
  transform: scale(1.05);
}

.ctrl-btn:active {
  transform: scale(0.95);
}

/* ===== INFO PANEL ===== */
.info-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.12);
  z-index: 60;
  max-height: 42vh;
  overflow-y: auto;
  transition: max-height 0.3s ease;
}

.panel-handle {
  width: 40px;
  height: 5px;
  background: var(--gray-200);
  border-radius: 999px;
  margin: 10px auto 6px;
}

.panel-content {
  padding: 8px 20px 24px;
}

.panel-content h2 {
  font-size: 1.1rem;
  color: var(--green-800);
  margin-bottom: 12px;
}

.panel-content h3 {
  font-size: 0.95rem;
  color: var(--green-700);
  margin: 18px 0 10px;
}

.announcements, .history-list, .officials-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement-item, .history-item, .official-item {
  background: var(--green-50);
  border-radius: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--green-500);
}

.announcement-item h4 {
  font-size: 0.9rem;
  margin-bottom: 4px;
  color: var(--green-900);
}

.announcement-item p, .history-item p {
  font-size: 0.82rem;
  color: var(--gray-500);
  line-height: 1.4;
}

.history-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.history-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.official-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.official-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--green-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.official-info strong {
  display: block;
  font-size: 0.9rem;
}

.official-info span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.empty-state {
  font-size: 0.85rem;
  color: var(--gray-500);
  font-style: italic;
  padding: 8px 0;
}

.panel-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
  text-align: center;
  font-size: 0.78rem;
  color: var(--gray-500);
}

.ig-link {
  display: inline-block;
  margin-top: 6px;
  color: var(--green-700);
  font-weight: 600;
  text-decoration: none;
}

.ig-link:hover {
  text-decoration: underline;
}

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

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

.modal-content {
  background: white;
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  padding: 24px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  transform: translateY(20px);
  transition: transform 0.25s;
}

.modal.open .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.6rem;
  color: var(--gray-500);
  cursor: pointer;
  line-height: 1;
}

.modal-body-icon {
  font-size: 3rem;
  text-align: center;
  margin-bottom: 12px;
}

.modal-body h3 {
  text-align: center;
  color: var(--green-800);
  margin-bottom: 8px;
}

.modal-body p {
  font-size: 0.9rem;
  color: var(--gray-500);
  line-height: 1.5;
  text-align: center;
}

.modal-meta {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-200);
  font-size: 0.8rem;
  color: var(--gray-500);
  text-align: center;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--green-800);
  color: white;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  z-index: 300;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== ADMIN STYLES ===== */
.admin-body {
  background: var(--gray-100);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--green-800), var(--green-600));
}

.login-card {
  background: white;
  border-radius: 24px;
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  font-size: 3.5rem;
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 1.5rem;
  color: var(--green-900);
}

.login-card > p {
  color: var(--gray-500);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.login-card input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 1rem;
  margin-bottom: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.login-card input:focus {
  border-color: var(--green-500);
}

.login-hint {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--gray-500);
}

.back-link {
  display: inline-block;
  margin-top: 20px;
  color: var(--green-700);
  font-size: 0.85rem;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

/* Admin Dashboard */
.admin-dashboard {
  min-height: 100vh;
}

.admin-header {
  background: linear-gradient(135deg, var(--green-800), var(--green-700));
  color: white;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-header h1 {
  font-size: 1.4rem;
}

.admin-header p {
  font-size: 0.85rem;
  opacity: 0.85;
}

.admin-header-actions {
  display: flex;
  gap: 10px;
}

.admin-nav {
  display: flex;
  overflow-x: auto;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 12px;
  gap: 4px;
  -webkit-overflow-scrolling: touch;
}

.nav-item {
  flex-shrink: 0;
  padding: 14px 16px;
  border: none;
  background: none;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.nav-item.active {
  color: var(--green-700);
  border-bottom-color: var(--green-500);
}

.admin-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.tab-content {
  display: none;
}

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

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 600px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 18px 14px;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.stat-icon {
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green-800);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 2px;
}

.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.card h3 {
  font-size: 1.05rem;
  color: var(--green-800);
  margin-bottom: 12px;
}

.hint {
  font-size: 0.82rem;
  color: var(--gray-500);
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--gray-800);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

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

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
}

/* Buttons */
.btn-primary {
  background: var(--green-600);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  width: 100%;
}

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

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(255,255,255,0.2);
  color: white;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.3);
}

.btn-danger {
  background: var(--danger);
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

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

.btn-small {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 500;
}

.btn-edit {
  background: var(--green-100);
  color: var(--green-800);
}

.btn-delete {
  background: #ffe5e5;
  color: var(--danger);
}

/* Admin List */
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  background: var(--gray-100);
  border-radius: 12px;
}

.admin-list-item .item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.admin-list-item .item-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.admin-list-item .item-text {
  min-width: 0;
}

.admin-list-item .item-text strong {
  display: block;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-list-item .item-text span {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.admin-list-item .item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.danger-zone {
  border: 1px solid #ffc9c9;
  background: #fff5f5;
}

.danger-zone h3 {
  color: var(--danger);
}

/* Responsive */
@media (min-width: 768px) {
  .info-panel {
    left: auto;
    right: 16px;
    bottom: 16px;
    width: 340px;
    max-height: 70vh;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .map-controls {
    right: 370px;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 10px 12px;
  }
  .logo {
    font-size: 1.1rem;
  }
  .tagline {
    display: none;
  }
}
