/* ═══════════════════════════════════════════
   Six Oaks Events — Brand Theme
   Dark green + Marsh gold on warm ivory
   Mobile-first SPA, Lowcountry aesthetic
   ═══════════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overscroll-behavior: none;
}

/* ─── Typography ─── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

a {
  color: var(--color-secondary);
  text-decoration: none;
  font-weight: 500;
}

/* ─── Layout ─── */
.app-shell {
  max-width: var(--max-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: rgba(255,255,255,0.47);
}

/* Pages inside the app — let the backdrop show through */
.page {
  flex: 1;
  padding: var(--space-4);
  padding-top: calc(var(--safe-top) + var(--space-4));
  padding-bottom: calc(var(--nav-height) + var(--space-4) + var(--safe-bottom));
  display: none;
  animation: fadeIn 0.25s ease;
  background: rgba(247, 245, 240, 0.37);
  position: relative;
  z-index: 1;
}

.page.active {
  display: block;
}

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

/* ─── Header ─── */
.app-header {
  padding: var(--space-2) var(--space-4);
  padding-top: calc(var(--safe-top) + var(--space-2));
  min-height: calc(48px + var(--safe-top));
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.app-header .subtitle {
  font-size: 0.7rem;
  color: var(--color-secondary);
  opacity: 0.8;
  margin-top: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--font-body);
  font-weight: 500;
}

/* ─── Bottom Nav ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--max-width);
  background: rgba(16, 42, 36, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.08);
  display: none;
  justify-content: space-around;
  padding: var(--space-2) 0;
  padding-bottom: calc(var(--space-2) + var(--safe-bottom));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.6);
  font-size: 0.65rem;
  cursor: pointer;
  padding: var(--space-1) var(--space-3);
  transition: var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  line-height: 1;
  opacity: 0.85;
}

.nav-item.active {
  color: var(--color-secondary);
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--color-secondary);
  border-radius: 0 0 2px 2px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

/* Button variants defined in tokens.css override these defaults */

.btn-outline {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1.5px solid var(--color-border);
  color: var(--color-text-primary);
}

.btn-outline:hover {
  background: var(--color-card);
}

.btn-secondary {
  background-color: var(--color-secondary) !important;
  color: var(--color-primary) !important;
  border: none;
}

.btn-secondary:hover {
  filter: brightness(1.1);
}

.btn-primary {
  background-color: var(--color-primary) !important;
  color: var(--color-text-on-primary) !important;
  border: none;
}

.btn-primary:hover {
  background-color: var(--color-primary-hover) !important;
}

.btn-danger {
  background-color: var(--color-error);
  color: #ffffff;
  border: none;
}

.btn-danger:hover {
  background-color: var(--color-error);
  filter: brightness(1.1);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* ─── Cards ─── */
.card {
  background: rgba(239, 232, 220, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
}

.card-header {
  font-family: var(--font-display);
  margin-bottom: var(--space-2);
}

/* ─── Form ─── */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: var(--transition-fast);
  outline: none;
}

/* iOS date/time inputs need extra nudging to not overflow */
input[type="date"].form-input,
input[type="time"].form-input {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

/* iOS date/time inputs — aggressive override */
input[type="date"].form-input,
input[type="time"].form-input {
  min-width: 0 !important;
  width: calc(100% - 0.1px) !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  flex: 1 1 0% !important;
}

.form-group {
  min-width: 0;
  width: 100%;
}

/* Hide internal iOS WebKit chrome that forces overflow (keep picker indicator visible) */
input[type="date"]::-webkit-datetime-edit,
input[type="time"]::-webkit-datetime-edit { padding: 0; }
input[type="date"]::-webkit-inner-spin-button,
input[type="time"]::-webkit-inner-spin-button { display: none; }
input[type="date"]::-webkit-clear-button,
input[type="time"]::-webkit-clear-button { display: none; }

/* Stack time fields vertically on mobile, side-by-side on tablet+ */
.time-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 480px) {
  .time-row {
    flex-direction: row;
    gap: 8px;
  }

  .time-row > div {
    flex: 1;
  }
}

/* ─── Password Wrapper ─── */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper .form-input {
  padding-right: 44px;
}

.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.password-toggle:hover {
  color: var(--color-primary);
  background: rgba(0,0,0,0.04);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.92);
}
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(200, 161, 90, 0.15);
}

