/* Modern UI Design with iOS Style and Warm Food Colors */

/* Color Variables */
:root {
    --primary: #E8612C; /* Warm orange */
    --primary-dark: #D55529; /* Darker warm orange */
    --primary-light: #FF8B5A; /* Lighter warm orange */
    --secondary: #F4A261; /* Warm yellow-orange */
    --accent: #E53E3E; /* Warm red */
    --green: #22C55E; /* Keep green */  
    --blue: #4A5568; /* Warm grey-blue */
    --background: #FEFCF8; /* Warm off-white */
    --text-primary: #2D2A26; /* Dark brown */
    --text-secondary: rgba(45, 42, 38, 0.7); /* Medium brown */
    --shadow-color: rgba(232, 97, 44, 0.2); /* Warm orange-tinted shadows */
    --glass-bg: rgba(247, 245, 243, 0.9); /* Cream with transparency */
    --glass-border: rgba(232, 97, 44, 0.1); /* Subtle warm orange border */
}

/* Glass morphism effects */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 25px 0 var(--shadow-color);
    border-radius: 16px;
}

/* Authentication Styles */
.auth-btn {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(232, 97, 44, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    margin-right: 8px;
}

.auth-btn:hover {
    background: rgba(232, 97, 44, 0.1);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.auth-btn i {
    color: var(--primary);
    font-size: 18px;
}

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-modal.active {
    opacity: 1;
}

.auth-dialog {
    background: white;
    border-radius: 20px;
    padding: 0;
    min-width: 320px;
    max-width: 400px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.auth-modal.active .auth-dialog {
    transform: scale(1) translateY(0);
}

.auth-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(232, 97, 44, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
}

.close-auth-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.close-auth-btn:hover {
    background: rgba(232, 97, 44, 0.1);
}

.close-auth-btn i {
    color: var(--text-secondary);
    font-size: 16px;
}

.auth-content {
    padding: 24px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 24px;
    background: rgba(232, 97, 44, 0.05);
    border-radius: 12px;
    padding: 4px;
}

.auth-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.auth-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(232, 97, 44, 0.15);
}

.auth-email-form {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(232, 97, 44, 0.2);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232, 97, 44, 0.1);
}

.auth-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-submit-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-secondary);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(232, 97, 44, 0.2);
}

.auth-divider span {
    padding: 0 16px;
    font-size: 14px;
}

