:root {
    --primary-color: #128C7E;
    --secondary-color: #075E54;
    --accent-color: #25D366;
    --light-color: #DCF8C6;
    --grey-color: #f0f0f0;
    --dark-grey: #4a4a4a;
    --white: #ffffff;
    --bubble-agent1: #DCF8C6;
    --bubble-agent2: #ffffff;
    --typing-bg: rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #25D366, #128C7E);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Elementos decorativos en el fondo */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 20%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 40%);
    z-index: -1;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.app-container {
    background-color: var(--white);
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: 80vh;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.app-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.app-header {
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    color: var(--white);
    padding: 18px 25px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.app-header h1 i {
    font-size: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* Estilos mejorados para el panel de configuración */
.setup-panel {
    padding: 25px;
    max-height: calc(80vh - 65px);
    overflow-y: auto;
    animation: fadeIn 0.5s ease;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.95));
}

.setup-panel h2 {
    color: var(--secondary-color);
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.6rem;
    position: relative;
    padding-bottom: 15px;
}

.setup-panel h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--accent-color), var(--primary-color));
    border-radius: 2px;
}

.agent-selection {
    display: flex;
    gap: 25px;
    margin-bottom: 35px;
}

.agent-column {
    flex: 1;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.agent-column:hover {
    transform: translateY(-5px);
}

.agent-column h3 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--dark-grey);
    font-size: 1.3rem;
    position: relative;
    padding-bottom: 10px;
}

.agent-column h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 3px;
}

.agent-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
    padding-bottom: 5px;
}

.agent-options::-webkit-scrollbar {
    width: 8px;
}

.agent-options::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.agent-options::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

.agent-option {
    background-color: var(--white);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

.agent-option:hover {
    background-color: var(--light-color);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 5px 12px rgba(0,0,0,0.1);
}

.agent-option.selected {
    background-color: var(--light-color);
    border: 2px solid var(--accent-color);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 5px 12px rgba(0,0,0,0.1);
}

.agent-icon {
    font-size: 2.5rem;
    width: 55px;
    height: 55px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: var(--white);
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.agent-option:hover .agent-icon {
    transform: rotate(10deg);
}

.agent-info {
    flex: 1;
}

.agent-name {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.agent-desc {
    font-size: 0.9rem;
    color: var(--dark-grey);
    line-height: 1.4;
}

.tema-container {
    margin-bottom: 30px;
    background-color: rgba(255, 255, 255, 0.7);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.tema-container:hover {
    transform: translateY(-3px);
}

.tema-container h3 {
    margin-bottom: 15px;
    color: var(--dark-grey);
    font-size: 1.2rem;
    position: relative;
    padding-bottom: 10px;
}

.tema-container h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--accent-color);
    border-radius: 3px;
}

#tema-input {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 1rem;
    background-color: var(--white);
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.05);
}

#tema-input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.2);
    outline: none;
    transform: translateY(-2px);
}

.start-btn {
    background: linear-gradient(to right, var(--accent-color), var(--primary-color));
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.start-btn i {
    font-size: 1.2rem;
}

.start-btn:hover {
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(37, 211, 102, 0.4);
}

.start-btn:disabled {
    background: linear-gradient(to right, #ccc, #999);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Estilos mejorados para el contenedor de chat */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(80vh - 65px);
    animation: fadeIn 0.5s ease;
}

.chat-header {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(to right, var(--secondary-color), var(--primary-color));
    color: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.back-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    margin-right: 15px;
    transition: transform 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
}

.back-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

#chat-title {
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1.1rem;
}

.chat-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.1);
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #E5DDD5;
    background-image: url('https://web.whatsapp.com/img/bg-chat-tile-light_686b98c9fdffef3f9805e49a78fe901f.png');
    background-repeat: repeat;
    scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.message {
    max-width: 75%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border-radius: 12px;
    position: relative;
    font-size: 1rem;
    line-height: 1.5;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    animation: messageIn 0.3s ease;
    word-wrap: break-word;
}

.message::after {
    content: attr(data-time);
    display: block;
    font-size: 0.7rem;
    color: #999;
    text-align: right;
    margin-top: 5px;
}