.form-input::placeholder {
  color: var(--color-text-secondary);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235F6664' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ─── File upload ─── */
.file-upload-area {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  background: rgba(239, 232, 220, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.file-upload-area:active,
.file-upload-area.dragover {
  border-color: var(--color-secondary);
  background: rgba(200, 161, 90, 0.06);
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-area .upload-icon {
  font-size: 2rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.file-upload-area .upload-text {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.file-preview {
  margin-top: var(--space-2);
  display: none;
}

.file-preview.has-image {
  display: block;
}

.file-preview img {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

/* ─── Category Toggle ─── */
.toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toggle-chip {
  padding: 10px 18px;
  background: rgba(239, 232, 220, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  color: var(--color-text-secondary);
  touch-action: manipulation;
  font-weight: 500;
}

.toggle-chip:active {
  transform: scale(0.94);
}

.toggle-chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-on-primary);
}

/* ─── Event Card ─── */
.event-card {
  background: rgba(239, 232, 220, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-3);
  transition: var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.event-card:active {
  transform: scale(0.98);
}

.event-card-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

.event-card-image-wrap {
  position: relative;
}

.event-card-image-placeholder {
  height: 100px;
  background: #102A24;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ─── Happening Now Badge ─── */
.happening-now {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(183, 76, 66, 0.92);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(4px);
  letter-spacing: 0.3px;
  z-index: 2;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.placeholder-logo {
  height: 48px;
  width: auto;
  opacity: 0.7;
}

.event-card-body {
  padding: var(--space-3) var(--space-4);
}

.event-card-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* Category color coding */
.event-card-category.category-event {
  background: rgba(62, 130, 168, 0.12);
  color: var(--color-info);
}
.event-card-category.category-party {
  background: rgba(200, 161, 90, 0.15);
  color: var(--color-secondary-hover);
}
.event-card-category.category-reservation {
  background: rgba(47, 122, 74, 0.12);
  color: var(--color-success);
}
.event-card-category.category-vendor {
  background: rgba(110, 142, 114, 0.12);
  color: var(--color-accent);
}

.event-card-author {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  margin-top: 2px;
  font-weight: 500;
}

.event-card-date {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.event-card-location {
  font-size: 0.8rem;
  color: var(--color-accent);
  margin-top: var(--space-1);
  display: flex;
  align-items: center;
  gap: 4px;
}

.event-card-location i {
  font-size: 0.85rem;
}

.event-card-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--color-text-primary);
  margin-top: var(--space-1);
  font-weight: 600;
}

.event-card-details {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.event-card-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* ─── Calendar ─── */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.calendar-header h2 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  font-size: 1.15rem;
}

.calendar-nav-btn {
  background: rgba(239, 232, 220, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.calendar-nav-btn:active {
  background: var(--color-border);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: var(--space-4);
}

.calendar-day-header {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
  text-align: center;
  padding: 6px 0;
  font-weight: 600;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
  position: relative;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  touch-action: manipulation;
  font-weight: 500;
}

.calendar-day:active {
  transform: scale(0.9);
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

.calendar-day.today {
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  font-weight: 700;
}

.calendar-day.selected {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.calendar-day.has-events::after {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--color-secondary);
  border-radius: 50%;
  position: absolute;
  bottom: 4px;
}

.calendar-day.selected::after {
  background: var(--color-text-on-primary);
}

.calendar-day.other-month {
  opacity: 0.3;
}

/* ─── Auth Background ─── */
.auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: url('/assets/auth-bg.webp') center / cover no-repeat;
  background-color: var(--color-primary);
  opacity: 1;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* When the app is shown, dim the backdrop slightly so text stays readable */
body:not(.showing-auth) .auth-backdrop {
  opacity: 0.35;
}

/* On the auth page itself, the backdrop is fully visible */
body.showing-auth .auth-backdrop {
  opacity: 1;
}

/* ─── Auth Loading Spinner ─── */
.auth-loading {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  pointer-events: none;
}

.auth-loading.hidden {
  display: none;
}

.auth-loading-spinner {
  position: relative;
  width: 56px;
  height: 56px;
}

.auth-loading-spinner::before,
.auth-loading-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

/* Outer ring — Marsh Gold */
.auth-loading-spinner::before {
  border: 3px solid transparent;
  border-top-color: var(--color-secondary);
  border-right-color: var(--color-secondary-hover);
  animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Inner ring — Deep Live Oak, counter-rotating */
.auth-loading-spinner::after {
  margin: 8px;
  border: 2.5px solid transparent;
  border-bottom-color: var(--color-primary);
  border-left-color: var(--color-accent);
  animation: spin 0.7s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}

/* Center dot */
.auth-loading-dot {
  width: 10px;
  height: 10px;
  background: var(--color-secondary);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(0.8); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
}

/* ─── Crop Guide ─── */
.crop-frame {
  position: relative;
}

.crop-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  aspect-ratio: 5 / 2;
  border: 2px dashed rgba(255,255,255,0.6);
  border-radius: 4px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
}

.crop-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  background: rgba(0,0,0,0.3);
}

.crop-loader .auth-loading-spinner {
  width: 32px;
  height: 32px;
}

/* ─── Toggle Switch ─── */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: 24px;
  transition: 0.2s;
}

.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .switch-slider {
  background: var(--color-success);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}

/* ─── Notification Chips ─── */
.notif-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(239, 232, 220, 0.9);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.notif-chip:active {
  transform: scale(0.95);
}

.notif-chip input {
  accent-color: var(--color-primary);
}

/* ─── Search Bar ─── */
.search-bar {
  position: relative;
  margin-bottom: 12px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-input:focus {
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(200, 161, 90, 0.15);
}

.search-input::placeholder {
  color: var(--color-text-secondary);
}

.search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  max-height: 240px;
  overflow-y: auto;
  display: none;
  box-shadow: var(--shadow-md);
}

.search-results.open {
  display: block;
}

.search-result-item {
  padding: 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  transition: var(--transition-fast);
  border-bottom: 1px solid var(--color-border);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:active {
  background: var(--color-card);
}

.search-result-item .sr-category {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.search-result-item .sr-date {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-left: auto;
}

/* ─── Profile Tabs ─── */
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--color-text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  touch-action: manipulation;
}

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

/* When showing auth, kill the app-shell white bg and page bg so backdrop shows cleanly */
body.showing-auth .app-shell {
  background: transparent;
  max-width: 100%;
  margin-left: 0;
  border: none;
  box-shadow: none;
}

body.showing-auth #pageAuth {
  background: transparent;
}

/* ─── Auth ─── */
#pageAuth {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

#pageAuth.active {
  display: flex;
}

.auth-logo,
.auth-logo img {
  display: none;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow-xl);
}

.auth-card h2 {
  font-family: var(--font-display);
  color: var(--color-primary);
  text-align: center;
  margin-bottom: var(--space-1);
  font-size: 1.6rem;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-6);
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: var(--color-text-primary);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  touch-action: manipulation;
}

.google-btn:active {
  transform: scale(0.97);
  background: var(--color-card);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: var(--space-5) 0;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-link {
  text-align: center;
  font-size: 0.85rem;
  margin-top: var(--space-4);
  color: var(--color-text-secondary);
}

.auth-link a {
  color: var(--color-secondary);
  font-weight: 600;
}

/* ─── Empty state ─── */
.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-5);
  color: var(--color-text-secondary);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: var(--space-3);
  opacity: 0.5;
}

.empty-state h3 {
  font-family: var(--font-display);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

/* ─── Modal ─── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(31, 35, 34, 0.5);
  z-index: 200;
  display: none;
  animation: fadeIn 0.15s ease;
}

.modal-backdrop.open {
  display: block;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 201;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: var(--max-width);
  max-height: 90vh;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--space-5);
  padding-top: var(--space-3);
  overflow-y: auto;
  animation: slideUp 0.25s ease;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  margin: 0 auto var(--space-4);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}

.modal-header h2 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-1);
  touch-action: manipulation;
  line-height: 1;
}

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: calc(100% - var(--space-8));
  max-width: 440px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  animation: slideDown 0.3s ease;
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toast.success { background: rgba(47, 122, 74, 0.88); color: #ffffff; }
.toast.error   { background: rgba(183, 76, 66, 0.88); color: #ffffff; }
.toast.warning { background: rgba(216, 154, 47, 0.88); color: var(--color-primary); }
.toast.info    { background: rgba(62, 130, 168, 0.88); color: #ffffff; }

@keyframes slideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ─── Skeleton Loading ─── */
.skeleton {
  background: linear-gradient(90deg, var(--color-card) 25%, var(--color-border) 50%, var(--color-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Day Events Section (below calendar) ─── */
.day-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: var(--space-4) 0 var(--space-2);
}

.day-section-title {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  font-size: 1rem;
}

.day-section-count {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
}

/* ─── Utilities ─── */
.text-center { text-align: center; }
.text-muted  { color: var(--color-text-secondary); }
.mt-8  { margin-top: var(--space-2); }
.mt-16 { margin-top: var(--space-4); }
.mt-24 { margin-top: var(--space-6); }
.mb-8  { margin-bottom: var(--space-2); }
.mb-16 { margin-bottom: var(--space-4); }
.gap-8  { gap: var(--space-2); }
.gap-12 { gap: var(--space-3); }
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ─── Touch improvements ─── */
@media (hover: none) and (pointer: coarse) {
  .btn:hover, .nav-item:hover, .calendar-day:hover,
  .btn-primary:hover, .btn-secondary:hover {
    transform: none;
  }
}

/* ─── Event Card Details Truncation ─── */
.event-card-details.truncated {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-more-btn {
  background: none;
  border: none;
  color: var(--color-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
  font-family: var(--font-body);
  transition: var(--transition-fast);
}

.read-more-btn:hover {
  color: var(--color-secondary-hover);
  text-decoration: underline;
}

/* ─── Pulse Spinner ─── */
.pulse-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Event Detail Modal ─── */
#detailModalContent {
  max-height: 85vh;
  overflow-y: auto;
}

#detailModalBody {
  padding-bottom: var(--space-4);
}

.detail-event-image {
  margin: 0 calc(-1 * var(--space-5)) var(--space-4);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-accent) 100%);
}

.detail-event-image img {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  display: block;
}

.detail-event-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 120px;
  background: #102A24;
}

.detail-event-image-placeholder .placeholder-logo {
  height: 56px;
  opacity: 0.6;
}

.detail-event-info {
  padding: 0;
}

.detail-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.detail-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
  line-height: 1.3;
}

.detail-author {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-3);
}

.detail-date,
.detail-time,
.detail-location {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-description {
  margin-top: var(--space-4);
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--color-text-primary);
  white-space: pre-wrap;
}

/* ─── Remixicon Base Styles ─── */
.nav-icon {
  font-size: 1.4rem;
  color: var(--color-text-on-dark);
  opacity: 0.6;
  transition: var(--transition-fast);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  opacity: 1;
  color: var(--color-secondary);
}

.toggle-chip i {
  font-size: 1.1rem;
  margin-right: 4px;
  vertical-align: middle;
}

.empty-icon i,
.upload-icon {
  font-size: 2.5rem;
  color: var(--color-secondary);
  opacity: 0.5;
}

.profile-info i {
  font-size: 1rem;
  vertical-align: middle;
  margin-right: 4px;
  color: var(--color-secondary);
  opacity: 0.7;
}

/* ─── Desktop & Tablet Enhancements ─── */

/* Small tablets (portrait) */
@media (min-width: 480px) {
  .app-shell {
    max-width: 540px;
  }
}

/* Tablets & iPad */
@media (min-width: 768px) {
  .app-shell {
    max-width: 720px;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    min-height: 100vh;
    min-height: 100dvh;
    background: rgba(255,255,255,0.47);
  }

  body.showing-auth .app-shell {
    max-width: 100%;
    margin-left: 0;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  body.showing-auth .app-shell .auth-backdrop {
    z-index: 0;
  }

  body.showing-auth .page {
    padding: 0;
  }

  .page {
    padding: var(--space-6);
    padding-bottom: calc(var(--nav-height) + var(--space-6) + var(--safe-bottom));
  }

  /* Calendar: side-by-side with fixed grid — only when active */
  .page.active#pageCalendar {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-5);
    align-items: start;
  }

  .active#pageCalendar .calendar-header {
    grid-column: 1 / -1;
  }

  .active#pageCalendar > #calendarGrid {
    gap: 4px;
  }

  .active#pageCalendar > #dayEvents {
    max-height: calc(100vh - 220px);
    overflow-y: auto;
    padding-left: var(--space-4);
    border-left: 1px solid var(--color-border);
  }

  .calendar-day {
    font-size: 0.95rem;
    padding: 8px 0;
    aspect-ratio: auto;
    min-height: 44px;
  }

  /* Events page & My Events: responsive auto-fill grid */
  #eventsList,
  #myEventsList {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
  }

  .event-count,
  .empty-state {
    grid-column: 1 / -1;
  }

  .empty-state {
    text-align: center;
  }

  /* Profile page */

  /* Modal: centered dialog instead of bottom sheet */
  .modal {
    align-items: center;
  }

  .modal-content {
    max-width: 520px;
    border-radius: var(--radius-xl);
    animation: fadeIn 0.2s ease;
    box-shadow: var(--shadow-xl);
  }

  .modal-handle {
    display: none;
  }

  /* Search: inline with results overlay inside container */
  .search-bar {
    position: relative;
  }

  .search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
  }

  /* Card spacing */
  .card {
    padding: var(--space-5);
  }
}

