/* ===== MEJORAS INSPIRADAS EN OBSIDIAN ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Mejora: Tipografía más moderna y legible, similar a la de Obsidian */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

body {
    height: 100vh;
    background: #1e1e1e; /* Fondo base sólido */
    color: #e4e4e4;
}

/* APP LAYOUT */
.app {
    display: flex;
    height: 100vh;
}

/* ===== SIDEBAR (CUADERNO) ===== */
.sidebar {
    width: 240px; /* Un poco más ancho para dar más espacio */
    background: #181818; /* Un tono ligeramente más oscuro y rico */
    padding: 16px 12px; /* Padding más generoso */
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-right: 1px solid #2a2a2a;
}

.logo {
    font-size: 18px;
    font-weight: 600; /* Un peso de fuente más definido */
    letter-spacing: -0.02em; /* Ajuste sutil para un look más moderno */
    padding-left: 4px;
    color: #ffffff;
}

/* Mejora: Botón "Nuevo Cuaderno" con estilo más cuidado */
#new-notebook {
    background: transparent; /* Fondo transparente por defecto */
    border: 1px solid #3a3a3a; /* Borde sutil en lugar de fondo sólido */
    color: #e4e4e4;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 6px; /* Bordes ligeramente más redondeados */
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    transition: all 0.15s ease; /* Transición suave para el hover */
}

#new-notebook:hover {
    background: #2a2a2a; /* Fondo sutil al hacer hover */
    border-color: #4a4a4a; /* Borde un poco más claro */
}

#new-notebook::before {
    content: "+ "; /* Un pequeño indicador visual */
    font-weight: 600;
    margin-right: 4px;
}

.hidden {
    display: none;
}

.notebook-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #202020;
    border: 1px solid #2f2f2f;
    border-radius: 10px;
}

#notebook-name-input {
    width: 100%;
    background: #111111;
    border: 1px solid #333333;
    border-radius: 8px;
    color: #f1f1f1;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

#notebook-name-input:focus {
    border-color: #6b9bff;
    box-shadow: 0 0 0 3px rgba(107, 155, 255, 0.15);
}

.notebook-form-actions {
    display: flex;
    gap: 8px;
}

#save-notebook,
#cancel-notebook {
    flex: 1;
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

#save-notebook {
    background: #6b9bff;
    color: #ffffff;
}

#save-notebook:hover {
    background: #5a82e0;
}

#cancel-notebook {
    background: #2b2b2b;
    color: #d4d4d4;
}

#cancel-notebook:hover {
    background: #363636;
}

#notebook-list {
    list-style: none;
    margin-top: -5px; /* Ajuste fino de espaciado */
}

.sidebar-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
}

.sidebar-actions .ghost-button {
    flex: 1;
}

/* Mejora: Items de la lista con padding más generoso y bordes redondeados */
#notebook-list li {
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #b0b0b0; /* Color ligeramente más tenue para los inactivos */
    transition: background 0.1s ease;
    margin-bottom: 2px;
}

#notebook-list li:hover {
    background: #2a2a2a;
    color: #ffffff; /* Texto más brillante al hacer hover */
}

#notebook-list li:focus-visible,
#note-list li:focus-visible {
    outline: 2px solid #6b9bff;
    outline-offset: 2px;
}

/* Mejora: Indicador visual para el cuaderno activo (simulado, necesitarías JS para cambiarlo dinámicamente) */
#notebook-list li.active {
    background: #2e2e2e;
    color: #ffffff;
    font-weight: 500;
    border-left: 2px solid #6b9bff; /* Un toque de color (el azul característico de Obsidian) */
}

/* ===== PANEL DE NOTAS ===== */
.notes-panel {
    width: 260px; /* Un poco más ancho */
    background: #1e1e1e; /* Fondo continuo con el body, pero diferenciado por bordes */
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Alinear verticalmente */
    padding: 16px 14px;
    border-bottom: 1px solid #2a2a2a;
}

