/* ==========================================================================
   Admin Panel — Grand-Saconnex Accessibility Map
   Color palette aligned with public site
   ========================================================================== */

:root {
  --primary: #1B4965;
  --primary-light: #2A6F97;
  --primary-dark: #132F43;
  --accent: #62B6CB;
  --accent-light: #BEE9E8;
  --success: #2D6A4F;
  --success-light: #52B788;
  --warning: #E9A820;
  --danger: #C1292E;
  --danger-light: #E76F51;

  --bg: #F4F6F8;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FAFBFC;
  --text: #1A1A2E;
  --text-muted: #6C757D;
  --border: #DEE2E6;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);

  --topbar-h: 56px;
  --sidebar-w: 300px;

  --star-empty: #D1D5DB;
  --star-filled: #F59E0B;
}

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

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  height: 100vh;
}

/* ==========================================================================
   Utility
   ========================================================================== */

.hidden { display: none !important; }

/* ==========================================================================
   Login Screen
   ========================================================================== */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--accent) 100%);
  padding: 20px;
}

.login-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 380px;
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 2px;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.login-error {
  background: #FEE2E2;
  color: var(--danger);
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

.form-input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(98, 182, 203, 0.2);
}

.form-input::placeholder {
  color: #ADB5BD;
}

textarea.form-input {
  resize: vertical;
}

select.form-input {
  cursor: pointer;
}

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

.form-row {
  display: flex;
  gap: 16px;
}

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

.form-row.align-center {
  align-items: center;
}

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin: 24px 0 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent-light);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover {
  background: var(--success-light);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--danger-light);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  background: var(--bg);
  border-color: var(--primary-light);
}

.btn-block {
  width: 100%;
}

.btn-file {
  cursor: pointer;
}

/* ==========================================================================
   Dashboard Layout
   ========================================================================== */

.dashboard {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--primary);
  color: #fff;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.topbar .btn-outline {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
}
.topbar .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #fff;
}

.dashboard-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ==========================================================================
   Place List Panel (Left)
   ========================================================================== */

.place-list-panel {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.place-list-header {
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.place-list {
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.place-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid #F0F0F0;
  transition: background 0.12s;
}

.place-list-item:hover {
  background: var(--accent-light);
}

.place-list-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--primary);
}

.place-item-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 8px;
}

.place-item-stars {
  font-size: 12px;
  color: var(--star-filled);
  white-space: nowrap;
  flex-shrink: 0;
}

.place-item-stars .empty {
  color: var(--star-empty);
}