/* Desktop — fluid layout, fills the screen */
@media (min-width: 1024px) {
  .app-shell {
    max-width: none;
    margin-left: 80px;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    padding-top: var(--header-height);
  }

  /* Header spans full width above everything */
  .app-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 110;
    background: linear-gradient(135deg, var(--color-primary) 0%, #0D1F1A 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  /* Bottom nav becomes left sidebar */
  .bottom-nav {
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 80px;
    transform: none;
    max-width: none;
    justify-content: flex-start;
    padding-top: calc(var(--header-height) + var(--space-8));
    padding-bottom: var(--space-8);
    border-top: none;
    border-right: 1px solid rgba(255,255,255,0.12);
    border-radius: 0;
    gap: 4px;
  }

  .bottom-nav .nav-item {
    position: relative;
    padding: var(--space-3) 0;
    gap: var(--space-1);
    font-size: 0.65rem;
    width: 100%;
    color: rgba(255,255,255,0.5);
    transition: var(--transition-fast);
  }

  .bottom-nav .nav-item:hover {
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.06);
  }

  .bottom-nav .nav-item .nav-icon {
    font-size: 1.4rem;
    color: rgba(255,255,255,0.5);
    transition: var(--transition-fast);
  }

  .bottom-nav .nav-item:hover .nav-icon {
    color: var(--color-secondary);
    opacity: 1;
  }

  .bottom-nav .nav-item.active {
    color: var(--color-secondary);
  }

  .bottom-nav .nav-item.active .nav-icon {
    color: var(--color-secondary);
    opacity: 1;
  }

  .bottom-nav .nav-item.active::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 28px;
    background: var(--color-secondary);
    border-radius: 0 3px 3px 0;
  }

  /* Calendar: day events panel fills remaining space */
  .active#pageCalendar {
    grid-template-columns: 1fr minmax(300px, 35%);
  }

  /* Wider page padding */
  .page {
    padding: var(--space-6);
    padding-bottom: calc(var(--nav-height) + var(--space-6) + var(--safe-bottom));
  }
}