.google-signin-btn {
    width: 100%;
    padding: 14px;
    background: white;
    color: var(--text-primary);
    border: 1px solid rgba(232, 97, 44, 0.2);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.google-signin-btn:hover {
    background: rgba(232, 97, 44, 0.05);
    border-color: var(--primary);
}

.google-signin-btn i {
    color: #DB4437;
    font-size: 18px;
}

.auth-profile {
    text-align: center;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: rgba(232, 97, 44, 0.05);
    border-radius: 12px;
}

.profile-avatar i {
    font-size: 48px;
    color: var(--primary);
}

.profile-details {
    flex: 1;
    text-align: left;
}

.profile-details h3 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-details p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.signout-btn {
    width: 100%;
    padding: 14px;
    background: rgba(229, 62, 62, 0.1);
    color: #E53E3E;
    border: 1px solid rgba(229, 62, 62, 0.2);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.signout-btn:hover {
    background: rgba(229, 62, 62, 0.15);
    border-color: #E53E3E;
}

.auth-error {
    background: rgba(229, 62, 62, 0.1);
    color: #E53E3E;
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
}

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

/* Floating Auth Button (mobile) */
.floating-auth-btn {
    position: fixed;
    top: calc(20px + var(--safe-area-top));
    right: 76px; /* Position to the left of the map button (44px width + 20px gap + 12px spacing) */
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    border: none;
    display: none; /* Hidden by default, shown on mobile */
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(232, 97, 44, 0.4);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.320, 1);
    z-index: 1000;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.floating-auth-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 25px rgba(232, 97, 44, 0.6);
}

.floating-auth-btn:active {
    transform: scale(0.9);
}

/* Show floating auth button on mobile */
@media (max-width: 767px) {
    .floating-auth-btn {
        display: flex !important;
    }
}

/* Hide floating auth button on desktop */
@media (min-width: 768px) {
    .floating-auth-btn {
        display: none !important;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .auth-dialog {
        min-width: 280px;
        margin: 20px;
    }
    
    .auth-header {
        padding: 20px 20px 12px;
    }
    
    .auth-content {
        padding: 20px;
    }
    
    .auth-header h2 {
        font-size: 20px;
    }
}

.glass-dark {
    background: rgba(255, 117, 24, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 10px 25px 0 rgba(255, 117, 24, 0.3);
    border-radius: 16px;
}

/* Background with warm gradient */
html, body {
    background: var(--background);
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    color: var(--text-primary);
    line-height: 1.5;
}

.container {
    max-width: 1600px;
    height: 100%;
    padding: 1rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

header {
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    min-height: 0; /* 防止flex子元素溢出 */
    height: calc(100% - 80px); /* 扣除header高度和边距 */
}

.chat-section,
.map-section {
    height: 100%;
}

/* Scrollbar styling */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: rgba(232, 97, 44, 0.1); /* Warm orange track */
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--primary); /* Warm orange thumb */
}

/* 确保聊天容器正确滚动 */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages-container {
    flex: 1;
    overflow-y: auto;
}

.chat-input-container {
    margin-top: auto;
    padding: 12px;
}

/* Chat interface - iOS style messaging */
.chat-messages-container .glass {
    border-radius: 18px 18px 18px 4px; /* AI messages */
    max-width: 85%;
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.chat-messages-container .glass-dark {
    border-radius: 18px 18px 4px 18px; /* User messages */
    max-width: 85%;
    padding: 12px 16px;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

/* Input field */
#user-input {
    border-radius: 24px;
    padding: 12px 20px;
    font-size: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    background-color: var(--background); /* Warm white */
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

#user-input:focus {
    box-shadow: 0 4px 15px var(--shadow-color);
    border-color: var(--primary);
}

#user-input::placeholder {
    color: var(--text-secondary);
}

/* Loading animation */
.loading-dots {
    display: inline-flex;
}

.loading-dots div {
    width: 8px;
    height: 8px;
    margin: 0 4px;
    border-radius: 50%;
    background-color: var(--primary);
    animation: dots 1.4s infinite ease-in-out both;
}

.loading-dots div:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots div:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Restaurant card styling - iOS inspired */
/* .restaurant-card {
    transition: all 0.3s ease;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    transform-origin: center right;
    background: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
} */

.restaurant-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px var(--shadow-color);
}

/* Restaurant card content styling */
.restaurant-card h3 {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

.restaurant-card p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 4px 0;
}

/* Restaurant card image */
.restaurant-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px 0 0 8px;
}

/* Swipe animation effects */
.restaurant-card.swiping {
    z-index: 10;
    pointer-events: none;
}

/* iOS-style buttons */
button {
    transition: all 0.2s ease;
    border-radius: 20px;
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    padding: 8px 16px;
    border: none;
    outline: none;
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
    filter: brightness(1.05);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Swipe button - iOS style */
.swipe-restaurant-btn {
    position: relative;
    overflow: hidden;
    background-color: var(--accent);
    color: white;
}

.swipe-restaurant-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: all 0.3s ease;
}

.swipe-restaurant-btn:hover::before {
    left: 100%;
}

/* View map button - iOS style */
.view-on-map-btn {
    background-color: var(--blue);
    color: white;
}

/* Like button - iOS style */
.select-restaurant-btn {
    background-color: var(--green);
    color: white;
}

/* Restaurant card being swiped */
@keyframes card-swipe-out {
    0% { transform: translateX(0) rotate(0); opacity: 1; }
    30% { transform: translateX(50px) rotate(5deg); opacity: 0.8; }
    100% { transform: translateX(150%) rotate(15deg); opacity: 0; }
}

/* Animation for cards shifting up after one is removed */
@keyframes card-shift-up {
    0% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0); }
}

/* Animation for fading in new content */
.animate-fade-in {
    animation: fade-in 0.5s ease forwards;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Map container - iOS style */
#map {
    height: 100%;
    width: 100%;
    border-radius: 16px;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Progress bar */
/* Progress bar - iOS style */
.progress-bar {
    height: 4px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    margin: 8px 0;
}

/* AI Avatar - Burger Logo */
.ai-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    overflow: hidden;
    background-color: var(--primary); /* Warm orange */
    box-shadow: 0 4px 8px var(--shadow-color);
    border: 2px solid var(--background); /* Warm white border */
}

