/* ────────────────────────────────────────────────────────
   Foodfy AI — Hero-integrated Conversational Interface
   ──────────────────────────────────────────────────────── */

/* ── Location Gate Overlay ── */
.foodfy-location-gate {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: foodfyFadeIn 0.4s ease forwards;
}

.foodfy-location-gate-card {
    position: relative;
    background: #fff;
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

.foodfy-location-gate-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f0f0f0;
    color: #666;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.foodfy-location-gate-close:hover {
    background: #e0e0e0;
    color: #333;
}

.foodfy-location-gate-skip {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    border: none;
    background: transparent;
    color: #888;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s;
}

.foodfy-location-gate-skip:hover {
    color: #333;
}

.foodfy-location-gate-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.foodfy-location-gate-icon svg {
    width: 32px;
    height: 32px;
    fill: #fff;
}

.foodfy-location-gate-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 10px;
}

.foodfy-location-gate-card p {
    font-size: 15px;
    color: #666;
    margin: 0 0 28px;
    line-height: 1.5;
}

.foodfy-location-gate-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 16px rgba(255, 107, 53, 0.35);
}

.foodfy-location-gate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(255, 107, 53, 0.45);
}

.foodfy-location-gate-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.foodfy-location-gate-btn .spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: foodfySpin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes foodfySpin { to { transform: rotate(360deg); } }
@keyframes foodfyFadeIn { to { opacity: 1; } }

/* ── AI Panel (in hero) ── */
.foodfy-ai-panel {
    max-width: 680px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.foodfy-ai-panel:focus-within {
    box-shadow: 0 8px 40px rgba(255, 107, 53, 0.12), 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Conversation area (hidden by default, shown when messages exist) */
.foodfy-ai-conversation {
    max-height: 0;
    overflow-y: auto;
    padding: 0 20px;
    transition: max-height 0.4s ease, padding 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

.foodfy-ai-conversation.has-messages {
    max-height: 340px;
    padding: 20px 20px 12px;
}

.foodfy-ai-conversation::-webkit-scrollbar { width: 3px; }
.foodfy-ai-conversation::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* Messages */
.foodfy-ai-msg {
    max-width: 88%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
    animation: foodfyMsgIn 0.25s ease;
}

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

.foodfy-ai-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    border-bottom-right-radius: 6px;
}

.foodfy-ai-msg-ai {
    align-self: flex-start;
    background: #f2f3f7;
    color: #1a1a2e;
    border-bottom-left-radius: 6px;
}

.foodfy-ai-msg-ai p { margin: 0 0 6px; }
.foodfy-ai-msg-ai p:last-child { margin-bottom: 0; }
.foodfy-ai-msg-ai strong { font-weight: 600; color: #FF6B35; }

/* Typing indicator */
.foodfy-ai-typing {
    align-self: flex-start;
    background: #f2f3f7;
    border-radius: 16px;
    border-bottom-left-radius: 6px;
    padding: 12px 20px;
    display: flex;
    gap: 5px;
    animation: foodfyMsgIn 0.2s ease;
}

.foodfy-ai-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #aab;
    animation: foodfyDot 1.2s infinite;
}

.foodfy-ai-typing span:nth-child(2) { animation-delay: 0.15s; }
.foodfy-ai-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes foodfyDot {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Input row */
.foodfy-ai-input-row {
    padding: 14px 16px;
}

.foodfy-ai-input-wrap {
    display: flex;
    align-items: center;
    background: #f7f8fa;
    border-radius: 14px;
    border: 1.5px solid #ebedf2;
    transition: border-color 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.foodfy-ai-input-wrap:focus-within {
    border-color: #FF6B35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.foodfy-ai-input-icon {
    padding: 0 4px 0 14px;
    color: #aab;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.foodfy-ai-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 8px 14px 8px;
    font-size: 15px;
    color: #1a1a2e;
    outline: none;
}

.foodfy-ai-input::placeholder {
    color: #9a9bb0;
}

.foodfy-ai-voice {
    width: 40px;
    height: 40px;
    margin: 4px 0;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: #9a9bb0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.foodfy-ai-voice:hover { color: #FF6B35; background: rgba(255, 107, 53, 0.06); }

.foodfy-ai-voice.listening {
    color: #fff;
    background: #e53935;
    animation: foodfyPulse 1.2s infinite;
}

.foodfy-ai-voice.listening svg { stroke: #fff; }

@keyframes foodfyPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(229, 57, 53, 0); }
}

.foodfy-ai-send {
    width: 44px;
    height: 44px;
    margin: 4px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, #FF6B35, #F7931E);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, opacity 0.15s;
    flex-shrink: 0;
}

.foodfy-ai-send:hover { transform: scale(1.05); }
.foodfy-ai-send:active { transform: scale(0.96); }
.foodfy-ai-send:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.foodfy-ai-send svg { stroke: #fff; }

/* Suggestion chips */
.foodfy-ai-chips {
    padding: 0 16px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.foodfy-ai-chip {
    background: #fff;
    color: #1a1a2e;
    border: 1px solid #ebedf2;
    border-radius: 100px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.foodfy-ai-chip:hover {
    background: #FF6B35;
    color: #fff;
    border-color: #FF6B35;
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(255, 107, 53, 0.2);
}

.foodfy-ai-chip .chip-emoji {
    font-size: 15px;
}

/* Context badges (location + time, below the panel) */
.foodfy-ai-context {
    max-width: 680px;
    margin: 14px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.foodfy-ai-location-badge,
.foodfy-ai-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 100px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.foodfy-ai-location-badge i,
.foodfy-ai-time-badge i {
    color: #F7931E;
}

/* ── Restaurant Cards (in conversation) ── */
.foodfy-ai-cards {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: none;
    animation: foodfyMsgIn 0.3s ease;
}

.foodfy-ai-cards::-webkit-scrollbar { display: none; }

.foodfy-ai-restaurant-card {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #ebedf2;
    border-radius: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: #1a1a2e;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 180px;
    max-width: 240px;
}

.foodfy-ai-restaurant-card:hover {
    border-color: #FF6B35;
    box-shadow: 0 2px 12px rgba(255, 107, 53, 0.12);
    text-decoration: none;
    color: #1a1a2e;
}

.card-logo-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #f7f8fa;
}

.card-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.card-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-dist {
    font-size: 11px;
    color: #888;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .foodfy-ai-panel {
        border-radius: 16px;
        margin: 0 -8px;
    }

    .foodfy-ai-conversation.has-messages {
        max-height: 260px;
    }

    .foodfy-ai-input {
        font-size: 14px;
        padding: 12px 6px;
    }

    .foodfy-ai-chip {
        font-size: 12px;
        padding: 6px 14px;
    }

    .foodfy-location-gate-card {
        padding: 36px 28px;
    }
}
