* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f8fafc;
    color: #1e293b;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: 100%;
}

/* Header */
.header {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1002;
}

.share-icon-btn {
    position: absolute;
    top: max(0.35rem, env(safe-area-inset-top));
    right: 0.5rem;
    width: 36px;
    height: 36px;
    border: none;
    appearance: none;
    box-shadow: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.34);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.share-icon-btn:hover {
    background: rgba(255, 255, 255, 0.42);
}

.share-icon-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.share-icon-svg {
    width: 17px;
    height: 17px;
    display: block;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.header p {
    font-size: 0.875rem;
    opacity: 0.9;
}

.hall-app-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.hall-app-shell[hidden] {
    display: none !important;
}

.header-toolbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    margin-top: 1rem;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.header-toolbar .view-tabs {
    margin-top: 0;
}

.view-tabs {
    display: flex;
    gap: 0.5rem;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.view-tab {
    flex: 1;
    min-height: 44px;
    min-width: 0;
    padding: 0.5rem 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.view-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.view-tab:focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
}

.view-tab--active {
    color: #1e40af;
    background: white;
    border-color: white;
}

/* Main views: floor plan vs exhibitor list */
.main-views {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.view-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.view-panel--list {
    background: #f8fafc;
}

.view-panel[hidden] {
    display: none !important;
}

/* Main Content */
.map-container {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 1;
    min-height: 0;
    margin: 1rem;
    touch-action: none;
}

.map-canvas {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: grab;
}

.map-canvas.dragging {
    cursor: grabbing;
}

/* Image + booth overlays share one box; zoom/pan apply to this layer only */
.map-plan-stack {
    position: relative;
    display: block;
    width: 100%;
    line-height: 0;
    transform-origin: 0 0;
    transition: transform 0.3s ease;
    touch-action: none;
}

.floor-plan {
    width: 100%;
    height: auto;
    display: block;
    touch-action: none;
    user-select: none;
    vertical-align: top;
}

#boothOverlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.booth-overlay {
    position: absolute;
    background: transparent;
    border: 0px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    pointer-events: all;
    transition: all 0.2s ease;
    z-index: 10;
    opacity: 0;
}

.booth-overlay:hover {
    opacity: 1;
    background: rgba(37, 99, 235, 0.25);
    border: 1px solid #2563eb;
}

.booth-overlay.has-exhibitor:hover {
    background: rgba(34, 197, 94, 0.3);
    border-color: #16a34a;
}

.booth-overlay.no-exhibitor:hover {
    background: rgba(156, 163, 175, 0.3);
    border-color: #6b7280;
}

.booth-overlay.active {
    opacity: 1 !important;
    z-index: 11;
    background: rgba(34, 197, 94, 0.28);
    border: 2px solid #16a34a;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.95),
        0 0 0 4px rgba(22, 163, 74, 0.35);
}

.booth-overlay.active:hover {
    opacity: 1 !important;
    background: rgba(34, 197, 94, 0.36);
    border-color: #15803d;
}

.booth-overlay.booth-outline-pulse {
    opacity: 1 !important;
    z-index: 12;
    animation: boothOutlinePulse 1.35s ease-out 1 forwards;
}

@keyframes boothOutlinePulse {
    0% {
        box-shadow: 0 0 0 2px #16a34a, 0 0 0 0 rgba(22, 163, 74, 0.4);
    }
    45% {
        box-shadow: 0 0 0 3px #16a34a, 0 0 0 12px rgba(22, 163, 74, 0.12);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(22, 163, 74, 0), 0 0 0 0 rgba(22, 163, 74, 0);
    }
}

.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #64748b;
    font-size: 1rem;
}

/* Controls */
.controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 20;
}

.control-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    color: #475569;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #1e293b;
}

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

/* Drawer */
.drawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    max-height: 80vh;
    overflow: hidden;
}

.drawer.open {
    transform: translateY(0);
}

.drawer-handle {
    width: 40px;
    height: 4px;
    background: #d1d5db;
    border-radius: 2px;
    margin: 0.75rem auto 0;
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    padding: 0.25rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    border-radius: 4px;
}

