/* =======================================================
   ESTILO COHERENTE: TEAL & GOLD (Daniel Marcos Style)
   ======================================================= */

:root {
    --chem-teal: #006d77;
    --chem-gold: #e29578;
    --text-main: #333333;
    --sidebar-w: 300px;
    --bg-page: #ffffff;
    --bg-card: #fdfdfd;
    --bg-toolbar: #f8f9fa;
    --border: #eeeeee;
}

body.dark-mode {
    --bg-page: #0a0a0a;
    --bg-card: #161616;
    --bg-toolbar: #1f1f1f;
    --text-main: #f0f0f0;
    --border: #333333;
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0; height: 100%;
    background-color: var(--bg-page);
    transition: background-color 0.3s ease;
}

body {
    font-family: 'Roboto', sans-serif;
    color: var(--text-main);
}

#main-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* --- SIDEBAR (Forzado vertical) --- */
#sidebar {
    width: var(--sidebar-w);
    min-width: var(--sidebar-w);
    height: 100%;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header { padding: 3rem 1.5rem 1.5rem; border-bottom: 1px solid var(--border); }
.sidebar-header h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.6rem; color: var(--chem-teal); margin: 0;
}
.tagline { margin: 5px 0 15px; font-size: 0.75rem; text-transform: uppercase; color: var(--chem-gold); font-weight: bold; letter-spacing: 1px; }

#sidebar-search {
    width: 100%; padding: 10px; background: var(--bg-toolbar); border: 1px solid var(--border);
    border-radius: 6px; outline: none; color: var(--text-main);
}

/* ANOTACIÓN: El contenedor del menú ahora fuerza lista vertical */
#menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
}

#menu a {
    display: block;
    width: 100%;
    padding: 12px 25px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    text-align: left;
}

#menu a:hover { color: var(--chem-teal); background: var(--bg-toolbar); }
#menu a.active { font-weight: bold; color: var(--chem-teal); background: rgba(0, 109, 119, 0.08); border-right: 4px solid var(--chem-teal); }

.folder-link.level-0 { font-family: 'Montserrat', sans-serif; text-transform: uppercase; font-size: 0.8rem; padding-top: 20px !important; color: var(--chem-teal) !important; }
.submenu { padding-left: 0; border-left: 2px solid #f1f3f5; margin-left: 25px; display: flex; flex-direction: column; }

.sidebar-footer { padding: 1.5rem; border-top: 1px solid var(--border); text-align: center; font-size: 0.8rem; }
.sidebar-footer a { color: var(--chem-teal); text-decoration: none; font-weight: bold; }

/* --- CONTENIDO --- */
#main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container-inner { max-width: 900px; width: 100%; }

.molecule-card { width: 100%; background-color: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 2rem; margin-bottom: 2rem; }
.mol-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--chem-teal); margin-bottom: 1.5rem; padding-bottom: 10px; }
.mol-header h2 { font-family: 'Montserrat', sans-serif; margin: 0; color: var(--chem-teal); font-size: 2rem; }
.mol-badge { background: var(--chem-gold); color: white; padding: 4px 12px; border-radius: 20px; font-size: 0.7rem; font-weight: bold; }

.jsmol-box { width: 100% !important; height: 500px !important; border-radius: 12px; border: 1px solid #ddd; background: #fff; box-shadow: 0 10px 30px rgba(0,0,0,0.05); }

/* --- TOOLBAR --- */
.toolbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 2rem; padding: 1.2rem; background: var(--bg-toolbar);
    border: 1px solid var(--border); border-radius: 10px; gap: 15px; flex-wrap: wrap;
}
.btn-outline {
    background: transparent; border: 1px solid var(--chem-teal); color: var(--chem-teal);
    padding: 8px 14px; border-radius: 6px; font-size: 0.75rem; text-transform: uppercase; font-weight: bold; cursor: pointer;
}
.btn-outline:hover { color: var(--chem-gold); border-color: var(--chem-gold); background: rgba(226,149,120,0.05); }
.btn-solid { background: var(--chem-teal); color: white; border: none; padding: 10px 18px; border-radius: 6px; font-weight: bold; cursor: pointer; }