.notes-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ghost-button {
    background: transparent;
    border: 1px solid #3a3a3a;
    color: #cfcfcf;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ghost-button:hover {
    background: #2a2a2a;
    color: #ffffff;
}

.ghost-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.notes-search {
    padding: 12px 14px 0;
}

#note-search {
    width: 100%;
    background: #181818;
    border: 1px solid #323232;
    border-radius: 8px;
    color: #f0f0f0;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
}

#note-search:focus {
    border-color: #6b9bff;
    box-shadow: 0 0 0 3px rgba(107, 155, 255, 0.15);
}

#note-search::placeholder {
    color: #7a7a7a;
}

/* Mejora: Botón "Nueva Nota" con estilo refinado */
#new-note {
    background: #6b9bff; /* Un azul vibrante pero no estridente, como en Obsidian */
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* Sombra sutil para dar profundidad */
}

#new-note:hover {
    background: #5a82e0; /* Oscurecer ligeramente en hover */
}

/* Si no existe el botón en tu HTML, podrías tener un span con texto, pero mejor tener un <button> */
.notes-header span { /* Asumiendo que es el título "Notas" */
    font-size: 14px;
    font-weight: 500;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#note-list {
    list-style: none;
    padding: 12px 10px;
    overflow-y: auto; /* Por si hay muchas notas */
}

.empty-state {
    margin: 12px 14px 16px;
    padding: 14px 14px 16px;
    border: 1px solid #2f2f2f;
    border-radius: 10px;
    background: #181818;
}

.empty-state-title {
    color: #f2f2f2;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
}

.empty-state-message {
    color: #8f8f8f;
    font-size: 13px;
    line-height: 1.5;
}

/* Mejora: Items de la lista de notas más espaciados y con mejor feedback visual */
#note-list li {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 4px;
    border-left: 2px solid transparent; /* Reservar espacio para el borde de activo */
    transition: background 0.1s ease;
    color: #d4d4d4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Para títulos largos */
}

#note-list li:hover {
    background: #2a2a2a;
}

/* Mejora: Nota activa en el panel */
#note-list li.active {
    background: #2e2e2e;
    border-left-color: #6b9bff; /* El mismo azul para consistencia */
    color: #ffffff;
    font-weight: 500;
}

/* ===== EDITOR ===== */
.editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 40px 50px; /* Padding más generoso para una experiencia de escritura cómoda */
    background: #1e1e1e;
    max-width: 900px; /* Un ancho máximo para que las líneas no sean infinitamente largas (mejor legibilidad) */
    margin: 0 auto; /* Centrar el editor si hay espacio extra */
    width: 100%;
}

#note-title {
    font-size: 32px; /* Un poco más grande para dar énfasis */
    font-weight: 600;
    background: none;
    border: none;
    color: #ffffff;
    margin-bottom: 20px;
    outline: none;
    padding: 5px 0; /* Pequeño padding para área de click */
    letter-spacing: -0.02em;
}

#note-title::placeholder {
    color: #555; /* Placeholder más visible pero tenue */
    font-weight: 400;
}

#note-content {
    flex: 1;
    background: none;
    border: none;
    color: #d4d4d4;
    font-size: 16px;
    line-height: 1.7; /* Un poco más de altura de línea para mejor lectura */
    resize: none;
    outline: none;
    padding: 5px 0;
    font-family: 'Inter', 'Segoe UI', monospace; /* Una fuente mono para el contenido? O la misma Inter. Depende del gusto. */
}

#note-content::placeholder {
    color: #555;
}

/* Pequeño detalle: scrollbar más estilizado (opcional, para navegadores webkit) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e1e1e;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}

#note-list li.active {
    background-color: #2f3542;
    color: white;
}

@media (max-width: 900px) {
    .app {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .sidebar,
    .notes-panel {
        width: 100%;
        border-right: none;
    }

    .sidebar {
        border-bottom: 1px solid #2a2a2a;
    }

    .notes-panel {
        border-bottom: 1px solid #2a2a2a;
    }

    .editor {
        padding: 24px 20px;
        max-width: none;
    }
}