.close-btn:hover {
    color: #1e293b;
    background: #f1f5f9;
}

.drawer-content {
    padding: 2rem 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 4rem);
}

/* Booth Information */
.booth-number {
    font-size: 0.875rem;
    color: #2563eb;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.exhibitor-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 1rem;
}

.location {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
}

.description {
    font-size: 1rem;
    color: #475569;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.contact-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
}

.contact-info p {
    font-size: 0.875rem;
    color: #475569;
    margin-bottom: 0.5rem;
}

.contact-email a,
.contact-phone a,
.contact-website a {
    color: #2563eb;
    text-decoration: none;
}

.contact-email a:hover,
.contact-phone a:hover,
.contact-website a:hover {
    text-decoration: underline;
}

.contact-download-btn {
    margin-top: 0.75rem;
    width: 100%;
    min-height: 44px;
    border: 1px solid #2563eb;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.contact-download-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.contact-download-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.contact-download-hint {
    margin-top: 0.5rem;
    margin-bottom: 0;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 999;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.share-modal[hidden] {
    display: none !important;
}

.share-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.share-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
}

.share-modal-dialog {
    position: relative;
    width: min(92vw, 360px);
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.3);
    padding: 1.25rem 1rem 1rem;
    text-align: center;
    z-index: 1;
}

.share-modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    font-size: 1.3rem;
    line-height: 1;
}

.share-modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.share-modal-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.share-modal-dialog h2 {
    margin-bottom: 0.4rem;
    font-size: 1.2rem;
    color: #0f172a;
}

.share-modal-dialog p {
    margin-bottom: 0.75rem;
    color: #475569;
    font-size: 0.92rem;
}

.share-modal-qr {
    width: min(72vw, 256px);
    height: auto;
    display: block;
    margin: 0 auto 0.65rem;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.share-modal-link-wrap {
    margin-bottom: 0;
}

.share-modal-link-wrap a {
    color: #2563eb;
    text-decoration: none;
    word-break: break-word;
}

.share-modal-link-wrap a:hover {
    text-decoration: underline;
}

.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    transform: translateX(-50%) translateY(12px);
    width: min(92vw, 32rem);
    padding: 0.75rem 0.875rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    font-size: 0.85rem;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1100;
}

.app-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Exhibitor list view */
.exhibitor-list-inner {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1rem 1rem 0;
    max-width: 40rem;
    margin: 0 auto;
    width: 100%;
}