.sci-panel { margin-top: 3rem; padding: 1.5rem; background: #fbfbfb; border-radius: 8px; border: 1px solid var(--border); }
body.dark-mode .sci-panel { background: #1a1a1a; }
.pro-tip { color: var(--chem-gold); font-weight: bold; font-size: 0.8rem; margin-bottom: 10px; text-transform: uppercase; }

/* --- ATOM LEGEND --- */
.atom-legend { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 20px; justify-content: center; border-top: 1px solid var(--border); padding-top: 15px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 500; }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* --- HOME PAGE & CITATION --- */
.home-hero { text-align: center; }
.home-hero h1 { font-family: 'Montserrat', sans-serif; font-size: 3.2rem; color: var(--chem-teal); }
.lead { font-size: 1.3rem; color: #666; margin-bottom: 3rem; line-height: 1.6; }

.oracle-card { background: var(--chem-teal); color: white; padding: 3rem 2rem; border-radius: 20px; margin: 4rem 0; text-align: center; }
.oracle-card p { font-family: 'Montserrat', sans-serif; font-style: italic; font-size: 1.5rem; margin: 25px 0; color: white !important; }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.4); color: white; padding: 12px 24px; border-radius: 6px; cursor: pointer; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 5rem; text-align: left; }
.info-item h3 { border-bottom: 2px solid var(--chem-gold); display: inline-block; padding-bottom: 5px; }

.citation-box { margin-top: 5rem; padding: 2rem; background: var(--bg-toolbar); border-radius: 12px; text-align: left; border: 1px dashed var(--chem-teal); }
.citation-box h3 { color: var(--chem-teal); font-size: 1.1rem; margin-top: 0; }
.citation-box p { font-size: 0.95rem; line-height: 1.6; font-family: 'Roboto', sans-serif; }

/* --- THEME SWITCH --- */
.theme-switch-wrapper { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.theme-switch { display: inline-block; height: 18px; width: 34px; position: relative; }
.theme-switch input { display:none; }
.slider { background-color: #ccc; position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; transition: .4s; border-radius: 34px; }
.slider:before { background-color: #fff; content: ""; height: 12px; width: 12px; left: 3px; bottom: 3px; position: absolute; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--chem-teal); }
input:checked + .slider:before { transform: translateX(16px); }
#theme-text { font-size: 0.65rem; font-weight: bold; color: #999; text-transform: uppercase; }

/* --- MOBILE --- */
.mobile-toggle { display: none; position: fixed; top: 15px; left: 15px; z-index: 1100; background: var(--chem-teal); color: white; border: none; padding: 10px; border-radius: 4px; }

@media (max-width: 768px) {
    #sidebar { position: fixed; left: -300px; z-index: 1000; width: 280px; transition: 0.3s; }
    #sidebar.show { left: 0; }
    .mobile-toggle { display: block; }
    #main-content { padding: 5rem 1rem 2rem; }
    .info-grid { grid-template-columns: 1fr; }
}

#menu a.active {
    background: rgba(0, 109, 119, 0.1) !important;
    border-left: 4px solid var(--chem-gold) !important; /* Cambiamos el Teal por Gold para que destaque */
    color: var(--chem-teal) !important;
    font-weight: 700 !important;
}

/* 1. Ampliamos el ancho máximo para dar aire a los botones */
.container-inner {
    max-width: 1150px; /* Subimos de 900px a 1150px */
    width: 95%;
}

/* 2. Compactamos la toolbar */
.toolbar {
    display: flex;
    justify-content: space-between; /* Distribuye grupos a los extremos */
    align-items: center;
    gap: 10px; /* Espacio reducido entre grupos */
    padding: 0.8rem 1rem; /* Menos relleno vertical */
    flex-wrap: nowrap; /* Evitamos que salte de línea en escritorio */
    overflow-x: auto; /* Si la pantalla es muy pequeña, permite scroll horizontal en la barra */
}

/* 3. Botones más compactos */
.btn-outline, .btn-solid {
    padding: 6px 12px; /* Reducimos el padding ligeramente */
    font-size: 0.8rem;
    white-space: nowrap; /* Evita que el texto del botón se rompa */
}

/* 4. Checkboxes más juntos */
.tool-group.checkboxes {
    gap: 12px;
    background: rgba(0, 109, 119, 0.03); /* Un toque de color de fondo muy sutil */
    padding: 5px 10px;
    border-radius: 6px;
}

.check-container {
    font-size: 0.75rem; /* Letra un poco más pequeña para los toggles */
}