.ai-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}


.progress-value {
    height: 100%;
    background-color: var(--primary);
    border-radius: 2px;
    animation: progress 2s infinite;
    width: 0%;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 70%; }
    100% { width: 100%; }
}

/* Suggestions and quick replies - iOS style */
.suggestion-chip {
    transition: all 0.2s ease;
    background-color: rgba(247, 245, 243, 0.95);
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.suggestion-chip:hover {
    background-color: var(--primary);
    color: var(--background);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* Quick reply styles */
#quick-reply-suggestions.quick-reply-container {
  display: flex;
  overflow-x: auto;
  flex-wrap: nowrap;            /* Prevent wrapping */
  gap: 6px;
  padding-bottom: 8px;
  margin-top: 15px;
  scrollbar-width: thin;        /* Optional: nice scroll on Firefox */
  -webkit-overflow-scrolling: touch; /* Smooth iOS scroll */
}

.quick-reply-bubble {
  flex: 0 0 auto;
  background-color: rgba(247, 245, 243, 0.95);
  border: 1px solid var(--primary);
  color: var(--primary);
  font-weight: 500;
  border-radius: 16px;
  padding: 6px 12px;
  font-size: 13px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.quick-reply-bubble:hover {
    background-color: var(--primary);
    color: var(--background);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.glass-light {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 16px 0 var(--shadow-color);
}

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

#send-btn {
    transition: all 0.2s ease;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary);
    color: white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#send-btn:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 8px var(--shadow-color);
}

#send-btn:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 117, 24, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(255, 117, 24, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 117, 24, 0); }
}

.pulse-animation {
    animation: pulse 1.5s infinite;
}


#interrupt-btn {
    transition: all 0.2s ease;
    position: absolute;
    right: 56px; 
    top: 50%;
    transform: translateY(-50%);
    height: 32px; 
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent);
    color: white;
    border-radius: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 0 12px;
    font-size: 14px;
    font-weight: 500;
}

#interrupt-btn.hidden {
    display: none !important;
}


#interrupt-btn:hover {
    background-color: #D93228; 
    box-shadow: 0 4px 8px rgba(255, 59, 48, 0.3);
}

#interrupt-btn:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

#user-input.with-stop-button {
    padding-right: 110px;
}

.pulse-animation {
    animation: pulse 1.5s infinite;
}

/* 响应式布局调整 */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
        height: auto;
    }

    .chat-section,
    .map-section {
        width: 100% !important;
    }

    .chat-section {
        margin-bottom: 1rem;
        height: 60vh;
    }

    .map-section {
        height: 300px;
    }

    .suggestion-chips {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .suggestion-chip {
        flex: 0 0 auto;
    }
}

/* 额外的触摸设备优化 */
@media (hover: none) {
    .custom-scrollbar::-webkit-scrollbar {
        width: 0px;
    }
}

/* Chat profile photo styling */
.chat-profile-photo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #FF7518;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(255, 117, 24, 0.3);
}

.chat-profile-photo i {
    color: white;
}

/* Text colors */
.text-primary {
    color: var(--primary);
}

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

.text-dark {
    color: var(--text-primary);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #FFB800;
}


/* Modal animation styles */
#restaurant-detail-modal {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#restaurant-detail-modal.transition-opacity {
    opacity: 1;
}

/* Image gallery styles */
#image-gallery {
    position: relative;
}

.gallery-nav {
    transition: background-color 0.2s;
}

.gallery-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal content scrollbar styles */
.modal-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
}

