/* =====================================================
   Meetlio — Guest App Styles
   ===================================================== */

/* ---- Welcome / PIN Entry ---- */
.welcome-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    text-align: center;
    background: linear-gradient(160deg, var(--color-surface) 0%, var(--color-surface-alt) 100%);
}

.welcome-hero {
    margin-bottom: var(--space-2xl);
}

.couple-names {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    letter-spacing: -0.02em;
    margin-bottom: var(--space-sm);
}

.event-date {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    font-weight: 300;
}

.pin-form-container {
    background: var(--color-surface-card);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-lg);
    width: min(90vw, 400px);
}

.pin-form-container h2 {
    font-size: 1.3rem;
    margin-bottom: var(--space-sm);
}

.pin-hint {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

.pin-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.pin-input {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    font-family: var(--font-body);
    padding: 0.7em;
}

.language-toggle {
    position: fixed;
    bottom: var(--space-lg);
    right: var(--space-lg);
    display: flex;
    gap: var(--space-sm);
}

.lang-btn {
    background: var(--color-surface-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    padding: var(--space-sm) var(--space-md);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.lang-btn:hover {
    box-shadow: var(--shadow-md);
    transform: scale(1.05);
}

/* ---- Guest App Layout ---- */
.guest-main {
    padding: var(--space-md) var(--space-md) 5rem;
    max-width: 600px;
    margin: 0 auto;
}

.guest-header {
    padding: var(--space-lg) 0 var(--space-md);
    text-align: center;
}

.guest-header h1 {
    font-size: 1.6rem;
}

.couple-names-sm {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--color-primary);
    text-align: center;
    padding: var(--space-sm);
}

/* ---- Bottom Navigation ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-surface-card);
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    padding: var(--space-sm) 0;
    z-index: 50;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.72rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: var(--space-xs) var(--space-sm);
    transition: color var(--transition-fast);
}

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

.nav-item:hover {
    color: var(--color-primary-dark);
}

.nav-icon {
    font-size: 1.3rem;
}

/* ---- Home ---- */
.home-hero {
    margin-bottom: var(--space-xl);
}

.welcome-card {
    background: var(--color-surface-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.welcome-card h2 {
    font-size: 1.4rem;
    margin-bottom: var(--space-sm);
}

.seat-info {
    color: var(--color-primary);
    font-weight: 500;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.action-card {
    background: var(--color-surface-card);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    text-decoration: none;
    color: var(--color-text);
}

.action-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.action-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: var(--space-sm);
}

.action-label {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ---- Menu ---- */
.menu-section {
    background: var(--color-surface-card);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    box-shadow: var(--shadow-sm);
}

.section-title {
    color: var(--color-primary);
    border-bottom: 1px solid var(--color-border);
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-md);
}

.menu-item {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-surface-alt);
}

.menu-item:last-child {
    border: none;
}

.menu-item h3 {
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 500;
}

.menu-item p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.allergens {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--color-text-light);
    background: var(--color-surface-alt);
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    margin-top: var(--space-xs);
}

/* ---- Schedule ---- */
.schedule-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-left: 3px solid var(--color-primary-light);
    padding-left: var(--space-md);
    margin-left: var(--space-md);
    margin-bottom: var(--space-sm);
}

.schedule-time {
    font-weight: 600;
    color: var(--color-primary);
    min-width: 3.5em;
    font-size: 0.95rem;
}

.schedule-detail h3 {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 1rem;
}

.schedule-detail p {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 2px;
}

/* ---- Seating ---- */
.my-seat-card {
    background: var(--color-surface-card);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-xl);
}

.my-seat-card h2 {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.table-name {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--color-primary-dark);
    margin: var(--space-sm) 0;
}

.seat-name {
    color: var(--color-text-muted);
}

.search-box {
    margin-bottom: var(--space-md);
}

.search-input {
    font-size: 1rem;
}

.search-result {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-md);
    background: var(--color-surface-card);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-xs);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    font-size: 0.95rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.search-result:hover { background: var(--color-surface-alt); }
.search-result:active { transform: scale(0.99); }

/* ---- Guests ---- */
.guest-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.guest-card {
    display: block;
    background: var(--color-surface-card);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-sm);
    color: var(--color-text);
    text-decoration: none;
    border: 1px solid var(--color-border);
    transition: background 0.12s ease, transform 0.12s ease;
}
.guest-card:hover { background: var(--color-surface-alt); }
.guest-card:active { transform: scale(0.99); }
.guest-card-noseat { cursor: default; }
.guest-card-noseat:hover { background: var(--color-surface-card); }
.guest-card-noseat:active { transform: none; }

.guest-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}
.guest-card h3 {
    font-family: var(--font-body);
    font-weight: 500;
    margin: 0;
}
.guest-card-chev {
    color: var(--color-text-muted);
    font-size: 1.4rem;
    line-height: 1;
}
.guest-card-noseat .guest-card-chev { display: none; }

