/* ===================================================
   Where2 — global styles
   Dark theme matching the original React design.
   MudBlazor provides component styles; this file adds
   layout, glass morphism, gradients, and mobile nav.
=================================================== */

/* ─── CSS Variables for Theming ─────────────────── */
:root, html.dark {
    --w2-bg-primary: #000000;
    --w2-bg-secondary: #1a1a2e;
    --w2-text-primary: #ffffff;
    --w2-text-secondary: rgba(255, 255, 255, 0.5);
    --w2-text-tertiary: rgba(255, 255, 255, 0.4);
    --w2-glass-bg: rgba(255, 255, 255, 0.05);
    --w2-glass-border: rgba(255, 255, 255, 0.1);
    --w2-glass-strong-bg: rgba(20, 20, 30, 0.9);
    --w2-input-bg: rgba(255, 255, 255, 0.1);
    --w2-input-border: rgba(255, 255, 255, 0.1);
    --w2-shadow: rgba(0, 0, 0, 0.4);
}

html.light {
    --w2-bg-primary: #eef4ff;
    --w2-bg-secondary: #dfe9ff;
    --w2-text-primary: #111827;
    --w2-text-secondary: rgba(17, 24, 39, 0.72);
    --w2-text-tertiary: rgba(30, 41, 59, 0.58);
    --w2-glass-bg: rgba(59, 130, 246, 0.08);
    --w2-glass-border: rgba(59, 130, 246, 0.14);
    --w2-glass-strong-bg: rgba(255, 255, 255, 0.78);
    --w2-input-bg: rgba(255, 255, 255, 0.8);
    --w2-input-border: rgba(59, 130, 246, 0.18);
    --w2-shadow: rgba(37, 99, 235, 0.16);
}

/* ─── Reset / Base ───────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--w2-bg-primary);
    color: var(--w2-text-primary);
    font-family: 'Roboto', sans-serif;
    overflow-x: hidden;
}

/* ─── Light Theme ────────────────────────────────── */
html.light, html.light body {
    background: var(--w2-bg-primary);
    color: var(--w2-text-primary);
}

html.light .w2-layout-root {
    background: var(--w2-bg-primary);
    color: var(--w2-text-primary);
}

html.light .w2-content {
    background: var(--w2-bg-primary);
}

html.light .glass {
    background: var(--w2-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--w2-glass-border);
}

html.light .glass-strong {
    background: var(--w2-glass-strong-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--w2-glass-border);
    color: var(--w2-text-primary);
}

html.light .mud-paper {
    background-color: #ffffff !important;
    color: #1a1a1a !important;
}

html.light .mud-typography {
    color: #1a1a1a !important;
}

html.light .mud-typography-secondary {
    color: #666666 !important;
}

html.light svg {
    color: #1a1a1a;
}

html.light button {
    color: #1a1a1a;
}

/* Cascade text colour into page content so elements without explicit inline
   colour naturally pick up the light theme value. Inline color:# overrides
   still win — this only helps elements that have no colour set. */
html.light .w2-content {
    color: var(--w2-text-primary);
}

html.light a {
    color: var(--w2-text-primary);
}

/* ─── Layout root ────────────────────────────────── */
.w2-layout-root {
    min-height: 100vh;
    background: var(--w2-bg-primary);
    color: var(--w2-text-primary);
}

.w2-content {
    max-width: 448px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: 88px;
    position: relative;
}

/* Friends Map full-screen mode: remove all extra space so page height = viewport */
html.map-fullscreen .w2-content {
    min-height: 0;
    padding-bottom: 0;
}

/* ─── Glass morphism ─────────────────────────────── */
.glass {
    background: var(--w2-glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--w2-glass-border);
}

.glass-strong {
    background: var(--w2-glass-strong-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--w2-glass-border);
    color: var(--w2-text-primary);
}

/* ─── Gradients ──────────────────────────────────── */
.gradient-text {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 50%, #f97316 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-bg {
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
}

/* ─── Scrollbar hide ─────────────────────────────── */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* ─── Safe area (iOS notch / home bar) ───────────── */
.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 16px);
}

/* ─── Bottom navigation bar ──────────────────────── */
.w2-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    pointer-events: none;
}

.platform-maui .w2-bottom-nav {
    z-index: 1001;
}

