/* Ubiken - Dark Mode Premium Styles */
:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #141416;
    --bg-tertiary: #1c1c1f;
    --surface: #242428;
    --surface-hover: #2a2a2f;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #22c55e;
    --accent-dim: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --font-sans: 'Inter', -apple-system, sans-serif;
}

/* Reset completo */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    max-width: 100%;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    height: 100%;
    max-width: 100%;
    overflow: hidden;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
}

/* App container - viewport limitado */
.app {
    height: 100%;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    flex-shrink: 0;
    width: 100%;
    max-width: 800px;
    align-self: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 18px;
}

.logo-icon {
    font-size: 20px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.status-indicator.active .status-dot {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.status-indicator.error .status-dot {
    background: var(--danger);
}

/* Search Container */
.search-container {
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

/* Glassmorphism Search Bar */
.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
}

.chat-input-area {
    display: flex;
    align-items: center;
    padding: 8px 8px 8px 18px;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 100%;
}

.chat-input-area:focus-within {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.chat-input-area input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    min-width: 0;
    width: 100%;
    padding: 8px 0;
}

.chat-input-area input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.5);
    background: linear-gradient(135deg, #2ae06c 0%, #169346 100%);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn svg {
    width: 18px;
    height: 18px;
    color: #000;
    transform: translate(1px, 0);
}

.mic-btn {
    background: var(--surface);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.mic-btn svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.mic-btn:active {
    transform: scale(0.95);
    background: var(--surface-hover);
}

/* Location Badge - tamaño fijo */
.location-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    font-size: 12px;
    color: var(--text-secondary);
    width: fit-content;
    position: relative;
}

.location-badge.active {
    color: var(--accent);
}

/* Pulse ring - tamaño fijo de 20px */
.pulse-ring {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: transparent;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    z-index: 1;
}

.location-badge.active .pulse-ring::before {
    background: var(--accent);
}

.location-badge.active .pulse-ring {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }

    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

/* Results Container */
.results-container {
    flex: 1;
    padding: 0 16px;
    overflow-y: auto;
    max-width: 100%;
}

/* Skeleton Loading */
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.skeleton-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
    overflow: hidden;
}

.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    border-radius: 4px;
    animation: shimmer 1.5s infinite;
    max-width: 100%;
}

.skeleton-line.wide {
    width: 70%;
}

.skeleton-line.medium {
    width: 50%;
}

.skeleton-line.narrow {
    width: 35%;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

/* Result Cards */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
}

.result-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all 0.2s;
    border: 1px solid transparent;
    max-width: 100%;
    overflow: hidden;
}

.result-card:active {
    background: var(--surface);
    transform: scale(0.98);
}

.result-card.best {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--accent-dim) 100%);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.result-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
}

.result-category {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.result-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.result-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-meta svg {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.route-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    max-width: 100%;
    font-family: var(--font-sans);
    text-decoration: none;
}

.route-btn:active {
    background: var(--surface-hover);
    transform: scale(0.98);
}

.route-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* AI Recommendation */
.ai-recommendation {
    margin: 16px;
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    max-width: 100%;
}

/* Empty & Error States */
.empty-state,
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    gap: 12px;
}

.empty-icon,
.error-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.empty-state p,
.error-state p {
    color: var(--text-muted);
    font-size: 14px;
}

.retry-btn {
    margin-top: 8px;
    padding: 10px 20px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    font-family: var(--font-sans);
}

/* Footer */
.footer {
    padding: 24px;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    animation: fadeIn 0.3s ease-out forwards;
}

.result-card:nth-child(1) {
    animation-delay: 0ms;
}

.result-card:nth-child(2) {
    animation-delay: 50ms;
}

.result-card:nth-child(3) {
    animation-delay: 100ms;
}

/* Mobile First - phones in portrait */
@media (max-width: 480px) {
    .search-container {
        padding: 0 12px 20px;
    }

    .results-container {
        padding: 0 12px;
    }

    .result-price {
        font-size: 20px;
    }

    .result-header {
        flex-wrap: wrap;
    }

    /* Header movil: los botones caben */
    .header {
        padding: 10px 12px;
    }

    .logo-text {
        font-size: 16px;
    }

    .header-actions {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .header-actions button {
        padding: 5px 8px;
        font-size: 11px;
    }

    .status-indicator {
        display: none;
    }
}

/* Tablet+ */
@media (min-width: 768px) {
    .search-container {
        max-width: 600px;
        margin: 0 auto;
        padding-bottom: 32px;
    }

    .results-container {
        max-width: 600px;
        margin: 0 auto;
    }

    .result-card {
        padding: 20px;
    }
}

/* Header Actions & Merchant Button */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.clear-chat-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.clear-chat-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.clear-chat-btn:active {
    transform: scale(0.95);
}

.merchant-btn {
    background: var(--accent);
    color: #000;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-sans);
}

.merchant-btn:active {
    transform: scale(0.95);
    background: #1ea34d;
}

/* Portal de Comercios y OTP Modal */
.chat-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, #18181b, #09090b 80%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.chat-modal[hidden] {
    display: none !important;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: rgba(20, 20, 22, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    flex-shrink: 0;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
}

.close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
}

