/* Dashboard Layout */
.dashboard-body {
  background-color: #f3f4f6;
  margin: 0;
  font-family: 'Jost', sans-serif;
}

.dashboard-container {
  display: flex;
  min-height: 100vh;
  padding-top: 0; /* Removed fixed padding */
}

/* Header Overrides for Dashboard */
.app-header {
  position: relative !important; /* Changed to relative so it scrolls */
  z-index: 1000;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

/* Sidebar */
.dashboard-sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  position: sticky; /* Changed to sticky */
  top: 0;
  height: 100vh;
  z-index: 900;
  overflow-y: auto;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sidebar-header {
  display: none; /* Hidden as we have global header */
}

.user-brief {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #f3f4f6;
}

.user-brief-avatar img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
}

.user-brief-name {
  font-weight: 600;
  color: #111827;
  margin: 0;
  font-size: 0.95rem;
}

.user-brief-level {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 2px 0 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  border: none;
  background: none;
  color: #4b5563;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all 0.2s;
  font-family: inherit;
}

.nav-item:hover {
  background-color: #f9fafb;
  color: #111827;
}

.nav-item.active {
  background-color: #eff6ff;
  color: #2563eb;
}

.nav-item .icon {
  font-size: 1.2rem;
}

.badge-count {
  margin-left: auto;
  background: #ef4444;
  color: white;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #f3f4f6;
}

.logout-btn {
  color: #ef4444;
}

.logout-btn:hover {
  background-color: #fef2f2;
  color: #dc2626;
}

/* Main Content */
.dashboard-main {
  flex: 1;
  padding: 32px 40px;
  max-width: 1200px; /* Limit content width */
  width: calc(100% - 280px); /* Account for sidebar */
}

