:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --input-bg: #2c2c2c;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #E60023; /* Premium Red */
    --accent-hover: #b3001b;
    --border-color: #333333;
    --success-color: #4caf50;
    --warning-color: #ffc107;
    --critical-color: #f44336;
    --blue-highlight: #2196f3;
    --font-main: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
}

html, body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    margin: 0 !important;
    padding: 0 !important;
    min-height: 100dvh; /* dvh adapts to Android Chrome's URL bar height */
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;   /* Prevent horizontal bleed */
    overflow-y: visible;  /* Explicitly allow vertical scrolling on Android */
    overscroll-behavior: auto; /* Allow native rubber-band / momentum scrolling */
}

/* --- Main Layout --- */
.main-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    width: 100%;
}

/* --- Facebook Style App Bar (Tier 1) --- */
.app-bar {
    width: 100%;
    height: calc(60px + env(safe-area-inset-top, 0px));
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    padding-top: env(safe-area-inset-top, 0px); /* Clears iOS notch/Dynamic Island in standalone PWA (viewport-fit=cover + black-translucent) */
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    left: 0;
    z-index: 1100; /* Above summary (1000) but below modals (2000) */
    border-bottom: 1px solid #222;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

/* When embedded inside an iframe/portal shell, cancel duplicate safe-area insets */
html.is-embedded .app-bar,
body.is-embedded .app-bar {
    height: 60px !important;
    padding-top: 0 !important;
}

html.is-embedded .sticky-summary-wrapper,
body.is-embedded .sticky-summary-wrapper {
    top: 60px !important;
}

.brand-title {
    font-family: 'Arial Black', Gadget, sans-serif;
    font-size: 1.4rem;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    margin: 0;
}

.action-row {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #3A3B3C; /* Facebook Dark Gray Button */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
    flex-shrink: 0; /* Prevent squishing */
    color: white;         /* Prevent anchor link from going purple */
    text-decoration: none; /* Belt-and-suspenders for <a> wrappers */
}

.icon-btn:hover {
    background-color: #4E4F50;
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
    color: white; /* For currentColor-based SVGs */
}

/* Custom Create Button: Circle > Square > Plus */
.create-btn .inner-square {
    width: 24px;
    height: 24px;
    background-color: #58595A; /* Slightly lighter square */
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-btn .inner-square svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* Header icon buttons: white by default, red when tapped */
.icon-btn:active {
    background-color: #4E4F50;
}

.icon-btn:active svg {
    stroke: #E60023 !important;
    color: #E60023 !important;
    fill: #E60023 !important;
}

.create-btn:active .inner-square {
    background-color: #E60023 !important;
}


.global-match-badge {
    background: var(--accent-color);
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Notification Badge on Header */
.badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px; /* Pill shape */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg); /* Cutout effect matches header bg */
    padding: 0 4px;
}

.badge-count.hidden {
    display: none;
}

/* Hide the old top-modal if it still exists in CSS memory */
.top-modal {
    display: none;
}

/* --- Search & Inputs --- */
.search-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.input-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

input, select, textarea {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px;
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-main);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

input[type="date"],
input[type="time"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 48px;
    line-height: 1.2;
    padding: 12px;
}

input[type="date"]::-webkit-date-and-time-value,
input[type="time"]::-webkit-date-and-time-value {
    min-height: 20px;
    text-align: left;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: #333;
}

.submit-btn {
    background-color: var(--accent-color);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.submit-btn:hover {
    background-color: var(--accent-hover);
}

/* --- Reservations List --- */
.reservations-list {
    background-color: transparent; /* Remove white box */
    padding: 0 20px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto; /* Center content */
}

.reservations-list h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.5rem;
}

/* --- Day Summary Bar --- */
.sticky-summary-wrapper {
    position: sticky;
    top: calc(60px + env(safe-area-inset-top, 0px)); /* Aligns under the 60px header + iOS safe area */
    z-index: 1000; /* Lower than modals (2000) but higher than cards */
    background-color: var(--bg-color);
    padding: 10px 0;
    border-bottom: 1px solid #222;
    margin-top: -5px;
    width: 100%;
}

.day-summary-bar {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 15px;
    margin: 0 auto 10px auto;
    gap: 12px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
}

.summary-row:first-child {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.summary-item {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.summary-item span {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 900;
}

/* Date Navigation Styles */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    background: transparent;
    padding: 0 10px;
}

.date-navigation button {
    background-color: transparent;
    color: var(--accent-color); /* Red arrows */
    border: none;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.2s;
}

.date-navigation button:hover {
    transform: scale(1.2);
    background-color: transparent;
}

.date-display-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#current-date-display {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 1; /* Text below input */
}

/* Invisible Date Picker Overlay */
#date-picker {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* Invisible */
    cursor: pointer;
    z-index: 2; /* On top of text */
    padding: 0;
    margin: 0;
    border: none;
    -webkit-appearance: none; /* Remove default styling */
}

