/* ============================================================
   enlightenMEnt Live — Mobile PWA Styles  (FULL RENOVATION)
   ============================================================ */

:root {
  --mob-tab-h: 60px;
  --mob-header-h: 56px;
  --mob-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mob-safe-top: env(safe-area-inset-top, 0px);
  --mob-green: #28724f;
  --mob-green-dark: #0f2419;
  --mob-green-mid: #1a3d28;
  --mob-radius: 14px;
  --mob-card-bg: #ffffff;
  --mob-page-bg: #f5f6f8;
}

@media (max-width: 768px) {

  /* ── Reset & shell ─────────────────────────────────────── */
  html, body {
    height: 100%;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
    background: var(--mob-page-bg) !important;
  }

  #app-shell {
    flex-direction: column !important;
    height: 100dvh !important;
    overflow: hidden !important;
    background: var(--mob-page-bg) !important;
  }

  /* ── Brand bar (above page title) ─────────────────────────── */
  #mob-brand-bar {
    background: rgba(0,0,0,0.25);
    padding: calc(var(--mob-safe-top) + 4px) 14px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.65);
    text-transform: uppercase;
    flex-shrink: 0;
  }

  /* ── Green branded topbar ──────────────────────────────── */
  #topbar {
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #0f2419 0%, #1a3d28 100%) !important;
    padding-top: 0 !important;
    border-bottom: none !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25) !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 200 !important;
    display: flex !important;
    flex-direction: column !important;
  }

  /* Inner topbar row */
  #topbar .topbar-inner {
    display: flex;
    align-items: center;
    padding: 8px 14px 10px;
    gap: 8px;
    min-height: 56px;
  }

  #topbar #page-title {
    flex: 1 !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Theme button on mobile */
  #topbar #theme-btn {
    color: rgba(255,255,255,0.7) !important;
    background: rgba(255,255,255,0.12) !important;
    border-radius: 8px !important;
    border: none !important;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
  }

  /* User badge on mobile */
  #topbar #user-badge {
    background: rgba(255,255,255,0.15) !important;
    color: #fff !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 4px 10px !important;
    flex-shrink: 0;
  }

  /* ── Hamburger ─────────────────────────────────────────── */
  #mob-hamburger {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 40px !important;
    height: 40px !important;
    background: rgba(255,255,255,0.12) !important;
    border: none !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    color: #ffffff !important;
    flex-shrink: 0 !important;
    -webkit-tap-highlight-color: transparent;
    order: -1;
  }
  #mob-hamburger:active { background: rgba(255,255,255,0.22) !important; }

  #topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }

  /* ── Sidebar — slide-in drawer ─────────────────────────── */
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100dvh !important;
    width: 280px !important;
    min-width: 0 !important;
    max-width: 280px !important;
    z-index: 500 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
    padding-top: var(--mob-safe-top);
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    display: flex !important;
    flex-direction: column !important;
    background: var(--mob-green-dark) !important;
    color: #e8f0eb !important;
  }
  #sidebar.mob-open {
    transform: translateX(0) !important;
  }

  #mob-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 490;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
  }
  #mob-overlay.mob-open { display: block; }

  /* ── Main + page content ───────────────────────────────── */
  #main {
    flex: 1 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    width: 100% !important;
    background: var(--mob-page-bg) !important;
  }

  #page-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px calc(var(--mob-tab-h) + var(--mob-safe-bottom) + 16px);
    background: var(--mob-page-bg);
  }

  /* Topbar title — shown on mobile alongside the brand */

  /* ── Brand line on green topbar ────────────────────────── */
  .topbar-brand {
    display: block;
    padding: 6px 14px 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: 0.01em;
    line-height: 1.2;
  }
  .topbar-me {
    color: #c9a84c;
  }

  /* ── Bottom tab bar — frosted glass ────────────────────── */
  #mob-tab-bar {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(var(--mob-tab-h) + var(--mob-safe-bottom)) !important;
    padding-bottom: var(--mob-safe-bottom) !important;
    background: rgba(255,255,255,0.92) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    backdrop-filter: blur(16px) !important;
    border-top: 0.5px solid rgba(0,0,0,0.1) !important;
    z-index: 400 !important;
    box-shadow: 0 -1px 0 rgba(0,0,0,0.06) !important;
  }

  .mob-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9ab09a;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    transition: color 0.15s;
    min-width: 0;
  }
  .mob-tab svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
  }
  .mob-tab i.ti {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
  }
  .mob-tab-label {
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.01em;
  }
  .mob-tab.active { color: var(--mob-green) !important; }
  .mob-tab.active .mob-tab-label { font-weight: 700; }
  .mob-tab:active { transform: scale(0.9); transition: transform 0.1s; }

  /* ── Mobile page container ─────────────────────────────── */
  .mob-page {
    animation: mob-fade-in 0.18s ease both;
  }
  @keyframes mob-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── Cards ─────────────────────────────────────────────── */
  .mob-card {
    background: var(--mob-card-bg);
    border-radius: var(--mob-radius);
    border: 1px solid rgba(0,0,0,0.06);
    padding: 14px;
    margin-bottom: 10px;
  }

  .mob-section-label {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 16px 0 8px;
  }

  /* ── List rows ─────────────────────────────────────────── */
  .mob-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--mob-card-bg);
    border-radius: var(--mob-radius);
    border: 1px solid rgba(0,0,0,0.06);
    margin-bottom: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s;
  }
  .mob-row:active { background: #f3f4f6; }

  /* ── Avatar ────────────────────────────────────────────── */
  .mob-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e8f5ec;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: var(--mob-green);
    flex-shrink: 0;
  }

  /* ── Inputs ────────────────────────────────────────────── */
  .mob-input {
    width: 100%;
    box-sizing: border-box;
    padding: 13px 14px;
    font-size: 16px; /* prevents iOS zoom */
    border-radius: 12px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #111;
    -webkit-appearance: none;
    outline: none;
  }
  .mob-input:focus {
    border-color: var(--mob-green);
    box-shadow: 0 0 0 3px rgba(40,114,79,0.12);
  }

  /* ── Chips / filter pills ───────────────────────────────── */
  .mob-chip {
    white-space: nowrap;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.15s;
  }
  .mob-chip.active, .mob-chip-active {
    background: var(--mob-green) !important;
    color: #fff !important;
    border-color: var(--mob-green) !important;
    font-weight: 600 !important;
  }

  /* ── FAB ───────────────────────────────────────────────── */
  .mob-fab-btn {
    position: fixed;
    bottom: calc(var(--mob-tab-h) + var(--mob-safe-bottom) + 16px);
    right: 16px;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--mob-green), var(--mob-green-dark));
    color: #fff;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(40,114,79,0.45);
    z-index: 350;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  .mob-fab-btn:active {
    transform: scale(0.93);
    box-shadow: 0 2px 8px rgba(40,114,79,0.3);
  }

  /* ── Stat grid ─────────────────────────────────────────── */
  .mob-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  .mob-stat-card {
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 14px;
  }
  .mob-stat-lbl {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
  }
  .mob-stat-val {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--mob-green-dark);
  }

  /* ── Hero banner (page-level) ───────────────────────────── */
  .mob-hero-banner {
    background: linear-gradient(135deg, #0f2419 0%, #28724f 100%);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 14px;
    color: #fff;
  }

  /* ── Quick action grid ──────────────────────────────────── */
  .mob-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }
  .mob-action-btn {
    padding: 16px 10px;
    border-radius: 14px;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--mob-green-dark);
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.1s, border-color 0.1s;
  }
  .mob-action-btn:active {
    background: #f0f7f2;
    border-color: var(--mob-green);
  }

  /* ── Hide desktop-only chrome ───────────────────────────── */
  .desktop-only { display: none !important; }

  /* ── Existing card / grid overrides ────────────────────── */
  .card {
    border-radius: var(--mob-radius) !important;
    padding: 14px !important;
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr !important;
  }
  .stats-row {
    grid-template-columns: 1fr 1fr !important;
  }
  table {
    font-size: 12px !important;
  }
  .btn {
    padding: 10px 16px !important;
    font-size: 14px !important;
    min-height: 44px !important;
  }
  input, select, textarea {
    font-size: 16px !important; /* prevents iOS zoom */
  }
}

/* ── Desktop: hide mobile-only elements ────────────────────── */
@media (min-width: 769px) {
  #mob-tab-bar, #mob-overlay { display: none !important; }
  #mob-hamburger { display: none !important; }
  .mob-fab-btn { display: none !important; }
  .topbar-brand { display: none !important; }
}

  /* ── Swipe-to-reveal row actions (EarthRock attendees) ─── */
  @media (max-width: 768px) {
    .orient-row-actions {
      display: none;
    }
    tr.orient-row-swipe-open .orient-row-actions {
      display: inline-block;
      vertical-align: middle;
    }
    tr.orient-row-swipe-open {
      background: #fef2f2;
    }
  }
  @media (min-width: 769px) {
    .orient-row-actions {
      display: inline;
    }
  }
