/* Chatbox Styles - Mejorado */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #333;
}

.chat-container {
    width: 420px;
    height: 650px;
    background-color: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    padding: 20px;
    text-align: center;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.chat-header h3 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}

.chat-header p {
    margin: 5px 0 0 0;
    font-size: 0.9em;
    opacity: 0.9;
}

.help-tip {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    padding: 12px 16px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 2px solid #f0c674;
    position: relative;
    animation: slideDown 0.3s ease;
}

.help-icon {
    font-size: 1.5em;
    flex-shrink: 0;
}

.help-tip p {
    margin: 0;
    font-size: 0.85em;
    flex: 1;
}

.close-help {
    background: none;
    border: none;
    color: #856404;
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.close-help:hover {
    transform: scale(1.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
    scrollbar-width: thin;
    scrollbar-color: #4a90e2 #e9ecef;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a90e2;
    border-radius: 10px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 75%;
    word-wrap: break-word;
    position: relative;
    animation: fadeIn 0.3s ease-in;
    display: flex;
    align-items: center;
}

.message.user {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    align-self: flex-end;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.message.bot {
    background-color: #ffffff;
    color: #333;
    align-self: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.message.bot::before {
    content: '🤖';
    font-size: 1.2em;
    margin-right: 10px;
    flex-shrink: 0;
}

.chat-input {
    display: flex;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    background-color: #ffffff;
    border-radius: 0 0 20px 20px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    margin-right: 10px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease;
}

.chat-input input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.chat-input input::placeholder {
    color: #999;
}

.chat-input button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.chat-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.chat-input button:active {
    transform: translateY(0);
}

.suggestion {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    padding: 8px 12px;
    border-radius: 15px;
    margin-top: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s ease;
    border: 1px solid #f0c674;
}

.suggestion:hover {
    background: linear-gradient(135deg, #ffeaa7 0%, #fff3cd 100%);
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    padding: 10px;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border-radius: 12px;
    border: 1px solid #bbdefb;
}

.search-result-item {
    background: white;
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #333;
}

.search-result-item:hover {
    background: #f8f9fa;
    transform: translateX(5px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.2);
}

.result-number {
    color: #4a90e2;
    font-weight: 600;
    font-size: 0.95em;
    flex-shrink: 0;
}

.result-text {
    flex: 1;
}

.back-to-home {
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    text-align: center;
    border-top: 2px solid rgba(74, 144, 226, 0.3);
}

.btn-home {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 1em;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    cursor: pointer;
    border: none;
}

.btn-home:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.6);
}

.btn-home:active {
    transform: translateY(-1px);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        padding: 10px 0;
    }

    .chat-container {
        width: 95%;
        height: 90vh;
        max-height: none;
        margin: 10px auto;
        border-radius: 15px;
    }

    .chat-header {
        padding: 15px;
        border-radius: 15px 15px 0 0;
    }

    .chat-header h3 {
        font-size: 1.3em;
    }

    .chat-header p {
        font-size: 0.85em;
    }

    .help-tip {
        padding: 10px 12px;
        gap: 8px;
    }

    .help-icon {
        font-size: 1.2em;
    }

    .help-tip p {
        font-size: 0.8em;
    }

    .chat-messages {
        padding: 12px;
    }

    .message {
        max-width: 85%;
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .message.bot::before {
        font-size: 1em;
        margin-right: 8px;
    }

    .chat-input {
        padding: 12px;
        flex-direction: column;
        gap: 10px;
    }

    .chat-input input {
        width: 100%;
        margin-right: 0;
        font-size: 16px; /* Evita zoom en iOS */
    }

    .chat-input button {
        width: 100%;
        padding: 12px 16px;
    }

    .search-results {
        margin-top: 8px;
        padding: 8px;
        gap: 6px;
    }

    .search-result-item {
        padding: 8px 10px;
        font-size: 0.85em;
    }

    .back-to-home {
        padding: 12px 15px;
    }

    .btn-home {
        padding: 10px 20px;
        font-size: 0.95em;
    }
}

@media (max-width: 480px) {
    .chat-container {
        width: 98%;
        height: 95vh;
        border-radius: 12px;
    }

    .chat-header h3 {
        font-size: 1.1em;
    }

    .help-tip {
        padding: 8px 10px;
        font-size: 0.75em;
    }

    .message {
        max-width: 90%;
        font-size: 0.9em;
    }

    .search-result-item {
        font-size: 0.8em;
    }

    .btn-home {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}