/* Wide desktop — even more space */
@media (min-width: 1600px) {
  .active#pageCalendar {
    grid-template-columns: 1fr minmax(380px, 30%);
  }

  .page {
    padding: var(--space-8);
    padding-bottom: calc(var(--nav-height) + var(--space-8) + var(--safe-bottom));
  }
}

/* ─── RSVP Bar ─── */
.rsvp-bar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.rsvp-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border);
  background: rgba(255,255,255,0.85);
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
  touch-action: manipulation;
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

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

.rsvp-btn .rsvp-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--color-text-secondary);
  transition: var(--transition-fast);
}

.rsvp-btn.interested {
  border-color: var(--color-info);
  color: var(--color-info);
}

.rsvp-btn.interested.active {
  background: rgba(62, 130, 168, 0.12);
  border-color: var(--color-info);
}

.rsvp-btn.interested.active .rsvp-count {
  background: var(--color-info);
  color: #fff;
}

.rsvp-btn.going {
  border-color: var(--color-success);
  color: var(--color-success);
}

.rsvp-btn.going.active {
  background: rgba(47, 122, 74, 0.12);
  border-color: var(--color-success);
}

.rsvp-btn.going.active .rsvp-count {
  background: var(--color-success);
  color: #fff;
}

/* ─── Event Card Visibility Badge ─── */
.event-visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-left: auto;
}

.event-visibility-badge.public {
  background: rgba(62, 130, 168, 0.1);
  color: var(--color-info);
}

.event-visibility-badge.private {
  background: rgba(200, 161, 90, 0.12);
  color: var(--color-secondary);
}

/* ─── Profile RSVP Stats ─── */
.profile-rsvp-stats {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

.profile-rsvp-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  background: rgba(239, 232, 220, 0.6);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.profile-rsvp-stat i {
  font-size: 0.9rem;
}

.profile-rsvp-stat .stat-count {
  font-weight: 700;
  color: var(--color-text-primary);
}