/* Consulado Chatbot Styles */

:root {
    --chatbot-primary: #0d47a1;
    --chatbot-primary-dark: #002171;
    --chatbot-primary-light: #5472d3;
    --chatbot-secondary: #fc9003;
    --chatbot-bg: #ffffff;
    --chatbot-text: #333333;
    --chatbot-border: #e0e0e0;
    --chatbot-shadow: rgba(0, 0, 0, 0.1);
    --chatbot-user-bg: #e3f2fd;
    --chatbot-assistant-bg: #f5f5f5;
}

/* Widget Container */
.chatbot-widget {
    position: fixed;
    z-index: 999999;
}

.chatbot-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.chatbot-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

.chatbot-position-top-right {
    top: 20px;
    right: 20px;
}

.chatbot-position-top-left {
    top: 20px;
    left: 20px;
}

/* Toggle Button */
.chatbot-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--chatbot-shadow);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--chatbot-shadow);
}

.chatbot-toggle-btn.chatbot-active {
    transform: scale(0.9);
}

.chatbot-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #f44336;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Chat Window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 450px;
    max-width: calc(100vw - 40px);
    height: 700px;
    max-height: calc(100vh - 140px);
    background: var(--chatbot-bg);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ventana maximizada */
.chatbot-window.maximized {
    width: 95vw !important;
    height: 95vh !important;
    max-width: 95vw !important;
    max-height: 95vh !important;
    top: 2.5vh !important;
    left: 2.5vw !important;
    right: 2.5vw !important;
    bottom: 2.5vh !important;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 140px);
        bottom: 80px;
        right: 20px;
    }
    
    .chatbot-window.maximized {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0;
    }
}

/* Header */
.chatbot-window .chatbot-header {
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-window .chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.chatbot-window .chatbot-header-actions {
    display: flex !important;
    align-items: center;
    gap: 8px;
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-window .chatbot-icon-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    color: white !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.chatbot-window .chatbot-icon-btn svg {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
}

.chatbot-window .chatbot-icon-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
    transform: scale(1.05);
}

.chatbot-window .chatbot-icon-btn:active {
    transform: scale(0.95);
}

.chatbot-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: avatarPulse 3s ease-in-out infinite;
}

.chatbot-avatar svg {
    animation: avatarBreathe 4s ease-in-out infinite;
}

/* Animaciones del avatar */
@keyframes avatarPulse {
    0%, 100% {
        transform: scale(1);
        background: rgba(255, 255, 255, 0.2);
    }
    50% {
        transform: scale(1.05);
        background: rgba(255, 255, 255, 0.3);
    }
}

@keyframes avatarBreathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.08);
    }
}

/* Cuando el bot está escribiendo */
.chatbot-avatar.typing {
    animation: avatarTyping 0.6s ease-in-out infinite;
}

@keyframes avatarTyping {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-2px) scale(1.05);
    }
}

.chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
}

/* Disclaimer Legal */
.chatbot-disclaimer {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chatbot-disclaimer-content {
    max-width: 100%;
}

.disclaimer-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.chatbot-disclaimer-content h3 {
    margin: 0 0 16px 0;
    color: var(--chatbot-primary);
    text-align: center;
    font-size: 20px;
}

.disclaimer-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
}

.disclaimer-text p {
    margin-bottom: 12px;
}

.emergency-warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
}

.emergency-warning h4 {
    margin: 0 0 12px 0;
    color: #856404;
    font-size: 16px;
}

.emergency-warning ul {
    margin: 12px 0;
    padding-left: 24px;
}

.emergency-warning li {
    margin-bottom: 6px;
    color: #856404;
}

.emergency-contacts {
    background: white;
    padding: 12px;
    border-radius: 6px;
    margin-top: 12px;
}

.emergency-contacts p {
    margin: 8px 0;
    font-size: 13px;
    color: #333;
}

.emergency-contacts strong {
    color: #d32f2f;
}