/* Remove internal calendar icon in WebKit browsers if visible */
#date-picker::-webkit-calendar-picker-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

/* Hide the clear button on desktop Chrome/Edge */
#date-picker::-webkit-clear-button {
    display: none;
    -webkit-appearance: none;
}

/* Hide the spinner on desktop Chrome/Edge */
#date-picker::-webkit-inner-spin-button {
    display: none;
    -webkit-appearance: none;
}

/* --- Reservation Cards --- */
#reservations-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reservation-card-wrapper {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    overflow: visible; /* Allow chat badge to float outside */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* Ensure absolute children are positioned relative to this card */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

/* Reservation Card Highlight Glow */
@keyframes cardHighlightGlow {
    0% { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); transform: translateY(0); }
    50% { box-shadow: 0 0 25px var(--accent-color); transform: translateY(-4px); }
    100% { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2); transform: translateY(0); }
}

.card-highlight-active {
    animation: cardHighlightGlow 3s ease-in-out;
    z-index: 100;
}

.reservation-card-wrapper:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
    border-color: #444;
}

/* Status Borders */
.reservation-card-wrapper.checked-in {
    border-left: 4px solid var(--success-color);
}

.reservation-card-wrapper.assigned {
    border-left: 4px solid var(--success-color);
}

.reservation-card-wrapper.warning {
    border-left: 4px solid var(--warning-color);
}

.reservation-card-wrapper.critical {
    border-left: 4px solid var(--critical-color);
}

/* Promoter Booked Card Theme (Rachel's Palm Beach) */
.reservation-card-wrapper.promoter-booked {
    border-color: rgba(255, 182, 193, 0.45);
}

.reservation-card-wrapper.promoter-booked:hover {
    border-color: rgba(255, 182, 193, 0.75);
    box-shadow: 0 6px 12px rgba(255, 182, 193, 0.15);
}

/* --- Returning Guest Badge --- */
.returning-guest-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    overflow: hidden;
    z-index: 10;
    pointer-events: none;
}

.returning-guest-badge::after {
    content: "RETURN";
    position: absolute;
    top: 10px;
    right: -18px;
    width: 80px;
    background: linear-gradient(135deg, var(--accent-color) 0%, #8B0000 100%);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 900;
    text-align: center;
    padding: 3px 0;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

.card-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    width: 100%;
    overflow: hidden; /* Contain children */
}

.left-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1; /* Take up available space */
    min-width: 0; /* Critical for ellipsis to work in flex */
    margin-right: 15px; /* Gap between text and badges */
}

.reservation-name, .left-section div {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Add ... to long addresses/names */
}

.right-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align to the right */
    justify-content: center;
    text-align: right;
    flex-shrink: 0; /* Never shrink the badges/time */
    min-width: 100px;
}

.package-badge-container {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: wrap; /* Wrap if absolutely necessary, though names are now short */
    max-width: 180px; /* Limit badge area width */
}

/* ... existing badge styles ... */

.modern-badge.couples {
    background: linear-gradient(135deg, rgba(20, 180, 150, 0.25), rgba(10, 150, 130, 0.5));
    color: #4df3c5;
    border-color: rgba(20, 180, 150, 0.35);
    box-shadow: 0 0 12px rgba(20, 180, 150, 0.2);
}

.modern-badge.standard {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border-color: rgba(255, 255, 255, 0.1);
}

.pickup-time {
    font-size: 1.6rem; /* Make it the hero */
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    white-space: nowrap;
}

.dropoff-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-transform: uppercase;
}

.order-number-blue {
    font-weight: 600;
    color: var(--blue-highlight);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

/* Expansion Row (Assigned Driver Info) */
.expansion-row {
    background-color: rgba(76, 175, 80, 0.1); /* Subtle green tint */
    padding: 10px 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--success-color);
    font-weight: 500;
}


/* --- Misc --- */
.pull-to-refresh-indicator {
    background-color: var(--bg-color);
    color: var(--text-secondary);
}

.spinner {
    border-left-color: var(--accent-color);
}