.merchant-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: fadeIn 0.4s ease-out forwards;
}

.section-intro {
    text-align: center;
    margin-bottom: 10px;
}

.section-intro h3 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff 30%, #a1a1aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-intro p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Formularios */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Botones Premium */
.primary-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #000000;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35);
}

.primary-btn:active {
    transform: translateY(1px);
}

.primary-btn span {
    display: flex;
    align-items: center;
}

/* Pantalla de Espera OTP */
.otp-container {
    padding: 32px 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.glass-effect-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
}

.otp-icon-wrapper {
    position: relative;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.otp-mail-icon {
    font-size: 36px;
    z-index: 2;
    animation: bounce 2s infinite ease-in-out;
}

.otp-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--accent-dim);
    animation: otpPulse 2s infinite ease-out;
    z-index: 1;
}

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

@keyframes otpPulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

.otp-container h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.otp-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.otp-description strong {
    color: var(--text-primary);
}

.otp-input-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 10px 0;
}

.otp-digit {
    width: 42px;
    height: 48px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    outline: none;
    transition: all 0.2s;
}

.otp-digit:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 8px var(--accent-dim);
}

.otp-timer {
    font-size: 13px;
    color: var(--text-muted);
}

.otp-timer strong {
    color: var(--danger);
    font-weight: 600;
}

.otp-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 10px;
}

.text-link-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: underline;
    font-family: var(--font-sans);
}

.text-link-btn:hover:not(:disabled) {
    color: var(--accent);
}

.text-link-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    text-decoration: none;
}

/* Pantalla de Éxito */
.success-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
    padding: 40px 20px;
}

.success-checkmark-wrapper {
    width: 80px;
    height: 80px;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #22c55e;
    stroke-miterlimit: 10;
    box-shadow: inset 0 0 0 #22c55e;
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s dashed;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke: #22c55e;
    stroke-miterlimit: 10;
    fill: none;
    animation: stroke .6s cubic-bezier(.65,0,.45,1) forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #000;
    animation: stroke .3s cubic-bezier(.65,0,.45,1) .8s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes fill {
    100% { box-shadow: inset 0 0 0 40px #22c55e; }
}

.success-meta {
    font-size: 13px;
    color: var(--text-muted);
}
.success-meta strong {
    color: var(--text-secondary);
}

@media (min-width: 768px) {
    .chat-modal {
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: 480px;
        height: 640px;
        border-radius: var(--radius-xl);
        border: 1px solid var(--glass-border);
        box-shadow: 0 20px 50px rgba(0,0,0,0.6);
        animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    }
    
    @keyframes scaleIn {
        from { transform: translate(-50%, -50%) scale(0.9); opacity: 0; }
        to { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    }
}

/* Main Chat UI */
.main-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 112px);
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    align-self: center;
    position: relative;
    padding: 0 16px;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    padding-bottom: 120px;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}
.chat-history::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 10px;
}

.chat-input-wrapper {
    position: absolute;
    bottom: 24px;
    left: 16px;
    right: 16px;
    z-index: 10;
}

.chat-location-badge {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100; /* Prioridad máxima */
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    pointer-events: auto !important; /* Habilitar clics */
    cursor: default;
}

#btnRetryGps {
    position: relative;
    z-index: 101;
    pointer-events: auto !important;
}

/* Reusing modal chat message bubbles for main chat */
.main-chat-container .message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease forwards;
}

.main-chat-container .message.bot {
    align-self: flex-start;
}

.main-chat-container .message.user {
    align-self: flex-end;
}

.main-chat-container .message-bubble {
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.5;
    word-break: break-word;
}

.main-chat-container .bot .message-bubble {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.8), rgba(20, 20, 20, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f0f0f0;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.main-chat-container .bot .message-bubble strong {
    color: #ffcc00;
    text-shadow: 0 0 8px rgba(255, 204, 0, 0.3);
}

.main-chat-container .user .message-bubble {
    background: var(--accent);
    color: #000;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Result Cards in Chat */
.chat-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.chat-result-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}
.chat-result-price {
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
}
.chat-result-meta {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

/* ==========================================
   PORTAL DE COMERCIOS - DRAG & DROP & LOADERS
   ========================================== */

/* Zona Drag & Drop */
.drop-zone {
    width: 100%;
    min-height: 120px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.drop-zone:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--accent);
}

.drop-zone--dragover {
    background: rgba(34, 197, 94, 0.05) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 16px rgba(34, 197, 94, 0.15);
    transform: scale(1.01);
}

.drop-icon {
    font-size: 32px;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.2));
    animation: bounceSlow 2s infinite ease-in-out;
}

.drop-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.browse-link {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
}

.drop-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

/* Previsualización del archivo */
.file-preview-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
}

.file-preview-icon {
    font-size: 24px;
}

.file-preview-name {
    font-size: 13px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-grow: 1;
    text-align: left;
}

.remove-file-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.remove-file-btn:hover {
    color: var(--danger);
}

