/* Consumer App Modern Styles */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;500;700;900&display=swap');

:root {
    --primary-color: #0f172a;
    --accent-color: #3b82f6;
    --glass-bg: rgba(15, 23, 42, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--primary-color);
    color: var(--text-primary);
}

#map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

body:not(.light-theme) .leaflet-tile-pane {
    filter: brightness(1.5) contrast(0.9) saturate(1.2);
}

/* Glassmorphic Overlay UI */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Let clicks pass through to map */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 1.5rem;
}

.header {
    pointer-events: auto;
    text-align: center;
    animation: fadeInDown 1s ease forwards;
}

.brand-title {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: -2px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-primary);
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
    opacity: 0.9;
}

.bottom-panel {
    pointer-events: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    animation: fadeInUp 1s ease forwards;
    transform: translateY(20px);
    opacity: 0;
    animation-delay: 1.5s; /* Show after zoom animation */
}

.status-text {
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.sub-status {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Leaflet Customizations */
.leaflet-container {
    background: #0a0a0a !important; /* Dark fallback */
}

/* Custom Marker Styling */
.custom-marker {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    background: var(--accent-color);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -15px 0 0 -15px;
    box-shadow: 0 0 15px var(--accent-color);
    animation: pulse 2s infinite;
}

.marker-pin::after {
    content: '';
    width: 14px;
    height: 14px;
    margin: 8px 0 0 8px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Menu Slide-in Panel */
.menu-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 400px;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 20px 0 50px rgba(0,0,0,0.5);
}

.menu-panel.open {
    transform: translateX(0);
}

.menu-header {
    padding: 2rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.menu-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.close-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Menu Card */
.menu-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    cursor: pointer;
    transition: background 0.2s;
}

.menu-card:active {
    background: rgba(255,255,255,0.1);
}

.menu-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: #334155;
    object-fit: cover;
}

.menu-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.menu-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.menu-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-price {
    font-weight: 700;
    color: var(--accent-color);
}


/* Dynamic Variables & Light Theme */
:root {
    --bg-color: #000;
    --text-color: #fff;
    --text-secondary: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-bg-active: rgba(255, 255, 255, 0.1);
    --accent-color: #38bdf8;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --button-bg: rgba(255, 255, 255, 0.1);
}

body.light-theme {
    --bg-color: #f1f5f9;
    --text-color: #0f172a;
    --text-secondary: #475569;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --card-bg: rgba(0, 0, 0, 0.03);
    --card-bg-active: rgba(0, 0, 0, 0.08);
    --accent-color: #0284c7;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --button-bg: rgba(0, 0, 0, 0.05);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.menu-panel {
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    box-shadow: 20px 0 50px var(--shadow-color);
}

.menu-header {
    border-bottom: 1px solid var(--glass-border);
}

.close-btn {
    background: var(--button-bg);
    color: var(--text-color);
}

.menu-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
}

.menu-card:active {
    background: var(--card-bg-active);
}

.menu-desc {
    color: var(--text-secondary);
}

.menu-price {
    color: var(--accent-color);
}

/* Accordion Categories */
.menu-category {
    margin-bottom: 1rem;
}

.menu-category summary {
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--glass-border);
    margin-bottom: 1rem;
    list-style: none; /* Hide default arrow */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-category summary::-webkit-details-marker {
    display: none;
}

.menu-category summary::after {
    content: '+';
    font-size: 1.5rem;
    color: var(--accent-color);
}

.menu-category[open] summary::after {
    content: '-';
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px var(--shadow-color);
    backdrop-filter: blur(10px);
}

/* Cart Icon */
.cart-icon-container {
    position: absolute;
    top: 20px;
    right: 80px; /* Left of the theme toggle */
    height: 44px;
    padding: 0 15px;
    border-radius: 22px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px var(--shadow-color);
    backdrop-filter: blur(10px);
}

.cart-total {
    font-size: 1rem;
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px var(--shadow-color);
}

/* Item Detail Overlay */
.item-overlay-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.item-overlay-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.item-detail-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    overflow: hidden;
    box-shadow: 0 20px 40px var(--shadow-color);
    transform: translateY(20px);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
}

.item-overlay-backdrop.open .item-detail-card {
    transform: translateY(0);
}

.item-detail-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #333;
}

.item-detail-content {
    padding: 20px;
}

.item-detail-name {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.item-detail-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
}

.item-detail-price {
    font-size: 1.25rem;
    color: var(--accent-color);
    font-weight: bold;
    margin-bottom: 20px;
}

.qty-selector {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 5px;
    margin-bottom: 20px;
}

.qty-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: 4px;
}

.qty-btn:active {
    background: var(--card-bg-active);
}

.qty-val {
    font-size: 1.2rem;
    font-weight: bold;
}

.purchase-btn {
    width: 100%;
    background: var(--accent-color);
    color: #fff;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

.purchase-btn:active {
    opacity: 0.8;
}

.item-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

body.light-theme .brand-title {
    background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
    text-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Checkout Panel */
.checkout-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 90%;
    max-width: 450px;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    z-index: 25;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -20px 0 50px var(--shadow-color);
}
.checkout-panel.open {
    transform: translateX(0);
}
.checkout-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.order-type-section {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
}
.segmented-control {
    display: flex;
    gap: 0.5rem;
    background: rgba(0,0,0,0.1);
    padding: 0.3rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}
.segmented-control input[type="radio"] {
    display: none;
}
.segmented-control label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.segmented-control input[type="radio"]:checked + label {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.glass-dropdown {
    width: 100%;
    padding: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-color);
    font-size: 1rem;
    margin-top: 0.5rem;
}
.checkout-summary {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem;
}
.summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.summary-line.total {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--glass-border);
}
.checkout-submit-btn {
    margin-top: auto;
}

/* Transaction Mode */
.transaction-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 50;
    display: flex;
    flex-direction: column;
}
.transaction-mode.hidden {
    display: none;
}
.transaction-header {
    padding: 2rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.transaction-status {
    padding: 0.5rem 1rem;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    font-weight: 600;
}
.transaction-chat {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.chat-bubble {
    max-width: 75%;
    padding: 1rem;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 4px 15px var(--shadow-color);
}
.vendor-msg {
    align-self: flex-start;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}
.customer-msg {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.msg-sender {
    font-size: 0.8rem;
    opacity: 0.7;
    margin-bottom: 0.25rem;
}
.msg-text {
    font-size: 1rem;
}
.msg-time {
    font-size: 0.75rem;
    opacity: 0.5;
    margin-top: 0.5rem;
    text-align: right;
}
.ready-bubble {
    background: var(--accent-color);
    color: white;
    cursor: pointer;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}
.transaction-input {
    padding: 1.5rem;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 1rem;
}
.transaction-input input {
    flex: 1;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(0,0,0,0.2);
    color: var(--text-color);
    outline: none;
}
.transaction-input button {
    padding: 0 1.5rem;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Receive Page */
.receive-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 60;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.5s;
}
.receive-page.hidden {
    display: none;
}
.receive-code {
    font-size: 15rem;
    font-weight: 900;
    letter-spacing: -5px;
    line-height: 1;
    text-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.receive-back-btn {
    position: absolute;
    top: 2rem;
    left: 2rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.2);
    color: inherit;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
}
