:root {
    --bg-dark-primary: #171717;
    --bg-dark-secondary: #212121;
    --bg-light: #FFFFFF;
    --bg-code: #0D1117;
    --text-dark-primary: #111827;
    --text-dark-secondary: #6B7280;
    --text-light-primary: #EAEAEA;
    --text-light-secondary: #A0A0A0;
    --border-color-dark: #2c2c2c;
    --border-color-light: #E5E7EB;
    --accent-blue-dark: #1E293B;
    --font-family-sans: 'Inter', sans-serif;
    --font-family-mono: 'Fira Code', monospace;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-sans);
    background-color: var(--bg-dark-secondary);
    color: var(--text-light-primary);
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 260px 1fr 320px;
    height: 100vh;
}

.sidebar-left {
    background-color: var(--bg-dark-primary);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.logo-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.logo-header .logo-icon {
    width: 32px;
    height: 32px;
}

.logo-header .logo-text {
    font-size: 20px;
    font-weight: 600;
}

.logo-header .fa-chevron-down {
    margin-left: auto;
    color: var(--text-light-secondary);
}

.new-chat-btn {
    width: auto;
    background-color: #407a6c;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0; /* Evita que el botón se encoja */
}

.new-chat-btn:hover {
    background-color: #2a3a55;
}

.main-nav ul {
    list-style: none;
}

.main-nav li {
    margin-bottom: 8px;
}

.main-nav a {
    color: var(--text-light-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.main-nav li.active a {
    background-color: var(--bg-light);
    color: var(--text-dark-primary);
}

.main-nav a:hover {
    background-color: var(--bg-light);
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
}

.search-bar input {
    flex-grow: 1;
    background: none;
    border: none;
    color: var(--text-light-primary);
    font-size: 14px;
}

.search-bar input:focus {
    outline: none;
}

.user-profile-bottom {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color-dark);
}

.user-sphere {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 25px 3px rgba(0, 208, 255, 0.25);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
}

.user-email {
    font-size: 12px;
    color: var(--text-light-secondary);
}

.user-profile-bottom .fa-chevron-up {
    margin-left: auto;
    color: var(--text-light-secondary);
}

.fa-icons { color: #f3f036; }
.fa-magnifying-glass { color: #3B82F6; }
.fa-database { color: #FFA500; }
.fa-gamepad { color: #205015; }
.fa-code-branch { color: #911a2e; }
.fa-cog { color: #7611c9; }
.fa-comment { color: #10a37f; }

.chatbot-mind {
    width: 100%;
    margin: auto 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bot-message {
    justify-content: flex-start;
    margin-right: auto;
}

.chatbot-mind img {
    width: 255px;
    height: 255px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-area {
    background-color: var(--bg-light);
    color: var(--text-dark-primary);
    display: flex;
    flex-direction: column;
    border-radius: 12px 0 0 12px;
    height: 100vh;
}

.chat-header {
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color-light);
    gap: 15px;
}

.menu-toggle-btn,
.profile-toggle-btn,
.close-menu-btn {
    display: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--text-dark-secondary);
    margin-left: auto;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px; width: 16px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider { background-color: #333; }
input:checked+.slider:before { transform: translateX(18px); }
.slider.round { border-radius: 34px; }
.slider.round:before { border-radius: 50%; }

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chat-history::-webkit-scrollbar { width: 8px; }
.chat-history::-webkit-scrollbar-thumb { background: #3A7FBE; border-radius: 4px; }
.chat-history::-webkit-scrollbar-track { background: #10122B; }

.chat-message {
    display: flex;
    align-items: flex-end;
    margin: 10px 0;
    max-width: 70%;
}

.user-message {
    justify-content: flex-end;
    margin-left: auto;
    text-align: right;
}

.message-bubble {
    display: inline-block;
    background-color: #FFFFFF;
    color: var(--text-dark-primary);
    padding: 16px;
    border-radius: 12px;
    font-size: 15px;
    position: relative;
    line-height: 1.6;
    border: 1px solid var(--text-dark-primary);
    box-shadow: 4px 4px 0px var(--text-dark-primary);
}

.bot-message .message-bubble {
    background: #E0E0E0;
    color: #000;
    box-shadow: none;
    border: 1px solid #ccc;
}

.message-meta {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-dark-secondary);
}

.message-meta a {
    color: var(--text-dark-secondary);
    text-decoration: underline;
    margin-left: 12px;
}

.reactions {
    display: inline-flex;
    gap: 8px;
    margin-left: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 8px;
    flex-shrink: 0;
}

.chat-input-area {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color-light);
    flex-shrink: 0;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background-color: #FFFFFF;
    border: 1px solid var(--text-dark-primary);
    border-radius: 12px;
    padding: 8px 8px 8px 16px;
}

.input-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.input-wrapper input {
    flex-grow: 1;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text-dark-primary);
}

.input-wrapper input:focus { outline: none; }

.input-icons {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark-secondary);
}

.input-icons i { padding: 8px; cursor: pointer; }

.send-btn {
    background: none;
    border: none;
    color: var(--text-dark-secondary);
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
}

.sidebar-right {
    background-color: var(--bg-dark-secondary);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.profile-card {
    background-color: var(--bg-dark-primary);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    border: 1px solid var(--border-color-dark);
}

.profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 3px solid var(--bg-dark-secondary);
    object-fit: cover;
}

.profile-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-light-primary);
}

.profile-card p {
    font-size: 14px;
    color: var(--text-light-secondary);
}

.achievements-card {
    background-color: var(--bg-dark-primary);
    border-radius: 12px;
    padding: 24px;
    border: 1px solid var(--border-color-dark);
}

.achievements-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.achievements-card h4 { color: var(--text-light-primary); }
.rocket-icon { width: 24px; height: 24px; }

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.achievement-slot {
    background-color: #333333;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-light-secondary);
}

.achievement-slot.locked { opacity: 0.4; }

.achievement-slot.unlocked {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    animation: bounce 0.5s ease-out;
}

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.mission-card, .shared-photos {
    background: linear-gradient(135deg, #1E3A8A, #3B82F6);
    border-radius: 12px;
    padding: 24px;
}

.shared-photos h5, .mission-card h5 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #FFFFFF;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 5px;
    margin-top: 10px;
}

.photo-grid img {
    width: 100%;
    height: 50px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
}

.mission-card p {
    font-size: 14px;
    color: #E0E7FF;
    line-height: 1.6;
}

.message-bubble .pictogram-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.user-message .message-bubble .pictogram-container {
    border-bottom: 1px solid rgba(229, 231, 235, 1);
}

.pictogram-image {
    height: 60px;
    width: 60px;
    background-color: white;
    border-radius: 6px;
    padding: 2px;
}

.input-icons i.recording {
    color: #EF4444;
    animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.audio-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}

.audio-bubble .play-button { cursor: pointer; font-size: 20px; }

.audio-wave {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 25px;
    width: 100px;
}

.audio-wave span {
    display: block;
    width: 3px;
    background-color: currentColor;
    border-radius: 2px;
}

.bot-text-container {
    display: inline-block;
    vertical-align: middle;
}

.bot-text-container::after {
    content: '█';
    display: inline-block;
    animation: blink 0.7s infinite;
    margin-left: 2px;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.typing-done::after {
    animation: none;
    display: none;
}


/* ---------------------------------- */
/* --- ESTILOS RESPONSIVE --- */
/* ---------------------------------- */

/* --- Estilos para Tablets (hasta 1024px) --- */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 260px 1fr;
    }
    .sidebar-right {
        display: none;
    }
    .chat-area {
        border-radius: 0 12px 12px 0;
    }
}

/* --- Estilos para Móviles (hasta 768px) --- */
@media (max-width: 768px) {
    body {
        overflow: hidden;
    }

    .app-container {
        grid-template-columns: 1fr;
        display: block;
        position: relative;
    }
    
    .chat-header .header-right .fa-solid,
    .chat-header .header-right .fa-regular,
    .chat-header .header-right .switch {
        display: none;
    }

    /* --- ESTILOS DE LOS MENÚS DESPLEGABLES --- */
    .sidebar-left {
        position: fixed; top: 0; left: 0;
        width: 280px; height: 100%;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        border-right: 1px solid var(--border-color-dark);
        overflow-y: auto;
    }
    .sidebar-left.open {
        transform: translateX(0);
    }

    .sidebar-right {
        position: fixed; top: 0; right: 0;
        width: 280px; height: 100%;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
        border-left: 1px solid var(--border-color-dark);
        overflow-y: auto;
        display: flex;
    }
    .sidebar-right.open {
        transform: translateX(0);
    }
    
    .menu-toggle-btn, .profile-toggle-btn, .close-menu-btn {
        display: block;
        background: none;
        border: none;
        color: var(--text-dark-primary);
        font-size: 20px;
        cursor: pointer;
        z-index: 1001;
    }
    
    .profile-toggle-btn {
        display: block;
    }

    .close-menu-btn {
        position: absolute;
        top: 10px;
        right: 20px;
        font-size: 30px;
        color: var(--text-light-secondary);
    }

    .sidebar-right .close-menu-btn {
        color: var(--text-light-secondary);
    }
    
    .menu-overlay {
        position: fixed; top: 0; left: 0;
        width: 100%; height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease-in-out;
    }

    .menu-overlay.active {
        opacity: 1;
        pointer-events: all;
    }

    .chat-area {
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .chat-message { max-width: 85%; }
    .message-bubble { padding: 12px; font-size: 14px; }
    .avatar { width: 32px; height: 32px; }
    .chat-input-area { padding: 10px 15px; }
}