.guest-seat {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.88rem;
    color: var(--color-text-muted);
}
.guest-seat-empty { font-style: italic; opacity: 0.7; }

.guest-bio {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-top: 6px;
}

/* Focused-guest banner on seating page */
.focused-guest-banner {
    margin: 0 0 var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface-card);
    border-left: 4px solid #c89a4a;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

/* ---- Photos ---- */
.upload-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.upload-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 18px 12px;
    border-radius: var(--radius-md);
    background: var(--color-surface-card);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    box-shadow: var(--shadow-sm);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.upload-tile:active {
    transform: translateY(1px);
    box-shadow: none;
}
.upload-tile-primary {
    background: var(--color-text);
    color: var(--color-surface);
    border-color: var(--color-text);
}
html[data-theme="dark"] .upload-tile-primary {
    background: #c89a4a;
    color: #1a1614;
    border-color: #c89a4a;
}
.upload-icon { font-size: 1.6rem; line-height: 1; }
.upload-text { font-size: 0.95rem; font-weight: 600; }

.upload-progress {
    text-align: center;
    margin: 0 0 var(--space-md);
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* ── Photo grid (phone-photo-library style) ── */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 4px;
}

.photo-thumb {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background: var(--color-surface-alt);
    border: none;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease;
}
.photo-thumb:active { transform: scale(0.97); }
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.photo-thumb.thumb-pending img,
.photo-thumb.thumb-ready img,
.photo-thumb.thumb-processing img,
.photo-thumb.thumb-uploading img { opacity: 0.55; }
.photo-thumb.thumb-rejected img,
.photo-thumb.thumb-hidden img,
.photo-thumb.thumb-failed img { opacity: 0.4; filter: grayscale(1); }

.thumb-status {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    backdrop-filter: blur(4px);
}
.thumb-status-pending,
.thumb-status-ready,
.thumb-status-processing,
.thumb-status-uploading {
    background: rgba(200, 154, 74, 0.95); /* amber */
}
.thumb-status-rejected,
.thumb-status-hidden,
.thumb-status-failed {
    background: rgba(120, 120, 120, 0.92);
}

.photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface-alt);
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

/* ── Fullscreen viewer (lightbox) ── */
body.viewer-open { overflow: hidden; }
.viewer {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #000;
    display: flex;
    flex-direction: column;
    color: white;
}
.viewer[hidden] { display: none; }

.viewer-topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px calc(env(safe-area-inset-top, 0) + 14px);
    padding-top: calc(env(safe-area-inset-top, 0) + 14px);
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0));
    position: relative;
    z-index: 2;
}
.viewer-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}
.viewer-icon-btn:active { background: rgba(255, 255, 255, 0.22); }
.viewer-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 0;
}
.viewer-counter { font-size: 0.78rem; opacity: 0.75; }
.viewer-uploader {
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60vw;
}
.viewer-status-badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    white-space: nowrap;
    flex-shrink: 0;
}
.viewer-status-badge[hidden] { display: none; }
.viewer-status-pending  { background: rgba(200, 154, 74, 0.85); color: #1a1614; }
.viewer-status-approved { background: rgba(70, 170, 95, 0.78); color: white; }
.viewer-status-rejected { background: rgba(170, 70, 70, 0.78); color: white; }

.viewer-stage {
    flex: 1;
    position: relative;
    overflow: hidden;
    touch-action: pan-y;  /* allow vertical pan, JS handles horizontal swipe */
}
/* Rail of 3 image slots (prev / current / next), 300% wide. Centred on slot 1. */
.viewer-rail {
    position: absolute;
    inset: 0;
    width: 300%;
    display: flex;
    transform: translateX(-33.3333%);
    will-change: transform;
}
.viewer-rail.animating {
    transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.viewer-rail-img {
    width: 33.3333%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
    flex-shrink: 0;
}
.viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 64px;
    background: rgba(0, 0, 0, 0.35);
    border: none;
    color: white;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    border-radius: 8px;
    opacity: 0.55;
    transition: opacity 0.15s;
}
.viewer-nav:hover { opacity: 1; }
.viewer-nav:disabled { opacity: 0.2; cursor: default; }
.viewer-nav-prev { left: 10px; }
.viewer-nav-next { right: 10px; }
/* On touch devices, hide nav buttons — users swipe instead. */
@media (hover: none) {
    .viewer-nav { display: none; }
}

.viewer-toolbar {
    flex: 0 0 auto;
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 14px 16px calc(env(safe-area-inset-bottom, 0) + 14px);
    background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0));
    position: relative;
    z-index: 2;
}
.viewer-action {
    background: rgba(255, 255, 255, 0.14);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.viewer-action:active { transform: scale(0.96); }
.viewer-action.action-primary {
    background: rgba(70, 170, 95, 0.85);
    border-color: rgba(70, 170, 95, 0.85);
}
.viewer-action.action-warn {
    background: rgba(200, 154, 74, 0.88);
    border-color: rgba(200, 154, 74, 0.88);
    color: #1a1614;
}
.viewer-action.action-danger {
    background: rgba(170, 70, 70, 0.85);
    border-color: rgba(170, 70, 70, 0.85);
}

/* ---- Floor Plan (guest seating map) ---- */
.floor-plan-section {
    margin-bottom: var(--space-xl);
}

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

.floor-plan-header h3 {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.map-wrapper {
    width: 100%;
    /* A comfortable slab of phone screen; grows on larger viewports. */
    height: clamp(280px, 55vh, 520px);
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface-alt);
    position: relative;
}

.map-canvas {
    position: relative;
    /* No fixed dimensions — JS applies a scale+translate transform to fit. */
}

.map-table-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
    transition: box-shadow 0.15s;
}

