.openai-chat-widget {
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 100%;
    margin: 20px 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.openai-chat-widget.floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 600px;
    z-index: 9999;
    transition: all 0.3s ease;
}

.openai-chat-widget.floating.minimized {
    height: 70px;
}

.chat-header {
    background: linear-gradient(135deg, #00d2b3 0%, #a5f9ea 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.minimize-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: background 0.3s ease;
}

.minimize-btn:hover {
    background: rgba(255,255,255,0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
    min-height: 0;
}

.chat-messages:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: rgba(74, 144, 226, 0.1);
    border-radius: 50%;
    border: 2px solid rgba(74, 144, 226, 0.2);
    z-index: 0;
}

.chat-messages:after {
    content: "💬";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    z-index: 1;
    opacity: 0.4;
}

.message {
    margin-bottom: 16px;
    animation: fadeInUp 0.4s ease;
    position: relative;
    z-index: 2;
}

.message-content {
    padding: 14px 18px;
    border-radius: 20px;
    max-width: 85%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.assistant-message .message-content {
    background: linear-gradient(135deg, #a5f9ea 0%, #82f4e1 100%);
    color: #57117c;
    margin-right: auto;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(74, 144, 226, 0.2);
}

.user-message .message-content {
    background: linear-gradient(135deg, #57117c 0%, #57117c 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.message-time {
    font-size: 11px;
    color: rgba(0,0,0,0.5);
    margin-top: 6px;
    font-weight: 400;
}

.assistant-message .message-time {
    text-align: left;
}

.user-message .message-time {
    text-align: right;
    color: rgba(255,255,255,0.7);
}

/* ZONA DE INPUT Y TYPING INDICATOR */
.chat-bottom-section {
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.typing-indicator {
    padding: 10px 20px 0 20px;
    color: rgba(0,0,0,0.6);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border-top: 1px solid rgba(0,0,0,0.1);
}

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

.typing-dots span {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4a90e2;
    animation: bounce 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

.chat-input-container {
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    gap: 12px;
    align-items: stretch;
    min-height: 90px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

.chat-input {
    flex: 1;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: 25px;
    padding: 18px 24px;
    resize: none;
    font-family: inherit;
    font-size: 16px;
    background: #ffffff;
    color: #333333;
    outline: none;
    transition: all 0.3s ease;
    min-height: 56px;
    max-height: 140px;
    line-height: 1.5;
    box-sizing: border-box;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.3) transparent;
}

.chat-input::placeholder {
    color: rgba(0,0,0,0.5);
    font-style: italic;
    font-size: 14px;
}

.chat-input:focus {
    border-color: #00d2b3;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
    transform: translateY(-1px);
}

/* Estilos para el scrollbar del input */
.chat-input::-webkit-scrollbar {
    width: 6px;
}

.chat-input::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
}

.chat-input::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.chat-input::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

.send-button {
    background: linear-gradient(135deg, #a0158d 0%, #a0158d 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
    font-size: 14px;
    font-weight: 600;
    min-width: 100px;
    height: 56px;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: flex-end;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(74, 144, 226, 0.4);
    background: linear-gradient(135deg, #57117c 0%, #57117c 100%);
}

.send-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    background: rgba(0,0,0,0.2);
}

.send-button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.send-text {
    font-size: 14px;
    font-weight: 600;
    color: white !important;
    text-shadow: none;
    line-height: 1;
}

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

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

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(74, 144, 226, 0.4);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(74, 144, 226, 0.6);
}

/* Estados vacío del chat */
.chat-messages.empty:before {
    opacity: 1;
}

.chat-messages.empty:after {
    opacity: 1;
}

.chat-messages:not(.empty):before,
.chat-messages:not(.empty):after {
    display: none;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .openai-chat-widget.floating {
        width: calc(100% - 40px);
        right: 20px;
        left: 20px;
        height: calc(100vh - 40px);
    }
    
    .chat-input-container {
        min-height: 95px;
        padding: 18px;
    }
    
    .chat-input {
        min-height: 60px;
        font-size: 16px;
        padding: 20px 24px;
    }
    
    .send-button {
        min-width: 85px;
        padding: 16px 20px;
        font-size: 13px;
        height: 60px;
    }
    
    .send-text {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .chat-input-container {
        padding: 16px;
        min-height: 88px;
    }
    
    .chat-input {
        min-height: 58px;
        font-size: 16px;
        padding: 20px 22px;
    }
    
    .send-button {
        min-width: 58px;
        width: 58px;
        height: 58px;
        border-radius: 50%;
        padding: 18px;
    }
    
    .send-button .send-text {
        display: none;
    }
}

/* Light theme variant (ya es el tema principal) */
.openai-chat-widget.light-theme {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.openai-chat-widget.light-theme .chat-header {
    background: linear-gradient(135deg, #4a90e2 0%, #357abd 100%);
}

.openai-chat-widget.light-theme .chat-messages {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.openai-chat-widget.light-theme .chat-input-container {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Dark theme como variante opcional */
.openai-chat-widget.dark-theme {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.openai-chat-widget.dark-theme .chat-header {
    background: linear-gradient(135deg, #6a4c93 0%, #9d4edd 100%);
}

.openai-chat-widget.dark-theme .chat-messages {
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
}

.openai-chat-widget.dark-theme .chat-input-container {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

/* Mejoras adicionales para mejor UX */
.chat-input::-webkit-input-placeholder {
    color: rgba(0,0,0,0.5);
}

.chat-input::-moz-placeholder {
    color: rgba(0,0,0,0.5);
    opacity: 1;
}

.chat-input:-ms-input-placeholder {
    color: rgba(0,0,0,0.5);
}

/* Evitar zoom en iOS */
@media screen and (max-device-width: 480px) {
    .chat-input {
        font-size: 16px !important;
    }
}