/* ============================================================
   create-event-mobile.css — Posh-inspired iPhone layout
   Cover hero → Add song / Theme → form → Customise → Publish
   ============================================================ */

@media (max-width: 767px) {

  /* ── Topbar ── */
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar-center img { height: 20px !important; }
  /* Topbar autosave hidden on mobile — status shown in sticky bar instead */
  .autosave-indicator { display: none !important; }
  .btn-ghost-sm  { display: none !important; }
  .btn-publish   { display: none !important; }   /* replaced by sticky bar */

  /* ── Page layout ── */
  .page-container {
    flex-direction: column;
    overflow-x: hidden;
  }

  /* ── Left panel: hidden — content extracted by JS ── */
  .mobile-hidden-panel {
    display: none !important;
  }

  /* ── Event name + meta not shown in mobile layout ── */
  #panelEventName,
  #panelEventMeta {
    display: none !important;
  }

  /* ────────────────────────────────────────────────────────
     Cover hero — full-bleed, portrait
  ──────────────────────────────────────────────────────── */
  .mobile-cover-hero {
    width: 100%;
    flex-shrink: 0;
    padding: 12px 16px 0;
    box-sizing: border-box;
    background: linear-gradient(180deg,
      color-mix(in srgb, var(--accent) 28%, transparent) 0%,
      color-mix(in srgb, var(--accent)  8%, transparent) 100%
    );
  }

  .mobile-cover-hero .panel-cover-zone {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 4 / 5;
    border-radius: 12px !important;
    border: none !important;
    margin: 0 !important;
    background-color: var(--bg-input) !important;
    background-image: none !important;
    background-size: cover !important;
    background-position: center !important;
  }

  /* Upload placeholder → centered pill button */
  .mobile-cover-hero .panel-cover-inner {
    flex-direction: row;
    background: rgba(255,255,255,0.88);
    border-radius: 50px;
    padding: 13px 26px;
    gap: 8px;
  }
  .mobile-cover-hero .panel-cover-icon {
    width: auto;
    height: auto;
    background: none;
    border-radius: 0;
  }
  .mobile-cover-hero .panel-cover-icon svg path { stroke: rgba(0,0,0,0.70); }
  .mobile-cover-hero .panel-cover-icon svg rect { fill: rgba(0,0,0,0.36); }
  .mobile-cover-hero .panel-cover-label {
    font: 600 15px/1 'DM Sans', sans-serif;
    color: #0C0C12;
  }

  /* ────────────────────────────────────────────────────────
     Add song + Theme quick buttons
  ──────────────────────────────────────────────────────── */
  .mobile-quick-row {
    display: flex;
    gap: 10px;
    padding: 12px 16px 10px;
    background: var(--bg-page);
    box-sizing: border-box;
    width: 100%;
  }

  .mobile-quick-btn {
    flex: 1 1 0%;
    min-width: 0;
    width: 0;          /* force equal split from zero basis */
    height: 46px;
    background: var(--bg-raised);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font: 500 13px/1 'DM Sans', sans-serif;
    color: rgba(255,255,255,0.72);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .mobile-quick-btn svg { opacity: 0.64; transition: opacity 0.15s; }
  .mobile-quick-btn.active {
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.22);
    color: var(--text-primary);
  }
  .mobile-quick-btn.active svg { opacity: 1; }
  .mobile-quick-btn:active { opacity: 0.72; }

  /* ────────────────────────────────────────────────────────
     Quick panels — shown when button is active
  ──────────────────────────────────────────────────────── */
  .mobile-quick-panel {
    display: block;
    padding: 0 16px 8px;
    background: var(--bg-page);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, max-height 0.2s ease;
  }
  .mobile-quick-panel.open { opacity: 1; max-height: 600px; pointer-events: auto; }

  /* Force sections inside to always be expanded */
  .mobile-quick-panel .panel-section { margin-bottom: 6px; }
  .mobile-quick-panel .panel-section-body {
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    padding-top: 10px !important;
  }
  /* Hide the section collapse header — content is always shown */
  .mobile-quick-panel .panel-section-hdr { display: none; }

  /* Font tile grid: 5 cols */
  .font-tile-grid { grid-template-columns: repeat(5, 1fr); }

  /* ── Divider between hero zone and form ── */
  .mobile-hero-divider {
    height: 1px;
    background: rgba(255,255,255,0.08);
  }

  /* ────────────────────────────────────────────────────────
     Right form
  ──────────────────────────────────────────────────────── */
  .right-form {
    width: 100%;
    max-width: 100%;
    /* Bottom padding = bar content (10+20px status+8px gap+50px btn) + clearance + safe-area + 12px */
    padding: 20px 16px calc(90px + max(16px, env(safe-area-inset-bottom, 0px)) + 12px);
    background: var(--bg-form, var(--bg-page));
    flex: 1;
  }

  /* ── Form layout ── */
  .grid-2 { grid-template-columns: 1fr; }
  .form-section + .form-section { padding-top: 20px; }
  .gallery-row { grid-template-columns: repeat(3, 1fr); }

  /* ── Ticket tiers ── */
  .tier-row,
  .tier-row-header {
    grid-template-columns: 12px 1fr 36px 68px 48px 22px;
    gap: 6px;
  }
  .tier-input { height: 44px; padding: 0 7px; font-size: 12px; touch-action: manipulation; }
  .tier-price-wrap .tier-input { padding-left: 20px; }
  .tier-price-prefix { font-size: 10px; left: 6px; }
  .tier-delete { width: 22px; height: 22px; }

  /* ── Section header summary (compact on mobile) ── */
  .section-summary { max-width: 140px; }

  /* ── Who is Going block ── */
  .wg-block {
    padding-top: 20px;
    padding-bottom: 8px;
    border-top: none;
    margin-top: 0;
  }
  /* Restore section spacing for venue which now follows wg-block (a div, not form-section) */
  #section-venue { padding-top: 20px; }

  /* ── Genre chips ── */
  .genre-chip { padding: 7px 12px; font-size: 12px; }
  .genre-category-label { font-size: 10px; }

  .status-pills { flex-wrap: wrap; gap: 6px; }
  .status-pill { height: 26px; padding: 0 10px; font-size: 11px; }
  .section-title { letter-spacing: 1.8px; }
  .date-row-label {
    width: auto;
    font: 700 15px/1 'DM Sans', sans-serif;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.56);
  }
  .input-event-name { font-size: 22px !important; }

  /* ────────────────────────────────────────────────────────
     Customise section — collapsible at bottom of form
     (contains Promo Video + Gallery)
  ──────────────────────────────────────────────────────── */
  .mobile-customise-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .mobile-customise-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 2px 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
  }

  .mobile-customise-title {
    font: 600 11px/1 'DM Sans', sans-serif;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.52);
  }

  .mobile-customise-chevron {
    width: 16px; height: 16px;
    color: rgba(255,255,255,0.38);
    transition: transform 0.22s;
    flex-shrink: 0;
  }
  .mobile-customise-section.open .mobile-customise-chevron {
    transform: rotate(180deg);
  }

  .mobile-customise-body {
    display: block;
    padding-top: 14px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, max-height 0.25s ease;
  }
  .mobile-customise-section.open .mobile-customise-body {
    opacity: 1;
    max-height: 800px;
    pointer-events: auto;
  }

  /* Force expand panel sections inside customise */
  .mobile-customise-body .panel-section { margin-bottom: 14px; }
  .mobile-customise-body .panel-section-body {
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    padding-top: 10px !important;
  }
  .mobile-customise-body .panel-section-hdr { display: none; }

  /* ────────────────────────────────────────────────────────
     Sticky publish bar
     Total height = 10px top + 50px btn + max(16px, safe-area)
     → 76px on flat-bottom phones, ~94px on notched/pill phones
  ──────────────────────────────────────────────────────── */
  .mobile-publish-bar {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* Horizontal safe-area for landscape / notch sides */
    padding: 10px max(16px, env(safe-area-inset-right, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    /* Always clear the home indicator / gesture bar */
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    background: var(--bg-card);
    /* Subtle fade so scrolled content doesn't abruptly cut off */
    box-shadow: 0 -12px 20px 4px var(--bg-page);
    border-top: 1px solid rgba(255,255,255,0.07);
    z-index: 100;
    box-sizing: border-box;
  }

  .mobile-publish-bar-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-review-notice {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font: 500 12.5px/1.45 'DM Sans', sans-serif;
    color: #ffffff;
    padding: 0 2px;
  }

  .mobile-publish-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font: 400 11px/1 'DM Sans', sans-serif;
    color: rgba(255,255,255,0.40);
    padding: 0 2px;
    transition: color 0.25s;
  }
  .mobile-publish-status.saving { color: rgba(255,255,255,0.52); }
  .mobile-publish-status.saved  { color: rgba(100, 192, 132, 0.82); }

  .mobile-publish-status-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255,255,255,0.28);
    flex-shrink: 0;
    transition: background 0.25s;
  }
  .mobile-publish-status.saving .mobile-publish-status-dot {
    background: rgba(255,255,255,0.48);
  }
  .mobile-publish-status.saved .mobile-publish-status-dot {
    background: rgba(100, 192, 132, 0.90);
  }

  .mobile-publish-btn {
    width: 100%;
    min-height: 50px;
    height: 50px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.32);
    font: 600 15px/1 'DM Sans', sans-serif;
    color: #FFFFFF;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: opacity 0.15s;
  }
  .mobile-publish-btn:active { opacity: 0.75; }

  /* Google Places autocomplete must appear above the sheet */
  .pac-container { z-index: 302 !important; }

  /* ────────────────────────────────────────────────────────
     Bottom Sheet
  ──────────────────────────────────────────────────────── */
  .mobile-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    z-index: 300;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    will-change: opacity;
    transition: opacity 0.22s ease;
  }
  .mobile-sheet-backdrop.open { opacity: 1; pointer-events: auto; }

  .mobile-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #0F0F1A;
    border-radius: 20px 20px 0 0;
    z-index: 301;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 88dvh;
    display: flex;
    flex-direction: column;
    will-change: transform;
  }
  .mobile-sheet.open { transform: translateY(0); }

  .mobile-sheet-drag-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
  }

  .mobile-sheet-hdr {
    padding: 18px 20px 10px;
    text-align: center;
    flex-shrink: 0;
  }
  .mobile-sheet-title {
    font: 700 17px/1 'DM Sans', sans-serif;
    color: var(--text-primary);
    letter-spacing: -0.01em;
  }

  .mobile-sheet-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 20px 16px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }

  /* Force visibility of any content moved into the sheet */
  .mobile-sheet-body .section-body,
  .mobile-sheet-body .section-body.collapsed,
  .mobile-sheet-body .desc-body,
  .mobile-sheet-body .panel-section-body {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    display: block !important;
    padding-top: 8px !important;
    transition: none !important;
  }
  .mobile-sheet-body .panel-section-hdr { display: none; }

  /* desc-body overrides block→flex so the editor can stretch to fill height */
  .mobile-sheet-body .desc-body {
    display: flex !important;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding-top: 0 !important;
  }
  .mobile-sheet-body .desc-inline-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .mobile-sheet-footer {
    padding: 12px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }
  .mobile-sheet-close-btn {
    width: 100%;
    height: 48px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    font: 500 15px/1 'DM Sans', sans-serif;
    color: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background 0.15s;
  }
  .mobile-sheet-close-btn:active { background: rgba(255, 255, 255, 0.06); }

  /* Sub-section labels inside theme sheet */
  .mobile-sheet-sub-label {
    font: 600 10px/1 'DM Sans', sans-serif;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.36);
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .mobile-sheet-sub-group { margin-bottom: 22px; }
  .mobile-sheet-sub-group:last-child { margin-bottom: 0; }

  /* ────────────────────────────────────────────────────────
     Description sheet — editor expansion + toolbar fixes
  ──────────────────────────────────────────────────────── */

  /* Editor fills remaining flex space — toolbar always visible at bottom.
     flex-basis: 0 + overflow-y: auto ensures long content scrolls inside the
     editor rather than growing the sheet and pushing the toolbar off-screen.
     min-height: 300px keeps a comfortable editing area and ensures the emoji
     picker (~264px, opening upward) never clips at the sheet body boundary. */
  .mobile-sheet-body .desc-inline-editor {
    flex: 1 1 0;
    min-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Toolbar pinned at bottom, never pushed off-screen */
  .mobile-sheet-body .desc-inline-footer {
    flex-shrink: 0;
  }

  /* Toolbar: bigger touch targets (≥40px for comfortable mobile tap) */
  .mobile-sheet-body .desc-toolbar-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
  }
  .mobile-sheet-body .desc-font-btn {
    width: auto;
    padding: 0 10px;
  }
  .mobile-sheet-body .desc-toolbar-sep {
    height: 18px;
  }

  /* Flip emoji picker UPWARD — escapes sheet overflow-y clipping */
  .mobile-sheet-body .desc-emoji-picker {
    top: auto;
    bottom: calc(100% + 8px);
    right: 0;
    max-width: calc(100vw - 48px);
  }
  /* Smaller emoji grid so the picker fits comfortably on small phones */
  .mobile-sheet-body .emoji-grid {
    max-height: 140px;
  }

  /* Flip link dialog UPWARD — same reason */
  .mobile-sheet-body .desc-link-dialog {
    top: auto;
    bottom: calc(100% + 8px);
  }

  /* ────────────────────────────────────────────────────────
     Flyer upload sheet
  ──────────────────────────────────────────────────────── */
  .mobile-flyer-upload-zone {
    border: 1.5px dashed rgba(255,255,255,0.22);
    border-radius: 12px;
    background: var(--bg-raised);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    margin-bottom: 18px;
  }
  .mobile-flyer-upload-zone:active { opacity: 0.72; }

  .mobile-flyer-upload-icon {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.10);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

  .mobile-flyer-upload-text { flex: 1; min-width: 0; }

  .mobile-flyer-upload-title {
    font: 600 14px/1 'DM Sans', sans-serif;
    color: var(--text-primary);
    margin-bottom: 6px;
  }

  .mobile-flyer-upload-spec {
    font: 400 12px/1.45 'DM Sans', sans-serif;
    color: rgba(255,255,255,0.50);
  }

  /* Default flyer 2-column grid */
  .mobile-flyer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-bottom: 4px;
  }

  .mobile-flyer-cell {
    aspect-ratio: 4 / 5;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    position: relative;
    background: var(--bg-raised);
    border: 2px solid transparent;
    transition: border-color 0.15s, opacity 0.15s;
  }
  .mobile-flyer-cell:active { opacity: 0.75; }
  .mobile-flyer-cell.selected { border-color: rgba(255,255,255,0.86); }

  .mobile-flyer-cell img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* ────────────────────────────────────────────────────────
     Description inline formatted preview
     When the sheet closes with content, the formatted HTML
     (bold, italic, bullets, links) is rendered in-place —
     toolbar is hidden, editor is read-only.
     Tapping reopens the sheet.
  ──────────────────────────────────────────────────────── */
  #descWrapper.mobile-desc-has-content #descBody {
    max-height: 600px !important;
    opacity: 1 !important;
    overflow: hidden !important;
    transition: none !important;
  }
  #descWrapper.mobile-desc-has-content .desc-inline-footer {
    display: none !important;
  }
  #descWrapper.mobile-desc-has-content .desc-inline-editor {
    min-height: 0 !important;
    max-height: 90px;
    overflow: hidden;
    padding-bottom: 0;
    -webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
  }
  #descWrapper.mobile-desc-has-content .desc-inline-card {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #descWrapper.mobile-desc-has-content .desc-inline-card::after {
    content: 'Tap to edit';
    display: block;
    font: 400 11px/1 'DM Sans', sans-serif;
    color: rgba(255,255,255,0.28);
    text-align: right;
    padding: 6px 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.07);
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   ENHANCED ANIMATIONS & MICROINTERACTIONS — MOBILE
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Haptic Tap Visual Feedback ── */