/* Pantalla de Carga Inteligente (IA Extrayendo) */
.loading-container {
    padding: 40px 24px;
    border-radius: var(--radius-lg);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.loading-brain-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.brain-icon {
    font-size: 42px;
    z-index: 3;
    animation: brainFloat 3s infinite ease-in-out;
}

.brain-glow {
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    opacity: 0.3;
    z-index: 1;
    animation: pulseGlow 1.5s infinite alternate ease-in-out;
}

.brain-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: radarPulse 2s infinite ease-out;
    z-index: 2;
    opacity: 0;
}

.loading-container h3 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: -10px;
}

.loading-title {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
}

/* Barra de progreso de carga */
.loading-bar-wrapper {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loading-bar-progress {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--accent) 0%, #10b981 100%);
    border-radius: 10px;
    animation: loadingBarSlide 2s infinite linear;
}

.loading-warning {
    font-size: 12px;
    color: #f59e0b;
    font-weight: 500;
}

/* Animaciones */
@keyframes bounceSlow {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes brainFloat {
    0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 0 4px var(--accent-dim)); }
    50% { transform: translateY(-10px) scale(1.05); filter: drop-shadow(0 0 12px var(--accent)); }
}

@keyframes pulseGlow {
    from { opacity: 0.2; transform: scale(0.9); }
    to { opacity: 0.5; transform: scale(1.1); }
}

@keyframes radarPulse {
    0% { transform: scale(0.6); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes loadingBarSlide {
    0% { left: -30%; }
    100% { left: 100%; }
}

/* =====================
   GOOGLE MAPS PANEL
   ===================== */
.map-panel {
    width: 100%;
    max-width: 800px;
    align-self: center;
    margin: 0 16px 12px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    animation: fadeIn 0.35s ease-out forwards;
    flex-shrink: 0;
}

.map-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--glass-border);
}

.map-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.02em;
}

.map-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    font-family: var(--font-sans);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.map-close-btn:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.ubiken-map {
    width: 100%;
    height: 260px;
    background: var(--bg-tertiary);
}

@media (min-width: 768px) {
    .map-panel {
        margin: 0 auto 12px;
        width: calc(100% - 32px);
    }
    .ubiken-map {
        height: 320px;
    }
}

/* ============================================================
   PORTAL DE COMERCIOS — CHAT UI PREMIUM
   ============================================================ */
.merchant-chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.merchant-chat-area::-webkit-scrollbar {
    width: 6px;
}
.merchant-chat-area::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 10px;
}

.merchant-chat-history {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 20px;
}

.merchant-chat-history .message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease forwards;
}

.merchant-chat-history .message.bot {
    align-self: flex-start;
}

.merchant-chat-history .message.user {
    align-self: flex-end;
}

.merchant-chat-history .message-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.merchant-chat-history .bot .message-bubble {
    background: linear-gradient(135deg, rgba(40, 40, 40, 0.8), rgba(20, 20, 20, 0.9));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #f0f0f0;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.merchant-chat-history .bot .message-bubble strong {
    color: var(--accent);
}

.merchant-chat-history .user .message-bubble {
    background: var(--accent);
    color: #000;
    border-bottom-right-radius: 4px;
    font-weight: 500;
}

/* Fila de Input del Comercio */
.merchant-input-row {
    display: flex;
    align-items: center;
    padding: 6px 6px 6px 14px;
    gap: 8px;
    margin: 12px 16px 20px;
    border-radius: var(--radius-xl);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    border: 1px solid var(--glass-border);
}

.merchant-input-row:focus-within {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(34, 197, 94, 0.1);
}

.merchant-camera-btn {
    background: var(--surface);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.merchant-camera-btn:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.merchant-camera-btn:active {
    transform: scale(0.92);
}

.merchant-camera-btn svg {
    display: block;
}

.merchant-text-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    font-size: 14px;
    color: var(--text-primary) !important;
    font-family: var(--font-sans);
    padding: 8px 0;
}

.merchant-text-input::placeholder {
    color: var(--text-muted);
}

.merchant-send-btn {
    background: linear-gradient(135deg, #22c55e 0%, #15803d 100%);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.merchant-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.5);
    background: linear-gradient(135deg, #2ae06c 0%, #169346 100%);
}

.merchant-send-btn:active {
    transform: scale(0.95);
}

.merchant-send-btn svg {
    width: 16px;
    height: 16px;
    color: #000;
    transform: translate(1px, 0);
    display: block;
}

/* Quick replies en el chat */
.merchant-quick-replies {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
    flex-shrink: 0;
    margin-bottom: 8px;
    scrollbar-width: none;
}

.merchant-quick-replies::-webkit-scrollbar {
    display: none;
}

.quick-reply-chip {
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 20px !important;
    padding: 6px 14px !important;
    color: var(--text-secondary) !important;
    font-size: 13px !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: all 0.2s !important;
    font-family: var(--font-sans) !important;
}

.quick-reply-chip:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: var(--text-primary) !important;
    border-color: var(--text-secondary) !important;
}

.quick-reply-chip:active {
    transform: scale(0.96) !important;
}
