:root {
    --bg-app: #4D4D4D;
    --sidebar-bg: #1F1F1F;
    --card-bg: #EAEAEA;
    --yellow-main: #FFCC00;
    --yellow-hover: #E5B800;
    --text-dark: #222222;
    --text-light: #F0F0F0;
    --border-bevel: #2E2E2E;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-app);
    height: 100vh;
    overflow: hidden;
}

.fnote-app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR IZQUIERDA */
.sidebar {
    width: 320px;
    min-width: 300px;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: 4px 0 15px rgba(0,0,0,0.4);
    z-index: 10;
}

.sidebar-header {
    margin-bottom: 20px;
    text-align: center;
}

.logo-desktop { max-width: 100%; height: auto; }
.logo-mobile { display: none; }

.sidebar-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

/* BOTONES 3D / SKEUOMÓRFICOS */
.btn-3d {
    flex: 1;
    padding: 10px 14px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    text-align: center;
    transition: transform 0.05s ease, box-shadow 0.05s ease;
}

.btn-yellow {
    background: linear-gradient(180deg, #FFDD33 0%, #FFCC00 100%);
    color: #111;
    box-shadow: 0 4px 0 #B28F00, 0 6px 10px rgba(0,0,0,0.3);
}

.btn-yellow:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #B28F00, 0 2px 5px rgba(0,0,0,0.3);
}

.btn-dark {
    background: linear-gradient(180deg, #3A3A3A 0%, #2A2A2A 100%);
    color: var(--yellow-main);
    box-shadow: 0 4px 0 #181818, 0 6px 10px rgba(0,0,0,0.5);
}

.btn-dark:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 #181818, 0 2px 5px rgba(0,0,0,0.5);
}

/* BUSCADOR */
.search-box input {
    width: 100%;
    padding: 10px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #FFF;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
    outline: none;
    margin-bottom: 16px;
}

.tree-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.folder-item {
    margin-bottom: 6px;
}

.folder-title {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #DDD;
    background: #252525;
    border: 1px solid #333;
    user-select: none;
}

.folder-title:hover {
    background: #333;
    color: var(--yellow-main);
}

.folder-item.active-folder > .folder-title {
    border-color: var(--yellow-main);
    color: var(--yellow-main);
}

.notes-sublist {
    margin-left: 14px;
    padding-left: 8px;
    border-left: 2px solid #333;
    display: none;
    margin-top: 4px;
}

.notes-sublist.open {
    display: block;
}

.note-item {
    padding: 6px 8px;
    margin: 2px 0;
    cursor: pointer;
    border-radius: 4px;
    color: #AAA;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item:hover {
    background: #2A2A2A;
    color: #FFF;
}

.note-item.active {
    background: #383838;
    color: var(--yellow-main);
    font-weight: bold;
    box-shadow: inset 2px 0 0 var(--yellow-main);
}

.tree-empty-msg {
    color: #888;
    font-size: 13px;
    padding: 12px;
    text-align: center;
}

/* PIE DEL SIDEBAR / CIERRE DE SESIÓN */
.sidebar-footer {
    padding-top: 15px;
    border-top: 1px solid #2A2A2A;
    margin-top: 10px;
}

.btn-logout {
    display: block;
    text-align: center;
    color: #AAA;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px;
    border-radius: 6px;
    background: #181818;
    border: 1px solid #282828;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    color: #FF5555;
    border-color: #662222;
    background: #251818;
}

/* PANEL DERECHO - EDITOR */
.editor-pane {
    flex: 1;
    padding: 24px;
    overflow: hidden;
}

.editor-card {
    background: var(--card-bg);
    height: 100%;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.8);
}

.note-meta-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.notebook-select-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notebook-select-group label {
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.select-3d {
    background: #FFF;
    border: 1px solid #BBB;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #222;
    box-shadow: 0 2px 0 #BBB;
    outline: none;
    cursor: pointer;
}

.select-3d:focus {
    border-color: var(--yellow-main);
}

.tags-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tags-label {
    font-size: 13px;
    font-weight: bold;
    color: #444;
}

.tag-badge {
    background: #DDD;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 0 #BBB;
    cursor: pointer;
}

.btn-3d-tag {
    background: #333;
    color: #FFF;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 2px 0 #111;
}

.note-header {
    margin-bottom: 12px;
}

#nota-titulo {
    font-size: 22px;
    font-weight: bold;
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    color: var(--text-dark);
    padding: 4px 0;
}

.markdown-toolbar {
    background: #DDD;
    padding: 6px 10px;
    border-radius: 8px;
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.markdown-toolbar button {
    background: #FFF;
    border: 1px solid #CCC;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.editor-body {
    flex: 1;
    display: flex;
    position: relative;
}

#nota-contenido, .markdown-preview {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    background: #FFF;
    border-radius: 8px;
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    resize: none;
    overflow-y: auto;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.hidden { display: none !important; }

.editor-footer {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-buttons {
    display: flex;
    gap: 12px;
}

.file-upload-label {
    display: inline-block;
    cursor: pointer;
}

.attachments-section {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    min-height: 38px;
}

.attachments-title {
    font-weight: bold;
    color: #444;
}

.attachments-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* TARJETA DE ADJUNTO CON INDICADOR VISIBLE */
.attachment-badge {
    background: #FFF;
    padding: 5px 10px;
    border-radius: 6px;
    border: 1px solid #BBB;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    box-shadow: 0 2px 0 #CCC;
}

.att-actions {
    display: flex;
    gap: 6px;
}

.btn-att-action {
    background: #EAEAEA;
    color: #222;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    border: 1px solid #CCC;
    cursor: pointer;
}

.btn-att-action:hover {
    background: #DDD;
}

.btn-att-delete {
    color: #B00000;
    background: #FFF0F0;
    border-color: #F5B2B2;
}

.btn-att-delete:hover {
    background: #FFD4D4;
    border-color: #D00000;
}

/* RESPONSIVE MÓVIL */
@media (max-width: 800px) {
    .fnote-app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; max-height: 45vh; }
    .logo-desktop { display: none; }
    .logo-mobile { display: block; max-height: 40px; margin: 0 auto; }
    .editor-pane { padding: 10px; flex: 1; }
    .editor-card { padding: 12px; }
}

/* VISTA DE ACCESO / LOGIN */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-card {
    background: var(--sidebar-bg);
    border: 1px solid #333;
    border-radius: 16px;
    padding: 32px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.7);
    text-align: center;
}

.login-logo {
    max-width: 160px;
    height: auto;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    color: #AAA;
    font-size: 13px;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    color: #FFF;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
    outline: none;
    font-size: 14px;
}

.form-control:focus {
    border-color: var(--yellow-main);
}

.login-error {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid #dc3545;
    color: #ff6b6b;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

.btn-block {
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    font-size: 15px;
}