/* The floating pill */
.w2-nav-pill {
    background: var(--w2-nav-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px var(--w2-shadow);
    display: flex;
    align-items: center;
    padding: 4px 0;
    padding-bottom: calc(4px + 0px);
}

/* Each tab item */
.w2-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    text-decoration: none;
    padding: 2px 0;
    color: var(--w2-nav-inactive);
    -webkit-tap-highlight-color: transparent;
}

.w2-nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
    stroke: currentColor;
    color: inherit;
}

.w2-nav-item:active {
    transform: scale(0.9);
}

.w2-nav-item.active {
    color: var(--w2-nav-active);
}

/* Nav-specific variables */
:root, html.dark {
    --w2-nav-bg:       rgba(20, 20, 30, 0.96);
    --w2-nav-active:   #ef4444;
    --w2-nav-inactive: #9ca3af;
}

html.light {
    --w2-nav-bg:       rgba(255, 255, 255, 0.98);
    --w2-nav-active:   #ef4444;
    --w2-nav-inactive: #6b7280;
}

/* ─── Map container ──────────────────────────────── */
.map-container {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: 8px;
    overflow: hidden;
}

.map-full-page {
    position: fixed;
    inset: 0;
    z-index: 0;
}

/* ─── Event Card ─────────────────────────────────── */
.event-card {
    cursor: pointer;
    transition: transform 0.15s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.event-card:active {
    transform: scale(0.98);
}

/* Category colour dots on compact cards */
.cat-dot-nightlife  { background: linear-gradient(to right, #9333ea, #db2777); }
.cat-dot-dining     { background: linear-gradient(to right, #f97316, #ef4444); }
.cat-dot-concerts   { background: linear-gradient(to right, #ec4899, #f43f5e); }
.cat-dot-sports     { background: linear-gradient(to right, #22c55e, #10b981); }
.cat-dot-networking { background: linear-gradient(to right, #3b82f6, #06b6d4); }
.cat-dot-wellness   { background: linear-gradient(to right, #2dd4bf, #06b6d4); }
.cat-dot-arts       { background: linear-gradient(to right, #f43f5e, #ec4899); }
.cat-dot-outdoor    { background: linear-gradient(to right, #10b981, #22c55e); }
.cat-dot-festivals  { background: linear-gradient(to right, #f59e0b, #f97316); }
.cat-dot-other      { background: linear-gradient(to right, #64748b, #475569); }

/* ─── Chat thread ────────────────────────────────── */
.chat-bubble-user {
    background: rgba(168, 85, 247, 0.2);
    border-radius: 12px 12px 0 12px;
    padding: 8px 12px;
    max-width: 75%;
    color: #fff;
}

.chat-bubble-other {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px 12px 12px 0;
    padding: 8px 12px;
    max-width: 75%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ─── Notification badge pulse ───────────────────── */
@keyframes badge-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.notification-badge-pulse .mud-badge-dot {
    animation: badge-pulse 1.5s infinite;
}

/* ─── Analytics metric card ──────────────────────── */
.metric-card {
    border-radius: 16px;
    padding: 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: box-shadow 0.15s ease;
    color: #fff;
}

.metric-card:hover {
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2);
}

/* ─── Skeleton loader ────────────────────────────── */
.skeleton-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
    background: var(--w2-glass-border);
    border-radius: 24px;
    height: 112px;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ─── Loading overlay ────────────────────────────── */
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    width: 100%;
}

/* ─── Stepper (reservation flow) ────────────────── */
.reservation-stepper .mud-step-label-text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ─── Scroll lock (map full-screen) ──────────────── */
body.map-active {
    overflow: hidden;
}

/* ─── Map screen panel animations ───────────────── */
@keyframes fadeDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.w2-fade-down { animation: fadeDown 0.15s ease both; }
.w2-slide-up  { animation: slideUp  0.2s  ease both; }

@keyframes pinPopup {
    from { opacity: 0; transform: scale(0.93) translateY(-4px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.w2-pin-popup { animation: pinPopup 0.18s ease both; }

/* ─── Native <select> / <option> theming ────────── */
select {
    background-color: var(--w2-bg-secondary);
    color: var(--w2-text-primary);
}

select option {
    background-color: var(--w2-bg-secondary);
    color: var(--w2-text-primary);
}

html.light select {
    background-color: #ffffff;
    color: #1a1a1a;
}

html.light select option {
    background-color: #ffffff;
    color: #1a1a1a;
}

/* ─── MudBlazor dark overrides ───────────────────── */
.mud-table-row.mud-table-row-dense td {
    padding: 4px 8px;
}

/* ─── Desktop sidebar ────────────────────────────── */
.w2-sidebar {
    display: none; /* hidden on mobile */
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 220px;
    z-index: 1000;
    padding: 24px 12px;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
    scrollbar-width: none;
    background: rgba(10, 10, 15, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.w2-sidebar-logo {
    padding: 4px 12px 20px;
    font-size: 22px;
    font-weight: 800;
}

.w2-sidebar-logo-word {
    color: #ffffff;
}

.w2-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 14px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.45);
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.w2-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
}

.w2-sidebar-item.w2-sidebar-active {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

/* ─── Sidebar light theme overrides ─────────────── */
html.light .w2-sidebar {
    background: linear-gradient(180deg, rgba(191, 219, 254, 0.96) 0%, rgba(224, 242, 254, 0.96) 100%);
    border-right: 1px solid rgba(96, 165, 250, 0.18);
}

html.light .w2-sidebar-item {
    color: rgba(37, 99, 235, 0.78);
}

html.light .w2-sidebar-item:hover {
    background: rgba(255, 255, 255, 0.52);
    color: #2563eb;
}

html.light .w2-sidebar-item.w2-sidebar-active {
    background: rgba(255, 255, 255, 0.72);
    color: #2563eb;
    box-shadow: 0 10px 24px rgba(96, 165, 250, 0.14);
}

html.light .w2-sidebar-logo-word {
    color: #111827;
}

/* ─── Responsive breakpoints ─────────────────────── */

/* Floating gear button — mobile only (mirrors bottom-nav visibility) */
.w2-floating-gear { display: none; }

.w2-home-top-bar {
    /* No special MAUI overrides needed — native ContentPage.Padding handles insets */
}

/* Map filter wrapper — centered on desktop, left-aligned with gear gap on mobile */
.w2-map-filter-mobile { max-width: 448px; margin: 0 auto; }

@media (max-width: 767px) {
    .w2-floating-gear     { display: flex !important; }
    .w2-map-filter-mobile { max-width: none !important; margin-left: 0 !important; margin-right: 68px !important; }
}

/* Tablet (both platforms): show bottom nav + gear, no sidebar */
@media (min-width: 768px) {
    .w2-floating-gear { display: flex !important; }
    .w2-content {
        max-width: 860px;
        padding-bottom: 40px;
    }
}

/* Desktop: web browsers get the sidebar instead of bottom nav */
@media (min-width: 1280px) {
    .platform-web .w2-sidebar        { display: flex; }
    .platform-web .w2-bottom-nav     { display: none !important; }
    .platform-web .w2-floating-gear  { display: none !important; }
    .platform-web.w2-layout-root     { padding-left: 220px; }
    .w2-content { max-width: 980px; }
    /* Host + My Venues are in sidebar on desktop — hide from settings page */
    .platform-web .w2-profile-desktop-hide { display: none !important; }
}

/* Desktop: wider sidebar + wider content */
@media (min-width: 1440px) {
    .platform-web .w2-sidebar     { width: 240px; }
    .platform-web.w2-layout-root  { padding-left: 240px; }
    .w2-content     { max-width: 1180px; }
}

/* Large desktop */
@media (min-width: 1536px) {
    .w2-content { max-width: 1380px; }
}

/* Wide/4K — fill the available space */
@media (min-width: 1920px) {
    .platform-web .w2-sidebar     { width: 260px; }
    .platform-web.w2-layout-root  { padding-left: 260px; }
    .w2-content     { max-width: 1560px; }
}

/* ── Hide Google Maps keyboard-shortcuts / terms / attribution bar on MAUI ── */
.platform-maui .gm-style .gm-style-cc,
.platform-maui .gm-style > div > div > div > div > a[href*="maps.google.com"],
.platform-maui .gm-style a[href^="https://maps.google.com/maps"],
.platform-maui .gm-style a[title="Open this area in Google Maps"],
.platform-maui .gm-style .gmnoprint:not([class*="gm-bundled-control"]) {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* ── Shared back button ──────────────────────────────────────────────────── */
.w2-back-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 9px 16px; border-radius: 12px;
    border: 1px solid var(--w2-glass-border);
    background: var(--w2-glass-bg); color: var(--w2-text-secondary);
    font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .15s;
    margin-bottom: 20px;
}
.w2-back-btn:hover { background: var(--w2-glass-border); transform: translateX(-1px); }
.w2-back-btn svg   { color: #a855f7; flex-shrink: 0; }