@media (max-width: 767px) {
  .mobile-tap-feedback {
    transition: transform 100ms ease;
  }
  .mobile-tap-feedback:active {
    transform: scale(0.96);
  }

  .mobile-publish-btn:active {
    transform: scale(0.97);
    background: rgba(255,255,255,0.24) !important;
  }
}


/* ── 2. Bottom Sheet Spring Entry ── */

@keyframes sheetSpringIn {
  0%   { transform: translateY(100%); }
  55%  { transform: translateY(-4px); }
  80%  { transform: translateY(2px); }
  100% { transform: translateY(0); }
}

@media (max-width: 767px) {
  .mobile-sheet.spring-in {
    animation: sheetSpringIn 320ms cubic-bezier(0.32,0.72,0,1) forwards;
  }
}


/* ── 3. Pull Handle Visual Affordance ── */

@media (max-width: 767px) {
  .sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255,255,255,0.20);
    border-radius: 2px;
    margin: 8px auto 0;
    transition: background 0.18s ease;
  }
  .sheet-handle:hover {
    background: rgba(255,255,255,0.35);
  }
}


/* ── 4. Mobile Section Tap Ripple ── */

@keyframes sectionTap {
  0%   { background: rgba(255,255,255,0.00); }
  30%  { background: rgba(255,255,255,0.06); }
  100% { background: rgba(255,255,255,0.00); }
}

@media (max-width: 767px) {
  .mobile-section-tap {
    animation: sectionTap 400ms ease forwards;
  }
}


/* ── 5. Floating Action Button Pulse (unsaved changes) ── */

@keyframes fabPulse {
  0%,100% { box-shadow: 0 0 0 0   rgba(255,255,255,0.15); }
  50%     { box-shadow: 0 0 0 8px rgba(255,255,255,0.00); }
}

@media (max-width: 767px) {
  .mobile-publish-btn.has-changes {
    animation: fabPulse 2s ease infinite;
  }
}


/* ── Reduced-motion: disable all mobile-enhanced animations ── */
@media (prefers-reduced-motion: reduce) {
  .mobile-tap-feedback:active,
  .mobile-publish-btn:active,
  .mobile-sheet.spring-in,
  .mobile-section-tap,
  .mobile-publish-btn.has-changes {
    animation: none;
    transform: none;
  }
}
