/* Admin Page Styles */
:root {
  --primary-color: #fa9b2f;
  --secondary-color: #2c3e50;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
  --border-color: #dee2e6;
  --shadow: 0 2px 4px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
  background-color: #f5f5f5;
}

/* Navigation */
.admin-nav {
  background: white;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo-group {
  display: flex;
  align-items: center;
}

.logo img {
  height: 50px;
  width: auto;
}

.nav-links {
  display: flex;
  gap: 24px;
}

.nav-link {
  text-decoration: none;
  color: var(--dark-color);
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
  background-color: rgba(250, 155, 47, 0.1);
}

.user-auth {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Buttons */
.btn {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: white;
  color: var(--dark-color);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn.primary {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn.danger {
  background: var(--danger-color);
  color: white;
  border-color: var(--danger-color);
}

.btn.success {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

/* Main Content */
.admin-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.admin-header {
  text-align: center;
  margin-bottom: 40px;
}

.admin-header h1 {
  font-size: 2.5rem;
  color: var(--secondary-color);
  margin-bottom: 10px;
}

.admin-header p {
  font-size: 1.1rem;
  color: #666;
}

/* Access Denied */
.access-denied {
  background: white;
  border-radius: 12px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.access-denied h2 {
  color: var(--danger-color);
  margin-bottom: 16px;
  font-size: 2rem;
}

.access-denied p {
  color: #666;
  margin-bottom: 32px;
  font-size: 1.1rem;
}

/* Admin Content */
.admin-content {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* Tabs */
.admin-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: var(--light-color);
}

.tab-btn {
  padding: 16px 24px;
  border: none;
  background: transparent;
  color: var(--dark-color);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
}

.tab-btn:hover {
  background: rgba(250, 155, 47, 0.1);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background: white;
}

/* Tab Content */
.tab-content {
  display: none;
  padding: 30px;
}

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

/* Section Headers */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
  color: var(--secondary-color);
}

.section-actions {
  display: flex;
  gap: 12px;
}

/* Forms */
.form-section {
  background: var(--light-color);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 30px;
}

.form-section h3 {
  margin-bottom: 20px;
  color: var(--secondary-color);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

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

.form-group label {
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--dark-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(250, 155, 47, 0.1);
}

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

.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  font-weight: normal !important;
  margin-bottom: 0 !important;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* User List */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.user-item:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.user-info {
  flex-grow: 1;
}

.user-info strong {
  font-size: 1.1rem;
  color: var(--secondary-color);
}

.user-flags {
  display: flex;
  gap: 6px;
  margin: 8px 0;
}

.flag-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.flag-badge.admin {
  background: var(--danger-color);
  color: white;
}

.flag-badge.edit {
  background: var(--success-color);
  color: white;
}

.flag-badge.viewer {
  background: var(--info-color);
  color: white;
}

.user-meta {
  color: #666;
  font-size: 13px;
}

.user-actions {
  display: flex;
  gap: 8px;
}

/* Stats */
.bookings-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.stat-card h3 {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 8px;
}

.stat-card p {
  color: #666;
  font-weight: 500;
}

/* Tables */
.bookings-table {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: var(--light-color);
  font-weight: 600;
  color: var(--secondary-color);
}

.table tr:hover {
  background: rgba(250, 155, 47, 0.05);
}

/* System Cards */
.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.system-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
}

.system-card h3 {
  color: var(--secondary-color);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-color);
}

/* Settings */
.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.settings-section {
  background: var(--light-color);
  border-radius: 8px;
  padding: 24px;
}

.settings-section h3 {
  color: var(--secondary-color);
  margin-bottom: 20px;
}

.danger-zone {
  border-top: 1px solid var(--danger-color);
  padding-top: 20px;
  margin-top: 20px;
}

.danger-zone h4 {
  color: var(--danger-color);
  margin-bottom: 12px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  visibility: hidden;
  opacity: 0;
  transition: all 0.2s;
}

.modal[aria-hidden="false"] {
  visibility: visible;
  opacity: 1;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.modal-close:hover {
  color: var(--danger-color);
}

.modal form label {
  display: block;
  margin-bottom: 16px;
  font-weight: 500;
}

.modal form input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-top: 6px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.error-message {
  color: var(--danger-color);
  font-size: 14px;
  margin-top: 8px;
  min-height: 20px;
}

.auth-switch {
  text-align: center;
  margin-top: 20px;
}

.auth-switch a {
  color: var(--primary-color);
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    height: auto;
    padding: 15px 20px;
  }
  
  .nav-links {
    margin: 15px 0;
  }
  
  .admin-page {
    padding: 20px 15px;
  }
  
  .admin-header h1 {
    font-size: 2rem;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .admin-tabs {
    flex-wrap: wrap;
  }
  
  .user-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .user-actions {
    align-self: flex-end;
  }
  
  .bookings-stats {
    grid-template-columns: 1fr;
  }
  
  .system-grid {
    grid-template-columns: 1fr;
  }
}

/* Admin Booking Map Styles */
.admin-map-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: auto;
}

/* Large map variant: makes the map container wider and taller (approx 30% width x 50% height of viewport) */
.admin-map-container.admin-map-large {
  width: 90%; /* container fill horizontally inside admin content */
  max-width: none;
  height: 50vh; /* parent container defines the visible area */
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.admin-booking-map {
  width: 100%;
  max-width: none;
  height: 100%; /* fill the parent container */
  display: block;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #f8f9fa;
}

.admin-booking-map .spot {
  cursor: pointer;
  stroke: #333;
  stroke-width: 1;
  transition: all 0.2s ease;
}

.admin-booking-map .spot:hover {
  stroke-width: 2;
  stroke: var(--primary-color);
}

.admin-booking-map .spot.available {
  fill: var(--success-color);
  opacity: 0.7;
}

.admin-booking-map .spot.booked {
  fill: var(--danger-color);
  opacity: 0.8;
}

.admin-booking-map .spot.pending {
  fill: var(--warning-color);
  opacity: 0.7;
}

.admin-booking-map .spot-label {
  font-family: 'Segoe UI', sans-serif;
  font-size: 10px;
  font-weight: bold;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.admin-booking-map .company-label {
  font-family: 'Segoe UI', sans-serif;
  font-size: 8px;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

/* Tooltip for admin map hover */
.map-tooltip {
  position: fixed;
  z-index: 2000;
  background: rgba(0,0,0,0.85);
  color: white;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  max-width: 260px;
}

.map-legend {
  display: flex;
  gap: 20px;
  padding: 15px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.map-info {
  padding: 15px 20px;
  background: var(--info-color);
  color: white;
  border-radius: 8px;
  margin-bottom: 20px;
}

.booking-details-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-width: 500px;
  width: 90%;
  max-height: 70vh;
  overflow-y: auto;
}

.booking-details-panel h3 {
  margin-bottom: 20px;
  color: var(--secondary-color);
}

.booking-detail-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.booking-detail-item:last-child {
  border-bottom: none;
}

.booking-detail-label {
  font-weight: 600;
  color: var(--dark-color);
}

.booking-detail-value {
  color: #666;
  text-align: right;
  max-width: 60%;
  word-break: break-word;
}

/* News Management Styles */
.news-posts-section {
  margin-top: 30px;
}

.news-list {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}

.news-item-admin {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  gap: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.news-item-admin:hover {
  box-shadow: var(--shadow-lg);
}

.news-item-image {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.news-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.news-item-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--dark-color);
  margin-bottom: 8px;
}

.news-item-text {
  color: #666;
  line-height: 1.5;
  margin-bottom: 12px;
  flex: 1;
}

.news-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: #888;
}

.news-item-date {
  font-weight: 500;
}

.news-item-actions {
  display: flex;
  gap: 10px;
}

.news-item-actions .btn {
  padding: 6px 12px;
  font-size: 12px;
}

.char-count {
  color: #888;
  font-size: 12px;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Hybrid Data Management Styles */
.hybrid-controls {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: var(--shadow);
}

.hybrid-controls h3 {
  margin: 0 0 15px 0;
  color: var(--dark-color);
  font-size: 18px;
}

.hybrid-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.data-status {
  padding: 10px;
  background: var(--light-color);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 500;
}

/* Firebase Controls */
.firebase-controls {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  border-left: 4px solid var(--primary-color);
}

.firebase-controls h3 {
  color: var(--secondary-color);
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.firebase-controls h3:before {
  content: "🔥";
  font-size: 18px;
}

.firebase-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.firebase-actions .btn {
  min-width: 140px;
}

/* Payment Dashboard Styles */
.payment-dashboard-container {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.payment-analytics-summary {
  background: linear-gradient(135deg, var(--primary-color), #ff7b00);
  color: white;
  padding: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.analytics-card {
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.analytics-card h3 {
  font-size: 2rem;
  margin-bottom: 5px;
  font-weight: 600;
}

.analytics-card p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
  font-weight: 500;
}

.payment-charts {
  padding: 30px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.chart-container {
  background: var(--light-color);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.chart-container h4 {
  color: var(--secondary-color);
  margin-bottom: 15px;
}

.payments-table-container {
  padding: 0 30px 30px;
}

.payments-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.payments-table th,
.payments-table td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.payments-table th {
  background: var(--light-color);
  font-weight: 600;
  color: var(--secondary-color);
}

.payments-table tbody tr:hover {
  background: rgba(250, 155, 47, 0.1);
}

.payment-status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
}

.payment-status.succeeded {
  background: rgba(40, 167, 69, 0.1);
  color: var(--success-color);
}

.payment-status.pending {
  background: rgba(255, 193, 7, 0.1);
  color: var(--warning-color);
}

.payment-status.failed {
  background: rgba(220, 53, 69, 0.1);
  color: var(--danger-color);
}

/* Enhanced Tab Styling */
.tab-content {
  min-height: 600px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--light-color);
}

.section-header h2 {
  color: var(--secondary-color);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

/* Firebase Status Indicator */
#firebase-status {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
  background: var(--light-color);
  border: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .news-item-admin {
    flex-direction: column;
  }
  
  .news-item-image {
    width: 100%;
    height: 200px;
  }
  
  .firebase-actions {
    flex-direction: column;
  }
  
  .firebase-actions .btn {
    min-width: auto;
  }
  
  .payment-analytics-summary {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  
  .payment-charts {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  
  .payments-table-container {
    padding: 20px;
    overflow-x: auto;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .section-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}