.exhibitor-list-lead {
    font-size: 0.875rem;
    color: #64748b;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.exhibitor-list {
    list-style: none;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.exhibitor-list-empty {
    font-size: 0.9375rem;
    color: #64748b;
    text-align: center;
    padding: 2rem 1rem;
}

.exhibitor-card {
    width: 100%;
    min-height: 44px;
    padding: 1rem 1rem 1rem 1.125rem;
    text-align: left;
    font: inherit;
    color: inherit;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.exhibitor-card:active {
    background: #f8fafc;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.exhibitor-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.exhibitor-card-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.exhibitor-card-text {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.exhibitor-card-name {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.35;
}

.exhibitor-card-contact-sub {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.68em;
    font-weight: 400;
    font-family: inherit;
    line-height: 1.35;
    color: #64748b;
}

.exhibitor-card-booth {
    flex-shrink: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #2563eb;
    line-height: 1.2;
    padding-top: 0.05rem;
}

/* Who made this (standalone SPA view) */
.who-page {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
}

.who-page[hidden] {
    display: none !important;
}

.who-page-header {
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
}

.who-page-nav {
    display: block;
}

.who-page-back {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.who-page-back:hover {
    text-decoration: underline;
}

.who-page-back:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.who-page-main {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 1rem 1.25rem;
}

.who-made-this-inner {
    max-width: 40rem;
    margin: 0 auto;
    padding: 1.1rem 1.15rem 1.25rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    display: grid;
    gap: 1rem;
}

.who-made-this-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    outline: none;
}

.who-made-this-title:focus-visible {
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb;
    border-radius: 4px;
}

.who-made-this-lead {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.45;
    margin-top: -0.35rem;
}

.who-made-this-block h3 {
    font-size: 0.95rem;
    color: #1e40af;
    margin-bottom: 0.25rem;
}

.who-made-this-block p {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
}

.who-made-this-block p + p {
    margin-top: 0.55rem;
}

.who-made-this-inner a {
    color: #2563eb;
    text-decoration: none;
}

.who-made-this-inner a:hover {
    text-decoration: underline;
}

.who-made-this-foot {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
    padding-top: 0.25rem;
    border-top: 1px solid #e2e8f0;
    margin-top: 0.15rem;
}

.who-made-this-foot a {
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.who-made-this-foot a:hover {
    text-decoration: underline;
}

.site-disclaimer {
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: lowercase;
    text-align: center;
    color: #64748b;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
}

/* Responsive Design */
@media (min-width: 768px) {
    .share-icon-btn {
        top: 0.75rem;
        right: 0.75rem;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: rgba(255, 255, 255, 0.26);
    }

    .share-icon-svg {
        width: 19px;
        height: 19px;
    }

    .map-container {
        margin: 2rem;
    }

    .exhibitor-list-inner {
        padding: 1.5rem 2rem 0;
    }

    .header-toolbar {
        flex-direction: row;
        align-items: center;
        justify-content: center;
        max-width: 42rem;
    }

    .who-page-main {
        padding: 1.5rem 2rem 2rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .header p {
        font-size: 1rem;
    }
    
    .drawer {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%) translateY(100%);
        border-radius: 20px;
        max-height: 70vh;
    }
    
    .drawer.open {
        transform: translateX(-50%) translateY(0);
    }
}

/* Touch and Interaction */
@media (hover: none) and (pointer: coarse) {
    .control-btn:hover {
        background: white;
        border-color: #e2e8f0;
        color: #475569;
    }
    
    .close-btn:hover {
        color: #64748b;
        background: none;
    }
    
    /* Mobile touch improvements */
    .booth-overlay {
        /* Make overlays slightly more visible on mobile */
        opacity: 0.2;
        background: rgba(37, 99, 235, 0.15);
        border: 1px solid rgba(37, 99, 235, 0.3);
    }
    
    .booth-overlay.has-exhibitor {
        background: rgba(34, 197, 94, 0.15);
        border-color: rgba(22, 163, 74, 0.3);
    }
    
    .booth-overlay.no-exhibitor {
        background: rgba(156, 163, 175, 0.1);
        border-color: rgba(107, 114, 128, 0.3);
    }
    
    /* Active/pressed state for mobile */
    .booth-overlay:active {
        opacity: 1;
        background: rgba(37, 99, 235, 0.4);
        border-color: #2563eb;
        transform: scale(1.05);
    }
    
    .booth-overlay.has-exhibitor:active {
        background: rgba(34, 197, 94, 0.5);
        border-color: #16a34a;
    }
    
    .booth-overlay.no-exhibitor:active {
        background: rgba(156, 163, 175, 0.5);
        border-color: #6b7280;
    }

    /* Selected booth (drawer open): overrides faint default mobile booth tint */
    .booth-overlay.active,
    .booth-overlay.has-exhibitor.active,
    .booth-overlay.no-exhibitor.active {
        opacity: 1 !important;
        transform: none;
        z-index: 11;
        border-width: 2px;
        border-style: solid;
        border-color: #16a34a;
        background: rgba(34, 197, 94, 0.32);
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.95),
            0 0 0 4px rgba(22, 163, 74, 0.4),
            0 2px 10px rgba(22, 163, 74, 0.35);
    }
}

/* Handle notch on newer iPhones */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .drawer,
    .overlay,
    .map-plan-stack,
    .app-toast {
        transition: none;
    }

    .booth-overlay.booth-outline-pulse {
        animation: none;
        outline: 2px solid #16a34a;
        outline-offset: 1px;
        box-shadow: none;
    }
}