/* Dashboard Mobile Toggle */
.dashboard-mobile-toggle-bar {
  display: none;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding: 12px 16px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.mobile-sidebar-toggle {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
  color: #374151;
}

.mobile-page-title {
  font-weight: 600;
  color: #111827;
  font-size: 1rem;
}

/* Section Headers */
.section-header {
  margin-bottom: 32px;
}

.section-header h1 {
  font-size: 1.8rem;
  color: #111827;
  margin: 0 0 8px;
}

.section-header p {
  color: #6b7280;
  font-size: 1rem;
  margin: 0;
}

/* Sections Logic */
.dashboard-section {
  display: none;
  animation: fadeIn 0.3s ease;
}

.dashboard-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.stat-card {
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.xp { background: #e0e7ff; color: #4f46e5; }
.stat-icon.level { background: #dcfce7; color: #16a34a; }
.stat-icon.places { background: #ffedd5; color: #ea580c; }
.stat-icon.bookings { background: #f3e8ff; color: #9333ea; }

.stat-details h3 {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: #111827;
  margin: 4px 0 0;
}

.progress-bar-sm {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  margin-top: 8px;
  width: 100%;
}

.progress-fill {
  height: 100%;
  background: #4f46e5;
  border-radius: 2px;
}

/* Dashboard Cards */
.dashboard-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f3f4f6;
}

.card-header h2 {
  margin: 0;
  font-size: 1.1rem;
  color: #111827;
}

.card-body {
  padding: 24px;
}

/* Reservations */
.reservations-container {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.badge-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.badge-header-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.badge-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eff6ff;
  font-size: 1.2rem;
}

.badge-texts .badge-name {
  margin: 0;
  font-weight: 600;
  color: #111827;
}

.badge-texts .badge-place {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: #6b7280;
}

.badge-meta {
  margin-top: 8px;
}

.badge-xp {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: #4f46e5;
}

.badge-tasks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.badge-tasks-label {
  font-size: 0.8rem;
  color: #4b5563;
}

.badge-tasks-bar {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.badge-tasks-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(to right, #4f46e5, #3b82f6);
}

/* Completed Quests List */
.quests-grid,
.completed-quests-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quest-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.quest-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.quest-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.quest-info {
  flex: 1;
  min-width: 0;
}

.quest-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  line-height: 1.3;
}

.quest-meta {
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.quest-xp {
  font-size: 0.875rem;
  color: #4f46e5;
  font-weight: 500;
}

.quest-date {
  font-size: 0.8rem;
  color: #6b7280;
}

.tabs-line {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 0;
  font-size: 0.95rem;
  color: #6b7280;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  font-weight: 500;
}

.reservations-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.reservation-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.2s;
}

.reservation-card:hover {
  border-color: #bfdbfe;
  background: #f8fafc;
}

.res-info h4 {
  margin: 0 0 4px;
  font-size: 1.1rem;
  color: #111827;
}

.res-meta {
  font-size: 0.9rem;
  color: #6b7280;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.res-status {
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
}

.res-status.pending { background: #fef3c7; color: #d97706; }
.res-status.confirmed { background: #dcfce7; color: #16a34a; }
.res-status.completed { background: #f3f4f6; color: #4b5563; }
.res-status.cancelled { background: #fee2e2; color: #dc2626; }

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

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #374151;
  font-weight: 500;
}

.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.avatar-upload-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-upload-row img {
  border-radius: 50%;
  object-fit: cover;
}

.text-danger { color: #dc2626; font-size: 0.9rem; margin-bottom: 8px; }

/* Mobile Responsive */
@media (max-width: 768px) {
  .dashboard-container {
    padding-top: 0; /* No padding needed as header scrolls */
  }

  .dashboard-sidebar {
    position: fixed; /* Keep fixed for drawer behavior */
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    width: 280px;
    z-index: 1200; /* Above header (1000) */
    box-shadow: none;
    border-right: none;
    height: 100vh;
    padding-top: 0;
  }
  
  .dashboard-sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 100px rgba(0,0,0,0.5);
  }

  .dashboard-main {
    margin-left: 0;
    padding: 20px;
    width: 100%;
  }

  /* Show local toggle bar on mobile */
  .dashboard-mobile-toggle-bar {
    display: flex;
    position: relative; /* Changed from sticky */
    top: 0;
    z-index: 890;
    margin: 0 0 20px 0; /* Reset margins */
    border-radius: 12px; /* Restore rounded corners */
    border-bottom: none;
    background: white;
    padding: 12px 16px;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  }

  .mobile-sidebar-toggle {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: #374151;
    border: 1px solid #e5e7eb;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .reservation-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .res-status {
    align-self: flex-start;
  }
}

/* Content Section Styles */
.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.photo-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.photo-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.photo-card:hover img {
  transform: scale(1.05);
}

.photo-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
}

.action-btn {
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s;
}

.action-btn:hover {
  background: white;
  transform: scale(1.1);
}

.action-btn.delete {
  color: #dc2626;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comment-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s;
}

.comment-card:hover {
  border-color: #bfdbfe;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f3f4f6;
}

.comment-place {
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comment-date {
  font-size: 0.85rem;
  color: #6b7280;
}

.comment-text {
  color: #374151;
  line-height: 1.5;
  margin-bottom: 16px;
}

.comment-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comment-stats {
  font-size: 0.9rem;
  color: #6b7280;
  display: flex;
  gap: 12px;
}

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

/* Mobile Toggle Bar Improvement - Merged into main media query */

/* Modal Styles */
.modal-overlay {
  display: none; /* Hidden by default */
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay:not([hidden]) {
  display: flex; /* Only show when not hidden */
}

.modal-content.dashboard-modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #6b7280;
}

.modal-body {
  padding: 24px;
  flex: 1;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  border-bottom: 1px solid #f9fafb;
  padding-bottom: 8px;
}

.detail-label {
  color: #6b7280;
  font-weight: 500;
}

.detail-value {
  color: #111827;
  font-weight: 600;
  text-align: right;
}

/* Status colors in modal */
.detail-status {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.detail-status--pending { background: #fef3c7; color: #d97706; }
.detail-status--confirmed { background: #dcfce7; color: #16a34a; }
.detail-status--completed { background: #f3f4f6; color: #4b5563; }
.detail-status--cancelled { background: #fee2e2; color: #dc2626; }
.detail-status--message_sent { background: #dbeafe; color: #2563eb; }

/* Price row */
.detail-row--total {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid #e5e7eb;
}

.detail-price {
  font-size: 1.4em !important;
  color: #2563eb !important;
}

/* Note text */
.detail-note {
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 12px;
  text-align: center;
  background: #f9fafb;
  padding: 10px;
  border-radius: 8px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  text-align: right;
}

.reservation-card {
  cursor: pointer;
}