.modal-content::-webkit-scrollbar-thumb {
    background-color: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

/* Animation for modal entrance */
@keyframes modalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-content {
    animation: modalFadeIn 0.3s ease-out forwards;
}

/* Menu section styles */
.menu-category h4 {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

.menu-item {
    transition: background-color 0.2s;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

.menu-item:hover {
    background-color: #f9fafb;
}

/* Review item styles */
.review-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Card hover effect for modal trigger */
.restaurant-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.restaurant-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Buttons within modal */
.modal-content button {
    transition: all 0.2s ease;
}

.modal-content button:hover {
    transform: translateY(-1px);
}

.modal-content button:active {
    transform: translateY(0);
}

/* Loading spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: rgba(59, 130, 246, 1);
    animation: spinner 1s linear infinite;
    margin: 0 auto;
}

@keyframes spinner {
    to {transform: rotate(360deg);}
}

/* Viewed restaurant card indicator */
.restaurant-card.viewed::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #3B82F6;
    z-index: 10;
}

/* Modal close button hover effect */
#modal-close-btn {
    transition: transform 0.2s ease;
}

#modal-close-btn:hover {
    transform: rotate(90deg);
}

/* Smooth image transition in gallery */
#image-gallery img {
    transition: opacity 0.3s ease;
}

.modal-content {
    background: white;
    rounded-lg: true;
    width: 70%; 
    max-width: 800px; 
    height: 85%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalFadeIn 0.3s ease-out forwards;
}

.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 8px;
    padding: 16px;
    height: 100%;
    background-color: #f8f8f8;
    overflow-y: auto;
}

.gallery-thumb {
    height: 120px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease-in-out;
}
.gallery-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay for current active image */
.gallery-thumb.active::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid var(--primary);
    border-radius: 8px;
}

/* Full screen image viewer */
.image-viewer-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-viewer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.image-viewer-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-viewer-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.image-viewer-nav:hover {
    background: rgba(255, 255, 255, 0.4);
}

.image-viewer-prev {
    left: 20px;
}

.image-viewer-next {
    right: 20px;
}

@media (max-width: 768px) {
    .image-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .modal-content {
        width: 95%;
        height: 90%;
    }
    
    .gallery-thumb {
        height: 100px;
    }
}

@media (max-width: 320px) {
    .image-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.travel-info-container {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1F2937;
    max-width: 200px;
    padding: 12px; 
}

.restaurant-title {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    word-wrap: break-word;
    line-height: 1.3;
}

.section-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px; /* Reduced from 12px */
}

.travel-modes-container {
    display: flex;
    flex-direction: column;
    gap: 6px; /* Reduced from 10px */
}

.travel-mode-item {
    display: flex;
    align-items: center;
    padding: 8px 10px; /* Reduced padding to be more compact */
    border-radius: 8px;
    background: #F9FAFB;
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    margin-bottom: 6px; /* Added for spacing between items */
}

.travel-mode-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.travel-mode-item.unavailable {
    opacity: 0.6;
    cursor: not-allowed;
}

.mode-icon {
    flex: 0 0 32px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-details {
    flex: 1;
    margin-left: 8px;
}

.mode-name {
    font-weight: 500;
    font-size: 13px; /* Reduced from 14px */
}

.mode-time {
    font-size: 12px; /* Reduced from 13px */
    color: #6B7280;
}

.travel-actions {
    display: flex;
    gap: 6px;
    margin-top: 12px;
}

.action-button {
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border: none;
    transition: background-color 0.2s;
    flex: 1;
}

.primary-button {
    background: #4F46E5;
    color: white;
}

.primary-button:hover {
    background: #4338CA;
}

.secondary-button {
    background: #F3F4F6;
    color: #4B5563;
}

.secondary-button:hover {
    background: #E5E7EB;
}


@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.info-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    width: 100%;
    text-align: center;
}

.info-loading-container p {
    font-size: 13px;
    color: #6B7280;
    margin: 8px 0 0 0;
}

.info-loading-spinner {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #F3F4F6;
    border-top: 2px solid #4F46E5;
    animation: spin 1s linear infinite;
}

.restaurant-reason-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    padding: 12px;
}

.restaurant-card:hover .restaurant-reason-overlay {
    opacity: 1;
}

.reason-content {
    text-align: center;
    max-width: 100%;
}

.reason-content p {
    font-size: 13px;
    color: white;
    font-style: italic;
    line-height: 1.4;
    margin: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.restaurant-card-slider {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  gap: 16px;
  padding: 10px 0;
  max-height: 30dvh;
  margin-bottom: 5px;
  border-radius: 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-light) transparent;
}