/* --- Notification Bar (System Alert) --- */
.notification-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--accent-color);
    color: white;
    padding: 16px;
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    cursor: pointer;
    transform: translateY(100%); /* Hidden by default */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.notification-bar.visible {
    transform: translateY(0);
}

.notification-bar:hover {
    background-color: var(--accent-hover);
}

.notification-icon {
    width: 20px;
    height: 20px;
    fill: white;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Bottom Sheet Messaging Window */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%; /* Full screen - feels like a new page */
    background-color: #1a1a1a;
    border-top-left-radius: 0; /* Remove radius for full screen */
    border-top-right-radius: 0;
    z-index: 2500;
    transform: translateY(100%); /* Start off-screen */
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.4s ease;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    visibility: hidden;
    pointer-events: none;
}

.bottom-sheet.open {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

#settings-sheet {
    z-index: 3000;
}
#settings-sheet.open {
    transform: translateY(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: #444;
    border-radius: 2px;
    margin: 8px auto 4px; /* Reduced bottom margin significantly */
}

.sheet-header {
    padding: 6px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sheet-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
}


.sheet-close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}


/* Date Navigation Styles (Tier 2) */
.date-navigation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    background-color: #252525;
    padding: 8px 16px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 600px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.date-navigation button {
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.date-navigation button:hover {
    color: var(--accent-color);
}
/* --- Reservation Cards (Tier 3) --- */
#reservations-container {
    display: flex;
    flex-direction: column;
    gap: 30px; /* Large gap for floating badges */
    width: 100%;
    max-width: 600px;
    padding-bottom: 80px;
}






/* 2025 Modern Pill Badges */
.modern-badge {
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.modern-badge.mosc {
    background: #000;
    color: #FFD700;
    border: 1px solid #FFD700;
    font-weight: 800;
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
}

.modern-badge.bottle {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(184, 134, 11, 0.45));
    color: #ffd700;
    border-color: rgba(212, 175, 55, 0.3);
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.15);
}

.modern-badge.guestlist {
    background: linear-gradient(135deg, rgba(230, 0, 35, 0.2), rgba(179, 0, 27, 0.4));
    color: #ff4d4d;
    border-color: rgba(230, 0, 35, 0.3);
    box-shadow: 0 0 12px rgba(230, 0, 35, 0.15);
}

.modern-badge.transport {
    background: rgba(255, 255, 255, 0.08);
    color: #888;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
}

.modern-badge.drinks {
    background: linear-gradient(135deg, rgba(0, 209, 255, 0.2), rgba(0, 150, 255, 0.4));
    color: #00D1FF;
    border-color: rgba(0, 209, 255, 0.3);
    box-shadow: 0 0 12px rgba(0, 209, 255, 0.15);
}

.modern-badge.bachelor {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.25), rgba(142, 68, 173, 0.5));
    color: #df9bff;
    border-color: rgba(155, 89, 182, 0.35);
    box-shadow: 0 0 12px rgba(155, 89, 182, 0.2);
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--accent-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}
/* --- Reservation Detail Action Buttons --- */
.header-action-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.header-action-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 0, 35, 0.3);
}

.header-action-btn:active {
    transform: translateY(0);
}


/* 2026 High-Signal Rebook Animations */
@keyframes breathing-glow {
    0% { box-shadow: 0 0 5px rgba(255, 193, 7, 0.2); transform: scale(1); }
    50% { box-shadow: 0 0 15px rgba(255, 193, 7, 0.5); transform: scale(1.02); }
    100% { box-shadow: 0 0 5px rgba(255, 193, 7, 0.2); transform: scale(1); }
}

@keyframes success-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.rebook-status-pill {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    cursor: pointer;
    width: 100%;
    margin-bottom: 12px;
}

.rebook-status-pill.pending {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
    animation: breathing-glow 2s infinite ease-in-out;
}

.rebook-status-pill.success {
    background: rgba(76, 175, 80, 0.1);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
    animation: success-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rebook-status-pill.offer {
    background: rgba(230, 0, 35, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(230, 0, 35, 0.2);
}

.rebook-status-pill.offer:hover {
    background: var(--accent-color);
    color: white;
    transform: scale(1.01);
}



/* --- Suppress In-App Notifications (Notification Bar & Card Chat Indicators) --- */
#notification-bar,
.notification-bar,
.notification-bar.visible,
#header-unread-count {
    display: none !important;
}

.card-chat-trigger,
.card-chat-trigger.has-unread,
.card-chat-badge {
    display: none !important;
}