.emergency-contacts a {
    color: #0d47a1;
    text-decoration: none;
    font-weight: 500;
}

.emergency-contacts a:hover {
    text-decoration: underline;
}

.disclaimer-terms {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 8px;
    margin-top: 20px;
}

.disclaimer-terms .checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.disclaimer-terms input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.disclaimer-terms span {
    font-size: 12px;
    line-height: 1.5;
    color: #555;
}

/* Registration Form */
.chatbot-registration-form {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chatbot-registration-content h3 {
    margin: 0 0 10px 0;
    color: var(--chatbot-primary);
}

.chatbot-registration-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
}

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

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

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--chatbot-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--chatbot-primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 3px;
}

.checkbox-label span {
    font-size: 13px;
    line-height: 1.4;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--chatbot-primary) 0%, var(--chatbot-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 71, 161, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Messages Area */
.chatbot-messages-area {
    flex: 1;
    overflow-y: auto !important;
    background: #fafafa;
    max-height: 100%;
    position: relative;
}

.chatbot-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    min-height: 100%;
}

/* Individual Message */
.chatbot-message {
    display: flex;
    gap: 10px;
    animation: messageSlideIn 0.3s ease;
}

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

.chatbot-message-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-message-user .chatbot-message-icon {
    background: var(--chatbot-primary);
    color: white;
}

.chatbot-message-assistant .chatbot-message-icon {
    background: #757575;
    color: white;
}

.chatbot-message-error .chatbot-message-icon {
    background: #f44336;
    color: white;
}

.chatbot-message-content {
    flex: 1;
    min-width: 0;
}

.chatbot-message-text {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message-user .chatbot-message-text {
    background: var(--chatbot-user-bg);
    color: var(--chatbot-text);
}

.chatbot-message-assistant .chatbot-message-text {
    background: white;
    color: var(--chatbot-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chatbot-message-error .chatbot-message-text {
    background: #ffebee;
    color: #c62828;
}

.chatbot-message-text a {
    color: var(--chatbot-primary);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.chatbot-message-text a:hover {
    color: var(--chatbot-secondary);
    text-decoration: none;
}

.chatbot-message-time {
    margin-top: 4px;
    font-size: 11px;
    color: #999;
    padding: 0 4px;
}

/* Input Area */
.chatbot-input-area {
    border-top: 1px solid var(--chatbot-border);
    background: white;
    padding: 12px 16px;
}

/* Quick Reply Buttons */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 20px;
    margin-top: 8px;
    animation: fadeIn 0.3s ease-in;
}

.chatbot-quick-reply-btn {
    background: white;
    border: 2px solid var(--chatbot-primary);
    color: var(--chatbot-primary);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chatbot-quick-reply-btn:hover {
    background: var(--chatbot-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(13, 71, 161, 0.2);
}

.chatbot-quick-reply-btn:active {
    transform: translateY(0);
}

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

#chatbot-message-form {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--chatbot-border);
    border-radius: 20px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    outline: none;
    border-color: var(--chatbot-primary);
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    background: var(--chatbot-primary-dark);
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-end-btn {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: 1px solid var(--chatbot-border);
    border-radius: 6px;
    font-size: 12px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-end-btn:hover {
    background: #f5f5f5;
    border-color: #999;
}

/* Loading Indicator */
.chatbot-loading {
    padding: 16px;
    display: flex;
    justify-content: center;
    background: white;
    border-top: 1px solid var(--chatbot-border);
}

.typing-indicator {
    display: flex;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--chatbot-primary);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Scrollbar */
.chatbot-messages-area::-webkit-scrollbar,
.chatbot-registration-form::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages-area::-webkit-scrollbar-track,
.chatbot-registration-form::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages-area::-webkit-scrollbar-thumb,
.chatbot-registration-form::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chatbot-messages-area::-webkit-scrollbar-thumb:hover,
.chatbot-registration-form::-webkit-scrollbar-thumb:hover {
    background: #999;
}