.message.agent1 {
    background-color: var(--bubble-agent1);
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 0;
    position: relative;
}

.message.agent1::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 20px;
    height: 20px;
    background-color: var(--bubble-agent1);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.message.agent2 {
    background-color: var(--bubble-agent2);
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 0;
    position: relative;
}

.message.agent2::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -10px;
    width: 20px;
    height: 20px;
    background-color: var(--bubble-agent2);
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.message .agent-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.message .avatar {
    font-size: 1.3rem;
    margin-right: 5px;
}

.message-text {
    animation: fadeInText 0.5s ease;
}

.chat-controls {
    display: flex;
    padding: 15px;
    background-color: #f8f8f8;
    gap: 12px;
    border-top: 1px solid #ddd;
}

.continue-btn, .reset-btn, .download-btn {
    padding: 12px 15px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.continue-btn {
    background: linear-gradient(to right, var(--accent-color), var(--primary-color));
    color: var(--white);
    flex: 2;
    box-shadow: 0 3px 8px rgba(37, 211, 102, 0.2);
}

.reset-btn {
    background: linear-gradient(to right, #f44336, #d32f2f);
    color: var(--white);
    flex: 1;
    box-shadow: 0 3px 8px rgba(244, 67, 54, 0.2);
}

.download-btn {
    background: linear-gradient(to right, #2196F3, #1976D2);
    color: var(--white);
    flex: 1;
    box-shadow: 0 3px 8px rgba(33, 150, 243, 0.2);
}

.continue-btn:hover, .reset-btn:hover, .download-btn:hover {
    transform: translateY(-3px);
    filter: brightness(1.05);
}

.continue-btn:active, .reset-btn:active, .download-btn:active {
    transform: translateY(0);
    filter: brightness(0.95);
}

/* Indicador de escritura mejorado */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background-color: var(--typing-bg);
    border-radius: 18px;
    margin-bottom: 20px;
    max-width: 75px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.typing-indicator.agent1 {
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 0;
    background-color: rgba(220, 248, 198, 0.6);
}

.typing-indicator.agent1::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: -10px;
    width: 20px;
    height: 20px;
    background-color: rgba(220, 248, 198, 0.6);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.typing-indicator.agent2 {
    align-self: flex-end;
    margin-left: auto;
    border-bottom-right-radius: 0;
    background-color: rgba(255, 255, 255, 0.6);
}

.typing-indicator.agent2::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: -10px;
    width: 20px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.6);
    clip-path: polygon(0 0, 100% 100%, 0 100%);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    margin: 0 3px;
    animation: typing-animation 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-animation {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

.hidden {
    display: none;
}

.char {
    opacity: 0;
    animation: fadeIn 0.05s forwards;
}

/* Animaciones */
@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes fadeInText {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos para notificaciones */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(to right, var(--accent-color), var(--primary-color));
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

/* Footer */
.footer {
    margin-top: 20px;
    text-align: center;
    color: white;
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer:hover {
    opacity: 1;
}

.footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.footer i {
    color: #ff5252;
    animation: heartbeat 1.5s ease infinite;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Botón de scroll hacia abajo */
#scroll-bottom-btn {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Media Queries */
@media (max-width: 768px) {
    .agent-selection {
        flex-direction: column;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-controls {
        flex-wrap: wrap;
    }
    
    .continue-btn {
        flex: 1 0 100%;
        margin-bottom: 10px;
    }
    
    .reset-btn, .download-btn {
        flex: 1;
    }
    
    .app-container {
        max-height: 90vh;
    }
    
    .chat-container {
        height: calc(90vh - 65px);
    }
    
    .container {
        padding: 10px;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .agent-option {
        padding: 10px;
    }
    
    .agent-icon {
        width: 45px;
        height: 45px;
        font-size: 2rem;
    }
    
    .agent-name {
        font-size: 0.9rem;
    }
    
    .agent-desc {
        font-size: 0.8rem;
    }
    
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .footer {
        font-size: 0.8rem;
    }
}