.map-table-round {
    border-radius: 50%;
    background: var(--color-surface-card);
    border: 2px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.map-table-rect {
    background: var(--color-surface-card);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.map-table-node.map-table-mine {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 111, 90, 0.25), var(--shadow-sm);
}

.map-table-node.map-table-selected {
    box-shadow: 0 0 0 3px rgba(139, 111, 90, 0.4), var(--shadow-md);
}

.map-table-label {
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-text);
    text-align: center;
    pointer-events: none;
    line-height: 1.2;
    padding: 0 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-seat-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-surface-alt);
    border: 1.5px solid #b0a099;
    box-sizing: border-box;
    pointer-events: none;
}

.map-seat-dot.map-seat-assigned {
    background: #c8e6c9;
    border-color: #66bb6a;
}

.map-seat-dot.map-seat-focused {
    background: #c89a4a;
    border-color: #5a3a14;
    width: 14px;
    height: 14px;
    box-shadow: 0 0 0 3px rgba(200, 154, 74, 0.45), 0 0 12px rgba(200, 154, 74, 0.55);
    animation: focusedSeatPulse 1.6s ease-in-out infinite;
    margin: -1px;
}

@keyframes focusedSeatPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(200, 154, 74, 0.45), 0 0 12px rgba(200, 154, 74, 0.55); }
    50%       { box-shadow: 0 0 0 6px rgba(200, 154, 74, 0.20), 0 0 22px rgba(200, 154, 74, 0.75); }
}

.map-seat-dot.map-seat-mine {
    background: var(--color-primary);
    border-color: var(--color-primary-dark);
    width: 14px;
    height: 14px;
    margin: -1px;
}

.map-table-info {
    margin-top: var(--space-sm);
    background: var(--color-surface-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.map-table-info-header {
    padding: var(--space-sm) var(--space-md);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 1rem;
}

.map-seat-list {
    padding: var(--space-xs) 0;
    max-height: 180px;
    overflow-y: auto;
}

.map-seat-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
    font-size: 0.85rem;
}

.map-seat-row.map-seat-row-mine {
    background: rgba(139, 111, 90, 0.08);
    font-weight: 600;
}

.map-seat-row-badge {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 500;
    min-width: 4em;
}

.map-seat-row-name {
    color: var(--color-text-muted);
    font-style: italic;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
    .guest-main {
        max-width: 700px;
        padding-bottom: var(--space-xl);
    }

    .bottom-nav {
        display: none;
    }

    .guest-header::before {
        content: '🏠 Home  |  🍽️ Menu  |  🪑 Seating  |  👥 Guests  |  📷 Photos';
        display: block;
        text-align: center;
        padding: var(--space-sm);
        font-size: 0.85rem;
        color: var(--color-text-muted);
    }

    .couple-names {
        font-size: 4rem;
    }

    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}
.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    padding: 14px 16px;
    background: var(--color-surface-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 60;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--color-text);
    max-width: 560px;
    margin: 0 auto;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner p { flex: 1; line-height: 1.4; margin: 0; }
.cookie-banner .btn { flex-shrink: 0; }

/* Stage block on the guest seating map */
.map-stage-node {
    position: absolute;
    box-sizing: border-box;
    background: repeating-linear-gradient(
        135deg,
        rgba(200, 154, 74, 0.22),
        rgba(200, 154, 74, 0.22) 6px,
        rgba(200, 154, 74, 0.10) 6px,
        rgba(200, 154, 74, 0.10) 12px
    );
    border: 1.5px solid rgba(200, 154, 74, 0.7);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-stage-label {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    color: #5a3a14;
    letter-spacing: 0.06em;
    pointer-events: none;
}
html[data-theme="dark"] .map-stage-label { color: #f0d8a0; }
