/* 🍣 Sushi Bar Mobile Unified - Clean Mobile Experience */

@media (max-width: 768px) {
    /* Reset conflicting styles */
    .drawer-container .drawer,
    .drawer-toggle,
    #compactModeToggle,
    .bottom-tabs,
    .tab-panel,
    .fab-container,
    .mobile-menu-panel {
        display: none !important;
    }
    
    /* Clean mobile layout */
    body {
        margin: 0;
        padding: 0;
        overflow: hidden;
        font-family: 'Helvetica Neue', 'Hiragino Sans', 'Noto Sans CJK JP', sans-serif;
        background: linear-gradient(135deg, #1a1a1a 0%, #2d1810 100%);
    }
    
    /* Full Screen Container */
    #sushiBar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        margin: 0;
        border: none;
        border-radius: 0;
        overflow: hidden;
        background: transparent;
    }
    
    /* Compact Header */
    #noren {
        padding: 12px 16px;
        font-size: 18px;
        font-weight: 700;
        background: linear-gradient(90deg, #000 0%, #1a0d08 50%, #000 100%);
        color: #FFD700;
        text-align: center;
        border-bottom: 1px solid #FFD700;
        flex-shrink: 0;
        position: relative;
        z-index: 10;
    }
    
    #noren::before {
        content: "🏮";
        position: absolute;
        left: 16px;
        font-size: 20px;
        pointer-events: none;
    }
    
    #noren::after {
        content: "🏮";
        position: absolute;
        right: 16px;
        font-size: 20px;
        pointer-events: none;
    }
    
    #venueInfo {
        display: none;
    }
    
    /* Hide desktop menu bar */
    #menuBar {
        display: none !important;
    }
    
    /* Minimized conveyor belt */
    #conveyorBelt {
        height: 50px;
        margin: 0;
        flex-shrink: 0;
        opacity: 0.9;
        position: relative;
        background: linear-gradient(to bottom, 
            rgba(139,115,85,0.9) 0%, 
            rgba(160,130,109,0.95) 45%,
            rgba(180,150,129,1) 50%,
            rgba(160,130,109,0.95) 55%,
            rgba(139,115,85,0.9) 100%
        ),
        linear-gradient(90deg, #8B7355 0%, #A0826D 50%, #8B7355 100%);
        border-top: 2px solid #654321;
        border-bottom: 2px solid #654321;
        overflow: hidden;
        box-shadow: 
            inset 0 2px 5px rgba(0,0,0,0.3),
            inset 0 -2px 5px rgba(0,0,0,0.3),
            0 2px 10px rgba(0,0,0,0.5);
    }
    
    /* Conveyor belt animation */
    #conveyorBelt::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-image: 
            repeating-linear-gradient(
                90deg,
                transparent,
                transparent 10px,
                rgba(0,0,0,0.2) 10px,
                rgba(0,0,0,0.2) 20px
            ),
            linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
        animation: conveyorMove 1.5s linear infinite;
        pointer-events: none;
    }
    
    @keyframes conveyorMove {
        from { transform: translateX(0); }
        to { transform: translateX(20px); }
    }
    
    /* Sushi plates on mobile - bigger size */
    .sushiPlate {
        position: absolute;
        top: 3px;
        width: 60px;
        height: 60px;
        animation: plateMove 25s linear infinite;
        filter: drop-shadow(0 4px 8px rgba(0,0,0,0.6));
        z-index: 5;
    }
    
    @keyframes plateMove {
        from {
            left: -70px;
            transform: scale(0.9) rotateY(0deg);
        }
        to {
            left: 100%;
            transform: scale(0.9) rotateY(360deg);
        }
    }
    
    .sushiPlate img {
        width: 45px;
        height: 45px;
        filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
        animation: plateBounce 2s ease-in-out infinite;
    }
    
    @keyframes plateBounce {
        0%, 100% { transform: translateY(0); }
        50% { transform: translateY(-4px); }
    }
    
    .sushiPlate .plateBase {
        position: absolute;
        bottom: -3px;
        left: 50%;
        transform: translateX(-50%);
        width: 50px;
        height: 16px;
        background: radial-gradient(ellipse at center, #F0F0F0 0%, #D0D0D0 70%, #B0B0B0 100%);
        border-radius: 50%;
        box-shadow: 
            0 3px 6px rgba(0,0,0,0.4),
            inset 0 -2px 3px rgba(0,0,0,0.2);
    }
    
    /* Chat Area - Main Focus */
    #chatArea {
        flex: 1;
        min-height: 0;
        padding: 16px 16px 60px 16px; /* Extra bottom padding for food tray */
        margin: 0;
        font-size: 15px;
        line-height: 1.4;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        background: transparent;
        border: none;
    }
    
    /* Enhanced Messages */
    .message {
        padding: 12px 16px;
        margin: 8px 0;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 12px;
        border: none;
        border-left: 3px solid #8B4513;
        font-size: 14px;
        line-height: 1.5;
        backdrop-filter: blur(10px);
        animation: messageSlideIn 0.3s ease-out;
    }
    
    @keyframes messageSlideIn {
        from {
            transform: translateY(20px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    .message.system {
        background: rgba(255, 215, 0, 0.15);
        border-left-color: #FFD700;
        font-style: normal;
        text-align: center;
    }
    
    .message.compact-order {
        background: rgba(255, 140, 0, 0.15);
        border-left-color: #FF8C00;
        font-weight: bold;
    }
    
    .message.compact-delivery {
        background: rgba(0, 255, 0, 0.15);
        border-left-color: #00FF00;
    }
    
    .username {
        font-weight: 600;
        color: #FFD700;
        margin-right: 8px;
    }
    
    .timestamp {
        float: right;
        color: #999;
        font-size: 11px;
        margin-top: 2px;
    }
    
    /* Input Area with Menu Button */
    #inputArea {
        padding: 12px 16px 16px;
        background: rgba(0, 0, 0, 0.95);
        border-top: 1px solid #333;
        flex-shrink: 0;
        backdrop-filter: blur(20px);
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    /* Menu access button */
    .mobile-menu-trigger {
        background: linear-gradient(135deg, #FFD700, #FFA500);
        color: #000;
        border: none;
        padding: 12px 20px;
        border-radius: 22px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        text-align: center;
        order: -1;
        transition: transform 0.2s;
        min-height: 44px;
        min-width: 120px;
    }
    
    .mobile-menu-trigger:active {
        transform: scale(0.95);
    }
    
    /* Input row */
    .input-row {
        display: flex;
        gap: 12px;
        align-items: center;
    }
    
    #messageInput {
        flex: 1;
        padding: 12px 16px;
        font-size: 16px;
        border-radius: 25px;
        border: 2px solid #333;
        background: #1a1a1a;
        color: #fff;
        outline: none;
        transition: border-color 0.3s;
    }
    
    #messageInput:focus {
        border-color: #FFD700;
    }
    
    #messageInput::placeholder {
        color: #666;
        font-style: italic;
    }
    
    #sendButton {
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 25px;
        background: linear-gradient(135deg, #FFD700, #FFA500);
        color: #000;
        border: none;
        font-weight: 600;
        min-width: 60px;
        transition: transform 0.2s;
    }
    
    #sendButton:active {
        transform: scale(0.95);
    }
    
    /* Quick action buttons */
    .quick-actions {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0 2px 4px;
    }
    
    .quick-action {
        flex: 0 0 auto;
        padding: 12px 16px;
        background: rgba(255, 215, 0, 0.1);
        border: 1px solid #333;
        border-radius: 20px;
        color: #FFD700;
        font-size: 14px;
        cursor: pointer;
        transition: all 0.3s;
        white-space: nowrap;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    
    .quick-action:active {
        background: #FFD700;
        color: #000;
    }
    
    /* Enhanced Wallet Display */
    #walletDisplay {
        position: fixed;
        top: 16px;
        right: 16px;
        background: rgba(0, 0, 0, 0.9);
        padding: 8px 12px;
        border: 1px solid #FFD700;
        border-radius: 20px;
        font-size: 14px;
        font-weight: 600;
        color: #FFD700;
        z-index: 100;
        backdrop-filter: blur(10px);
    }
    
    #walletDisplay img {
        width: 16px;
        height: 16px;
        margin-right: 4px;
        vertical-align: middle;
    }
    
    /* Menu Modal */
    .menu-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.98);
        z-index: 9999;
        overflow-y: auto;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    }
    
    .menu-modal.open {
        transform: translateY(0);
    }
    
    .menu-header {
        position: sticky;
        top: 0;
        background: linear-gradient(180deg, #000 0%, rgba(0,0,0,0.95) 100%);
        padding: 16px;
        border-bottom: 2px solid #FFD700;
        z-index: 10;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .menu-title {
        font-size: 20px;
        color: #FFD700;
        font-weight: 600;
        margin: 0;
    }
    
    .menu-close {
        background: none;
        border: 2px solid #FFD700;
        color: #FFD700;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        font-size: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .menu-close:active {
        background: #FFD700;
        color: #000;
    }
    
    /* Category Tabs */
    .category-tabs {
        display: flex;
        gap: 8px;
        padding: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: rgba(0, 0, 0, 0.5);
    }
    
    .category-tab {
        flex: 0 0 auto;
        padding: 8px 16px;
        background: #333;
        border: 2px solid transparent;
        border-radius: 20px;
        color: #999;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s;
        white-space: nowrap;
    }
    
    .category-tab.active {
        background: #FFD700;
        color: #000;
        border-color: #FFD700;
    }
    
    /* Menu Grid */
    .menu-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
        padding: 20px;
        position: relative;
        z-index: 1;
    }
    
    .menu-item-card {
        background: rgba(255, 255, 255, 0.08);
        border-radius: 12px;
        padding: 16px;
        text-align: center;
        cursor: pointer;
        transition: all 0.3s;
        border: 2px solid transparent;
        backdrop-filter: blur(10px);
        position: relative;
        z-index: 2;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .menu-item-card:active {
        transform: scale(0.95);
        border-color: #FFD700;
        background: rgba(255, 215, 0, 0.1);
    }
    
    .menu-item-image {
        width: 60px;
        height: 60px;
        margin: 0 auto 12px;
        border-radius: 8px;
        background: rgba(255, 215, 0, 0.1);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .menu-item-image img {
        width: 40px;
        height: 40px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    }
    
    .menu-item-name {
        font-size: 14px;
        font-weight: 600;
        color: #FFD700;
        margin-bottom: 4px;
    }
    
    .menu-item-price {
        font-size: 12px;
        color: #999;
    }
    
    /* Order Confirmation */
    .order-confirm-modal {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.8);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 10001; /* Higher than menu modal (9999) */
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
        backdrop-filter: blur(10px);
    }
    
    .order-confirm-modal.show {
        opacity: 1;
        visibility: visible;
    }
    
    .order-confirm-content {
        background: linear-gradient(135deg, #1a1a1a, #2d1810);
        border: 2px solid #FFD700;
        border-radius: 16px;
        padding: 24px;
        margin: 20px;
        text-align: center;
        max-width: 300px;
        transform: scale(0.8);
        transition: transform 0.3s;
    }
    
    .order-confirm-modal.show .order-confirm-content {
        transform: scale(1);
    }
    
    .order-confirm-icon {
        font-size: 48px;
        margin-bottom: 16px;
    }
    
    .order-confirm-text {
        font-size: 16px;
        color: #FFD700;
        font-weight: 600;
        margin-bottom: 8px;
    }
    
    .order-confirm-price {
        font-size: 14px;
        color: #999;
        margin-bottom: 20px;
    }
    
    .order-confirm-buttons {
        display: flex;
        gap: 12px;
    }
    
    .order-confirm-btn {
        flex: 1;
        padding: 12px;
        border: none;
        border-radius: 8px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s;
    }
    
    .order-confirm-btn.primary {
        background: #FFD700;
        color: #000;
    }
    
    .order-confirm-btn.secondary {
        background: #333;
        color: #fff;
    }
    
    .order-confirm-btn:active {
        transform: scale(0.95);
    }
    
    /* Success feedback */
    .order-success {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: #FFD700;
        padding: 16px 24px;
        border-radius: 12px;
        font-weight: 600;
        z-index: 3000;
        animation: successPop 0.6s ease-out;
    }
    
    @keyframes successPop {
        0% {
            transform: translate(-50%, -50%) scale(0);
            opacity: 0;
        }
        50% {
            transform: translate(-50%, -50%) scale(1.1);
            opacity: 1;
        }
        100% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }
    }
    
    /* Coin optimization */
    .coin {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    /* Food Tray - shows ordered food at bottom of chat */
    .food-tray {
        position: fixed;
        bottom: 120px; /* Above input area */
        left: 16px;
        right: 16px;
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid #FFD700;
        border-radius: 12px;
        padding: 8px 12px;
        display: none;
        flex-wrap: wrap;
        gap: 8px;
        z-index: 200;
        backdrop-filter: blur(20px);
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
        max-height: 100px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .food-tray.has-food {
        display: flex;
    }
    
    .food-tray-header {
        width: 100%;
        font-size: 12px;
        color: #FFD700;
        margin-bottom: 4px;
        text-align: center;
        font-weight: 600;
    }
    
    .food-item {
        position: relative;
        width: 50px;
        height: 50px;
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid #8B4513;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s;
        animation: foodArrive 0.5s ease-out;
    }
    
    @keyframes foodArrive {
        from {
            transform: translateY(30px) scale(0);
            opacity: 0;
        }
        to {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }
    
    .food-item:active {
        transform: scale(0.9);
        border-color: #FFD700;
    }
    
    .food-item img {
        width: 35px;
        height: 35px;
        filter: drop-shadow(1px 1px 3px rgba(0,0,0,0.5));
        animation: foodGlow 2s ease-in-out infinite alternate;
    }
    
    @keyframes foodGlow {
        from { filter: drop-shadow(1px 1px 3px rgba(0,0,0,0.5)); }
        to { filter: drop-shadow(1px 1px 8px rgba(255,215,0,0.6)); }
    }
    
    .food-item .food-name {
        position: absolute;
        bottom: -20px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 10px;
        color: #FFD700;
        white-space: nowrap;
        text-align: center;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    }
    
    /* Eating animation */
    .food-item.eating {
        animation: eatFood 0.8s ease-out forwards;
    }
    
    @keyframes eatFood {
        0% {
            transform: scale(1);
            opacity: 1;
        }
        50% {
            transform: scale(1.2) rotate(10deg);
            opacity: 0.7;
        }
        100% {
            transform: scale(0) rotate(45deg);
            opacity: 0;
        }
    }
    
    /* Delivery notification */
    .delivery-notification {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: rgba(0, 0, 0, 0.9);
        color: #FFD700;
        padding: 16px 24px;
        border-radius: 12px;
        font-weight: 600;
        z-index: 3000;
        animation: deliveryPop 0.6s ease-out;
        border: 2px solid #FFD700;
    }
    
    @keyframes deliveryPop {
        0% {
            transform: translate(-50%, -50%) scale(0);
            opacity: 0;
        }
        50% {
            transform: translate(-50%, -50%) scale(1.1);
            opacity: 1;
        }
        100% {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
        }
    }
    
    /* Loading states */
    .loading-shimmer {
        background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
        background-size: 200% 100%;
        animation: shimmer 1.5s infinite;
    }
    
    @keyframes shimmer {
        0% { background-position: -200% 0; }
        100% { background-position: 200% 0; }
    }
}

/* Landscape adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #noren {
        padding: 8px 16px;
        font-size: 16px;
    }
    
    #chatArea {
        padding: 12px 16px;
    }
    
    #conveyorBelt {
        height: 20px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        padding: 16px;
    }
}

/* iPhone-specific adjustments */
@media (max-width: 430px) {
    #chatArea {
        font-size: 13px;
        padding: 12px;
    }
    
    .message {
        padding: 10px 12px;
        margin: 6px 0;
        font-size: 13px;
    }
    
    .menu-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}
    /* Order Confirmation Toast */
    .order-toast {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) scale(0);
        background: rgba(0, 0, 0, 0.95);
        border: 2px solid #FFD700;
        border-radius: 16px;
        padding: 20px 30px;
        color: #fff;
        text-align: center;
        z-index: 10002; /* Highest z-index */
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
        backdrop-filter: blur(10px);
        box-shadow: 0 8px 32px rgba(255, 215, 0, 0.3);
    }
    
    .order-toast.show {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    
    .order-toast-icon {
        font-size: 48px;
        margin-bottom: 12px;
        animation: bounce 0.6s ease-out;
    }
    
    .order-toast-title {
        font-size: 18px;
        font-weight: 600;
        color: #FFD700;
        margin-bottom: 8px;
    }
    
    .order-toast-item {
        font-size: 16px;
        color: #fff;
        margin-bottom: 4px;
    }
    
    .order-toast-price {
        font-size: 14px;
        color: #999;
    }
    
    @keyframes bounce {
        0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
        40% { transform: translateY(-20px); }
        60% { transform: translateY(-10px); }
    }