.place-list-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.place-list-empty {
  padding: 20px 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ==========================================================================
   Main Content (Right)
   ========================================================================== */

.main-content {
  flex: 1;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Admin Map — full height by default */
.admin-map {
  width: 100%;
  flex: 1;
  min-height: 0;
  z-index: 0;
}

/* Place form — slide-up panel over the map */
.place-form-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 65%;
  background: var(--bg-card);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  overflow-y: auto;
  z-index: 10;
  display: none;
}

.place-form-wrapper.open {
  display: block;
}

.place-form-close {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  z-index: 1;
}

.place-form-close-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.btn-close-form {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 8px;
  border-radius: var(--radius);
}

.btn-close-form:hover {
  background: var(--bg);
  color: var(--text);
}

.place-form {
  padding: 12px 24px 20px;
}

/* Import/export inside the panel */
.import-export-section {
  padding: 0 24px 24px;
}

/* ==========================================================================
   Star Rating Input
   ========================================================================== */

.star-rating-input {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.star-rating-input .star {
  font-size: 28px;
  color: var(--star-empty);
  cursor: pointer;
  transition: color 0.12s, transform 0.1s;
  user-select: none;
  line-height: 1;
}

.star-rating-input .star:hover {
  transform: scale(1.15);
}

.star-rating-input .star.active {
  color: var(--star-filled);
}

.star-rating-input .star.hover-preview {
  color: var(--star-filled);
  opacity: 0.7;
}

.btn-clear-rating {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: var(--radius);
  line-height: 1;
}
.btn-clear-rating:hover {
  background: #FEE2E2;
  color: var(--danger);
}

/* ==========================================================================
   Accessibility Toggle Grid
   ========================================================================== */

.access-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
  margin-bottom: 16px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-switch {
  position: relative;
  width: 38px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-label input:checked + .toggle-switch {
  background: var(--success);
}

.toggle-label input:checked + .toggle-switch::after {
  transform: translateX(16px);
}

.toggle-text {
  color: var(--text);
}

/* ==========================================================================
   Import / Export Section
   ========================================================================== */

.import-export-section {
  padding: 0 24px 30px;
}

.import-export-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 32px;
  max-width: 420px;
  width: 100%;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.modal-message {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
  line-height: 1.6;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10001;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  transform: translateY(10px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-success {
  background: var(--success);
}

.toast.toast-error {
  background: var(--danger);
}

.toast.toast-info {
  background: var(--primary);
}

/* ==========================================================================
   Responsive: stack columns below 800px
   ========================================================================== */

@media (max-width: 800px) {
  .dashboard-body {
    flex-direction: column;
  }

  .place-list-panel {
    width: 100%;
    min-width: unset;
    max-height: 220px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .admin-map {
    min-height: 200px;
  }

  .place-form-wrapper {
    max-height: 80%;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .access-grid {
    grid-template-columns: 1fr;
  }

  .topbar-title {
    font-size: 13px;
  }
}

/* ==========================================================================
   Scrollbar styling
   ========================================================================== */

.place-list::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
  width: 6px;
}

.place-list::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
  background: transparent;
}

.place-list::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.place-list::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
  background: #ADB5BD;
}

/* ==========================================================================
   Leaflet overrides inside admin map
   ========================================================================== */

.admin-map .leaflet-control-attribution {
  font-size: 10px;
}

/* ==========================================================================
   Tab Switcher in Topbar
   ========================================================================== */

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-tab {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
  padding: 5px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.topbar-tab:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.topbar-tab.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

.badge.hidden {
  display: none;
}

/* ==========================================================================
   Pending Banner
   ========================================================================== */

.pending-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 20px;
  background: #FFF3CD;
  border-bottom: 1px solid #FFEAA7;
  font-size: 13px;
  color: #856404;
  font-weight: 500;
}

.pending-banner.hidden {
  display: none;
}

.btn-sm {
  padding: 5px 14px;
  font-size: 12px;
}

/* ==========================================================================
   Submission Filter Tabs (Left Panel)
   ========================================================================== */

.sub-filter-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.sub-filter-tab {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.sub-filter-tab:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.sub-filter-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Status dot in submission list */
.sub-status-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ==========================================================================
   Submission Detail Panel
   ========================================================================== */

.sub-detail-panel {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.sub-detail-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 14px;
}

.sub-detail-card {
  max-width: 700px;
}

.sub-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.sub-detail-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.sub-detail-status {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.sub-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius);
}

.sub-detail-meta strong {
  color: var(--text);
}

.sub-detail-section {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text);
}

.sub-detail-section strong {
  color: var(--text);
}

.sub-rejection {
  background: #FEE2E2;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--danger);
}

.sub-feat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  margin-top: 6px;
}

.sub-feat {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.sub-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Submission edit form */
.sub-edit-form {
  margin-top: 16px;
}

.sub-edit-row {
  display: flex;
  gap: 12px;
  margin-bottom: 0;
}

.sub-edit-group {
  margin-bottom: 12px;
  flex: 1;
}

.sub-edit-grow {
  flex: 2;
}

.sub-edit-form .form-input {
  font-size: 13px;
  padding: 7px 10px;
}

.sub-edit-feat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
}

/* Modal textarea */
.modal-textarea {
  margin-bottom: 16px;
}

.modal-textarea.hidden {
  display: none;
}

/* ==========================================================================
   Users Panel
   ========================================================================== */

.users-panel {
  max-width: 700px;
  margin: 0 auto;
  padding: 24px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
}

.users-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
}

.users-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