@media (min-width: 768px) {
    .restaurant-card-slider {
        display: flex;
        flex-direction: row;
        align-items: flex-end;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        gap: 16px;
        padding: 10px;
        margin-bottom: 5px;
        border-radius: 8px;
        scrollbar-width: none;
        justify-content: flex-start;
        scroll-behavior: smooth;
        scrollbar-width: thin;
        scrollbar-color: var(--primary-light) transparent;
    }
}

.restaurant-card {
  /* Mobile: horizontal layout with square image on left */
  width: calc(100vw - 32px);
  max-width: calc(100vw - 32px);
  margin: 0 auto;
  height: 120px;
  min-height: 120px;
  scroll-snap-align: start;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  font-family: sans-serif;
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: flex-start;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.restaurant-image-wrapper {
  position: relative;
  /* Mobile: square image on left */
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.restaurant-image-wrapper img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 12px 0 0 12px;
}

@media (min-width: 768px) {
    .restaurant-card {
        flex: 0 0 240px;
        width: 240px;
        min-width: 240px; 
        max-width: 240px;
        height: 100%; 
        min-height: 270px;
        background: #fff;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
        scroll-snap-align: start;
        font-family: sans-serif;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: space-between;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        will-change: transform;
    }

    /* Desktop: restore original image layout */
    .restaurant-image-wrapper {
        width: 100%;
        height: 120px;
        flex-shrink: unset;
    }

    .restaurant-image-wrapper img {
        width: 100%;
        height: 120px;
        border-radius: 12px 12px 0 0;
    }

    /* Desktop: restore original content padding */
    .restaurant-card-content {
        padding: 10px 12px;
        min-width: unset;
        position: static;
    }

    /* Desktop: restore original text sizes */
    .restaurant-card-title {
        font-size: 16px;
        margin-bottom: 4px;
        line-height: normal;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .restaurant-card-rating {
        font-size: 12px;
        margin-bottom: 4px;
        line-height: normal;
    }

    .restaurant-card-description {
        font-size: 12px;
        line-height: normal;
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    .restaurant-card-status {
        font-size: 12px;
        margin-top: 4px;
        line-height: normal;
    }

    /* Desktop: restore original action area */
    .restaurant-card-content .flex {
        margin-top: 8px;
        gap: 8px;
    }

    .restaurant-card-content .flex .text-xs {
        font-size: 12px;
        padding: 4px 8px;
    }

    .restaurant-card-content button {
        font-size: 12px;
        padding: 4px 8px;
        min-width: auto;
    }

    .restaurant-card-content button i {
        font-size: 12px;
        margin-right: 4px;
    }

    /* Desktop: restore hours display */
    .restaurant-card-content .initial-hours-container {
        margin-top: 4px;
    }

    .restaurant-card-content .initial-hours-container span {
        font-size: 12px;
        padding: 2px 8px;
    }

    .restaurant-card-content .initial-hours-container i {
        font-size: 12px;
        margin-right: 4px;
    }

    /* Desktop: show all content */
    .restaurant-card-content .restaurant-reason-overlay {
        display: block;
    }
    
    .restaurant-reason-overlay {
        padding: 8px;
    }
    
    .reason-content p {
        font-size: 11px;
        line-height: 1.3;
    }

    /* Desktop: restore view details text */
    .view-details-text {
        font-size: 12px;
        padding: 4px 8px;
        bottom: 8px;
        left: 8px;
        z-index: 20;
    }
}

.restaurant-toggle-button {
    background: var(--warm-orange);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.restaurant-toggle-button:active {
    transform: scale(0.98);
    background: #D55529;
}


.view-details-text {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #FF7518;;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 20;
}

.restaurant-card:hover .view-details-text {
  opacity: 1;
}

.restaurant-card-content {
  /* Mobile: adjust for horizontal layout */
  padding: 6px 8px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0; /* Allow text to truncate */
  position: relative;
  gap: 2px;
}

.restaurant-card-title {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 1px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.restaurant-card-rating {
  font-size: 11px;
  color: #555;
  margin-bottom: 1px;
  line-height: 1;
}

.restaurant-card-description {
  font-size: 11px;
  color: #777;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}

.restaurant-card-status {
  font-size: 10px;
  color: #4CAF50;
  margin-top: 1px;
  line-height: 1;
}

/* Mobile: compact bottom action area */
.restaurant-card-content .flex {
  margin-top: 2px;
  gap: 2px;
  align-items: center;
}

.restaurant-card-content .flex .text-xs {
  font-size: 9px;
  padding: 1px 4px;
  line-height: 1;
  white-space: nowrap;
}

.restaurant-card-content button {
  font-size: 9px;
  padding: 1px 4px;
  min-width: auto;
  line-height: 1;
  white-space: nowrap;
}

.restaurant-card-content button i {
  font-size: 8px;
  margin-right: 1px;
}

/* Mobile: compact hours/status display */
.restaurant-card-content .initial-hours-container {
  margin-top: 1px;
  align-items: center;
  line-height: 1;
}

.restaurant-card-content .initial-hours-container span {
  font-size: 8px;
  padding: 1px 3px;
  white-space: nowrap;
  line-height: 1;
}

.restaurant-card-content .initial-hours-container i {
  font-size: 7px;
  margin-right: 1px;
}

/* Mobile: hide less critical elements to save space */
.restaurant-card-content .restaurant-reason-overlay {
  display: none;
}

/* Mobile: optimize view details text */
.view-details-text {
  font-size: 8px;
  padding: 2px 4px;
  bottom: 4px;
  left: 4px;
  z-index: 20;
}

.restaurant-card-close-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 30;
    opacity: 0.9;
    transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
    color: var(--accent);
  }

  .card-highlight {
    animation: highlight-pulse 1.5s ease;
  }
  
  @keyframes highlight-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 117, 24, 0.7); } 
    50% { box-shadow: 0 0 0 8px rgba(255, 117, 24, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 117, 24, 0); }
  }

  .restaurant-card-close-btn:hover {
    background-color: var(--accent);
    color: white;
    transform: scale(1.1);
  }
  
  .card-removing {
    transform: scale(0.8);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }

  .card-highlight {
    animation: highlight-pulse 1.5s ease;
  }

  /* Star Rating Popup */
.rating-popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 20px;
    z-index: 1000;
    max-width: 300px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0, 0.21);
  }
  
  .rating-popup.show {
    transform: translateY(0);
    opacity: 1;
  }
  
  .rating-popup.hide {
    transform: translateY(100px);
    opacity: 0;
  }
  
  .rating-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
  }
  
  .rating-popup-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.4;
  }
  
  .rating-popup-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
  }
  
  .rating-popup-close:hover {
    color: #606673;
  }
  
  .rating-rating-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }
  
  .star-rating {
    display: flex;
    gap: 4px;
  }
  
  .star {
    font-size: 24px;
    color: #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
  }
  
  .star:hover,
  .star.active {
    color: #fbbf24;
    transform: scale(1.1);
  }
  
  .star-rating-text {
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
  }
  
  .rating-submit-btn {
    background: #ff7518;
    color: white;
    border: none;
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
  }
  
  .rating-submit-btn:hover {
    background: #e65a18;
    transform: translateY(-1px);
  }
  
  .rating-submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
  }
  
  .rating-feedback-input {
    margin-bottom: 12px;
  }
  
  .rating-textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    resize: vertical;
    min-height: 60px;
    font-family: inherit;
    transition: border-color 0.2s;
  }
  
  .rating-textarea:focus {
    outline: none;
    border-color: #ff7518;
    box-shadow: 0 0 0 3px rgba(255, 117, 24, 0.1);
  }
  
  .rating-char-count {
    font-size: 10px;
    color: #6b7280;
    text-align: right;
    margin-top: 4px;
  }
  
  .rating-feedback {
    font-size: 11px;
    color: #6b7280;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
  }
  
  /* Mobile responsive adjustments */
  @media (max-width: 768px) {
    .rating-popup {
      bottom: 80px;
      right: 16px;
      left: 16px;
      max-width: none;
    }
  }

  /* Smaller mobile screens - even more compact */
  @media (max-width: 320px) {
    .restaurant-card {
      height: 110px;
      min-height: 110px;
    }

    .restaurant-image-wrapper {
      width: 110px;
      height: 110px;
    }

    .restaurant-image-wrapper img {
      width: 110px;
      height: 110px;
    }

    .restaurant-card-content {
      padding: 6px 10px;
    }

    .restaurant-card-title {
      font-size: 14px;
    }

    .restaurant-card-rating,
    .restaurant-card-description {
      font-size: 11px;
    }
  }