/* Reset y variables globales */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff00ff;
    --secondary-color: #00ffff;
    --accent-color: #ffff00;
    --dark-bg: #0a0a0f;
    --card-bg: #1a1a2e;
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
    --border-color: #ff00ff;
    --glow-color: #ff00ff;
    --success-color: #00ff00;
    --danger-color: #ff0066;
}

/* Fondo animado de circo digital */
.circus-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a1a2e 50%, #16213e 100%);
    z-index: -2;
}

.floating-elements {
    position: fixed;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.floating-star {
    position: absolute;
    font-size: 2rem;
    animation: float 6s ease-in-out infinite;
    opacity: 0.7;
}

.floating-star:nth-child(1) { top: 10%; left: 10%; animation-delay: 0s; }
.floating-star:nth-child(2) { top: 20%; right: 15%; animation-delay: 1s; }
.floating-star:nth-child(3) { bottom: 30%; left: 20%; animation-delay: 2s; }
.floating-star:nth-child(4) { bottom: 10%; right: 10%; animation-delay: 3s; }
.floating-star:nth-child(5) { top: 50%; left: 50%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Header */
.main-header {
    background: rgba(26, 26, 46, 0.9);
    border-bottom: 3px solid var(--primary-color);
    padding: 1rem 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.3);
}

.logo-container {
    text-align: center;
}

.logo {
    font-family: 'Rubik Mono One', monospace;
    font-size: 3rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-family: 'Space Mono', monospace;
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* Main container */
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
    position: relative;
}

/* Chat section */
.chat-section {
    margin-bottom: 2rem;
}

.chat-container {
    background: rgba(26, 26, 46, 0.9);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 30px rgba(255, 0, 255, 0.2);
}

.chat-header {
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h2 {
    color: white;
    font-family: 'Space Mono', monospace;
    font-size: 1.5rem;
}

.ai-status {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 2rem;
    background: rgba(10, 10, 15, 0.5);
}

.welcome-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.5s ease-out;
}

.ai-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.message-content {
    background: rgba(255, 0, 255, 0.1);
    border: 1px solid rgba(255, 0, 255, 0.3);
    border-radius: 15px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    max-width: 70%;
}

.user-message {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    justify-content: flex-end;
    animation: slideIn 0.5s ease-out;
}

.user-message .message-content {
    background: rgba(0, 255, 255, 0.1);
    border: 1px solid rgba(0, 255, 255, 0.3);
}

.ai-response {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    animation: slideIn 0.5s ease-out;
}

.ai-response .message-content {
    background: rgba(255, 255, 0, 0.1);
    border: 1px solid rgba(255, 255, 0, 0.3);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.chat-input-container {
    padding: 1.5rem;
    background: rgba(26, 26, 46, 0.9);
    border-top: 1px solid var(--primary-color);
    display: flex;
    gap: 1rem;
}

.chat-input {
    flex: 1;
    padding: 1rem;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid var(--primary-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.chat-input:focus {
    outline: none;
    box-shadow: 0 0 20px rgba(255, 0, 255, 0.5);
    border-color: var(--secondary-color);
}

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

.send-btn {
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    border-radius: 25px;
    color: white;
    font-family: 'Space Mono', monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 0, 255, 0.4);
}

/* Botón enseñar */
.teach-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, var(--accent-color), var(--primary-color));
    border: 3px solid white;
    border-radius: 50px;
    color: var(--dark-bg);
    font-family: 'Rubik Mono One', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 5px 20px rgba(255, 255, 0, 0.4);
}

.teach-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 255, 0, 0.6);
}

/* Panel de enseñanza */
.teach-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: rgba(26, 26, 46, 0.95);
    border: 3px solid var(--primary-color);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(255, 0, 255, 0.5);
}

.teach-panel.hidden {
    display: none;
}

.teach-container {
    padding: 2rem;
}

.teach-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 1rem;
}

.teach-header h3 {
    color: var(--text-primary);
    font-family: 'Rubik Mono One', monospace;
    font-size: 1.5rem;
}

.close-btn {
    background: var(--danger-color);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    transform: rotate(90deg);
    background: var(--primary-color);
}

.teach-form {
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.form-group textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(10, 10, 15, 0.8);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.3s ease;
}

.form-group textarea:focus {
    outline: none;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
    border-color: var(--secondary-color);
}

.form-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.add-btn, .clear-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    color: white;
    font-family: 'Space Mono', monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
}

.add-btn {
    background: linear-gradient(45deg, var(--success-color), var(--secondary-color));
}

.clear-btn {
    background: linear-gradient(45deg, var(--danger-color), var(--primary-color));
}

.add-btn:hover, .clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 0, 255, 0.3);
}

.teaching-list {
    border-top: 2px solid var(--primary-color);
    padding-top: 1rem;
}

.teaching-list h4 {
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    margin-bottom: 1rem;
}

.teaching-items {
    max-height: 200px;
    overflow-y: auto;
}

.teaching-item {
    background: rgba(255, 0, 255, 0.1);
    border: 1px solid rgba(255, 0, 255, 0.3);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    position: relative;
}

.teaching-item .user-text {
    color: var(--secondary-color);
    font-family: 'Space Mono', monospace;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.teaching-item .ai-response {
    color: var(--accent-color);
    font-family: 'Space Mono', monospace;
    margin-bottom: 0.5rem;
}

.teaching-item .delete-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--danger-color);
    border: none;
    border-radius: 50%;
    width: 25px;
    height: 25px;
    color: white;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

.teaching-item .delete-btn:hover {
    transform: scale(1.2);
}

/* Footer */
.main-footer {
    background: rgba(26, 26, 46, 0.9);
    border-top: 3px solid var(--primary-color);
    padding: 1.5rem 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
    margin-top: 3rem;
}

.footer-content p {
    color: var(--text-primary);
    font-family: 'Space Mono', monospace;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.stats {
    color: var(--text-secondary);
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(10, 10, 15, 0.5);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, var(--secondary-color), var(--primary-color));
}

/* Responsive design */
@media (max-width: 768px) {
    .logo {
        font-size: 2rem;
    }
    
    .main-container {
        padding: 0 1rem;
    }
    
    .chat-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .chat-messages {
        height: 300px;
        padding: 1rem;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .teach-panel {
        width: 95%;
        max-height: 90vh;
    }
    
    .teach-container {
        padding: 1rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .add-btn, .clear-btn {
        width: 100%;
    }
    
    .teach-button {
        bottom: 1rem;
        right: 1rem;
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}
