/* ============================================================
   AnonymousBlogger — Dev/IDE theme
   Cargado DESPUÉS de style.css para sobreescribir el template base
   ============================================================ */

:root {
    --bg: #14161c;
    --bg-elevated: #1c1f27;
    --bg-elevated-2: #22262f;
    --border: #2a2e38;
    --border-soft: #22252d;
    --text: #d8dee9;
    --text-dim: #7b8394;
    --text-faint: #4b5262;
    --accent-amber: #e3b341;
    --accent-cyan: #56d4dd;
    --accent-magenta: #ff6b9d;
    --accent-green: #7ee787;
    --accent-orange: #ff9d5c;
    --accent-red: #ff7b72;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    --font-body: 'Inter', -apple-system, 'Segoe UI', sans-serif;
    --radius: 6px;
    /* Acento "activo": cada página lo redefine (ver .page-home / .page-post / .page-admin) */
    --accent: var(--accent-cyan);
}

/* Acento por tipo de página, inspirado en el tema Beep de WordPress.com:
   verde en el home, naranja en el post individual, cian en admin/formularios */
body.page-home { --accent: var(--accent-green); }
body.page-post { --accent: var(--accent-orange); }
body.page-admin, body.page-form { --accent: var(--accent-cyan); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

html, body {
    background: var(--bg) !important;
    color: var(--text) !important;
    font-family: var(--font-body);
    overflow-x: hidden; /* red de seguridad: nunca debería haber scroll horizontal */
    max-width: 100vw;
}

body {
    background-image:
        radial-gradient(circle at 15% 0%, rgba(86, 212, 221, 0.06), transparent 45%),
        radial-gradient(circle at 85% 20%, rgba(227, 179, 65, 0.05), transparent 40%);
    background-attachment: fixed;
}

::selection {
    background: var(--accent-amber);
    color: #14161c;
}

a { color: var(--accent-cyan); text-decoration: none; }
a:hover { color: var(--accent-amber); }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-mono);
    color: var(--text);
    letter-spacing: -0.01em;
}

/* ============ Barra tipo editor (elemento firma) ============ */
/* #header.devbar (ID + clase) para ganarle en especificidad a #header { background:#fff } de style.css */
#header.devbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    height: 56px;
    padding: 0;
}

.devbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 20px;
}

.devbar-dots { display: flex; gap: 6px; flex-shrink: 0; }
.devbar-dots span {
    width: 11px; height: 11px; border-radius: 50%;
    background: var(--border);
}
.devbar-dots span:nth-child(1) { background: #ff5f56; opacity: .55; }
.devbar-dots span:nth-child(2) { background: #ffbd2e; opacity: .55; }
.devbar-dots span:nth-child(3) { background: #27c93f; opacity: .55; }

.devbar-path {
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.devbar-path a { color: var(--text-dim); }
.devbar-path a:hover { color: var(--accent-cyan); }
.devbar-sep { margin: 0 4px; color: var(--text-faint); }
.devbar-current { color: var(--accent); }

.devbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ============ Botones estilo terminal ============ */
.btn, .footer-newsletter.btn, input.footer-newsletter, button.footer-newsletter {
    font-family: var(--font-mono) !important;
    font-size: 13px !important;
    border-radius: var(--radius) !important;
    border: 1px solid var(--border) !important;
    background: var(--bg-elevated-2) !important;
    color: var(--text) !important;
    padding: 6px 14px !important;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.btn:hover { border-color: var(--accent-cyan) !important; color: var(--accent-cyan) !important; }

.btn-success, input.btn-success {
    border-color: rgba(126, 231, 135, 0.35) !important;
    color: var(--accent-green) !important;
}
.btn-success:hover { background: rgba(126, 231, 135, 0.1) !important; border-color: var(--accent-green) !important; }

.btn-danger, input.btn-danger {
    border-color: rgba(255, 123, 114, 0.35) !important;
    color: var(--accent-red) !important;
}
.btn-danger:hover { background: rgba(255, 123, 114, 0.1) !important; border-color: var(--accent-red) !important; }

.btn-warning {
    border-color: rgba(227, 179, 65, 0.35) !important;
    color: var(--accent-amber) !important;
    background: var(--bg-elevated-2) !important;
}
.btn-warning:hover { background: rgba(227, 179, 65, 0.1) !important; }

.btn-outline-primary { color: var(--accent-cyan) !important; border-color: var(--accent-cyan) !important; }
.btn-outline-danger { color: var(--accent-red) !important; border-color: var(--accent-red) !important; }
.btn-primary { background: var(--accent-cyan) !important; border-color: var(--accent-cyan) !important; color: #14161c !important; font-weight: 600; }

/* ============ Home: listado de posts como explorador de archivos ============ */
#main { padding-top: 56px; background: var(--bg); }
#main.app-main { padding-top: 32px; }

/* ============ App shell: sidebar + contenido, estilo garry.net ============ */
.app-shell { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar-toggle-btn { display: none; } /* solo se muestra en móvil, ver media query */
.sidebar-backdrop { display: none; }

.sidebar-nav {
    width: 240px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: var(--bg);
}
.sidebar-nav-inner { padding: 28px 22px; }

.sidebar-nav-brand {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    margin-bottom: 22px;
}

.sidebar-nav-links { margin-bottom: 26px; }
.sidebar-nav-links a {
    display: block;
    font-family: var(--font-mono);
    font-size: 14px;
    color: var(--text-dim);
    padding: 7px 10px;
    border-radius: var(--radius);
    margin-bottom: 2px;
}
.sidebar-nav-links a:hover { background: var(--bg-elevated); color: var(--text); }
.sidebar-nav-links a.active { background: var(--bg-elevated-2); color: var(--text); font-weight: 600; }

.sidebar-nav-section { margin-bottom: 26px; }
.sidebar-nav-section-title {
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
    margin-bottom: 8px;
    padding: 0 10px;
}
.sidebar-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    padding: 6px 10px;
    border-radius: var(--radius);
}
.sidebar-nav-item:hover { background: var(--bg-elevated); color: var(--text); }
.sidebar-nav-item .ext { color: var(--text-faint); font-size: 11px; }

.subscribe-form { display: flex; gap: 6px; padding: 0 10px; }
.subscribe-form input {
    flex: 1;
    min-width: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    border-radius: var(--radius);
    padding: 6px 8px;
}
.subscribe-form input:focus { outline: none; border-color: var(--accent); }
.subscribe-form button {
    background: var(--bg-elevated-2);
    border: 1px solid var(--border);
    color: var(--accent);
    border-radius: var(--radius);
    padding: 6px 10px;
    font-family: var(--font-mono);
    cursor: pointer;
}
.subscribe-form button:hover { border-color: var(--accent); }
.subscribe-msg { font-size: 12px; padding: 0 10px; font-family: var(--font-mono); }
.subscribe-ok { color: var(--accent-green); }
.subscribe-err { color: var(--accent-red); }

/* ============ Listado de posts estilo terminal (Beep) ============ */
.terminal-list { border-top: 1px solid var(--border-soft); }
.terminal-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--border-soft);
    font-family: var(--font-mono);
    transition: padding-left .12s ease, background .12s ease;
}
.terminal-list-row:hover { padding-left: 10px; background: var(--bg-elevated); }
.terminal-list-thumb {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.terminal-list-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.terminal-list-title {
    flex: 1;
    min-width: 0;
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.terminal-list-date {
    color: var(--text-faint);
    font-size: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}

section#blog { background: var(--bg); padding-top: 60px; }

.entries { padding: 0; }

.intro-text {
    font-size: 15px;
    color: var(--text-dim);
    max-width: 60ch;
    line-height: 1.7;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-soft);
}

.entry {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-soft);
    border-radius: 0;
    padding: 20px 0;
    margin-bottom: 0;
    transition: padding-left .15s ease;
}
.entry:first-child { padding-top: 0; }
.entry:hover { padding-left: 6px; }

.entry-img { display: none; } /* la lista del home no necesita imagen grande, va tipo archivo */

.entry-title {
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 6px 0;
}
.entry-title a::before {
    content: "📄 ";
    filter: grayscale(1) brightness(1.3);
    margin-right: 2px;
    font-size: 15px;
}
.entry-title a {
    color: var(--text) !important;
}
.entry-title a::after {
    content: ".md";
    color: var(--text-faint);
    font-weight: 400;
}
.entry-title a:hover { color: var(--accent) !important; }

.entry-meta ul { display: flex; gap: 16px; list-style: none; padding: 0; margin: 0 0 10px 0; }
.entry-meta li {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-dim) !important;
}
.entry-meta a { color: var(--text-dim) !important; }
.entry-meta i { color: var(--text-faint) !important; margin-right: 4px; }

.entry-content p { color: var(--text-dim) !important; font-size: 14.5px; line-height: 1.7; margin-bottom: 8px; }
.read-more a {
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--accent-cyan) !important;
}
.read-more a::before { content: "→ "; }

/* ============ Sidebar ============ */
.sidebar {
    background: transparent !important;
    border: none;
    border-left: 1px solid var(--border);
    border-radius: 0;
    padding: 4px 0 4px 20px;
    box-shadow: none !important;
}
.sidebar-title {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--accent) !important;
    text-transform: none;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 14px;
}
.sidebar-title::before { content: "// "; color: var(--text-faint); }
.post-item { border-bottom: 1px solid var(--border-soft); padding-bottom: 10px; margin-bottom: 10px; }
.post-item img { border-radius: 4px; }
.post-item h4 a {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text) !important;
}
.post-item time { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint) !important; }

/* ============ Post individual: archivo abierto en el editor ============ */
.breadcrumbs { background: transparent; padding-top: 76px; }
.breadcrumbs h2 {
    font-size: 26px;
    padding-left: 52px;
    border-left: 3px solid var(--accent);
    line-height: 1.4;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim) !important;
    text-decoration: none !important;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 20px;
    white-space: nowrap;
}
.back-link:hover { color: var(--accent) !important; border-color: var(--accent); }

.entry-single {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 30px 36px;
    position: relative;
}
.entry-single .entry-content {
    font-family: var(--font-body);
    color: var(--text) !important;
    counter-reset: line;
}
.entry-single .entry-content p {
    position: relative;
    line-height: 1.85;
    font-size: 16px;
    color: var(--text) !important;
}

.entry-single .entry-title { font-size: 22px; }
.entry-single .entry-img {
    display: block;
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    width: 500px;
    max-width: 100%;
    aspect-ratio: 1 / 1;
}
.entry-single .entry-img img { width: 100%; height: 100%; display: block; object-fit: cover; }

/* ============ Galería estilo Twitter (1 a 4 imágenes) ============
   Tamaño fijo 500x500 (se achica en pantallas angostas, nunca crece más de eso). */
.img-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    width: 100%;
    max-width: 500px;
}
.img-grid.count-1 { grid-template-columns: 1fr; }

.img-grid-item {
    overflow: hidden;
    background: var(--bg-elevated-2);
    cursor: pointer;
    position: relative;
    aspect-ratio: 1 / 1;
    min-width: 0;
}
.img-grid.count-1 .img-grid-item { aspect-ratio: 1 / 1; }
.img-grid-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.img-grid-item:hover { opacity: .92; }

/* ============ Visor de imágenes (lightbox), estilo Twitter ============ */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(10, 11, 14, .96);
    align-items: center;
    justify-content: center;
}
.lightbox-overlay.open { display: flex; }
.lightbox-overlay img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 4px;
}
.lightbox-close {
    position: absolute;
    top: 18px; right: 22px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.16); }
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px; height: 46px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    display: flex;
}
.lightbox-nav:hover { background: rgba(255,255,255,.16); }
.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-dim);
    background: rgba(255,255,255,.06);
    padding: 4px 12px;
    border-radius: 20px;
}

@media (max-width: 600px) {
    .lightbox-nav { width: 38px; height: 38px; font-size: 20px; }
    .lightbox-close { width: 34px; height: 34px; top: 10px; right: 10px; }
}

/* ============ Embed de Spotify ============ */
.spotify-embed { margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; }
.spotify-embed iframe { display: block; border-radius: var(--radius); }


.tags { list-style: none; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.tags li a, .cats li a {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--accent-magenta) !important;
    background: rgba(255, 107, 157, 0.08);
    border: 1px solid rgba(255, 107, 157, 0.25);
    border-radius: 20px;
    padding: 3px 10px;
}
.entry-footer i { color: var(--text-faint) !important; margin-right: 6px; }

.blog-author {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-top: 18px;
}
.blog-author h4 { font-size: 15px; color: var(--text) !important; }
.blog-author p { color: var(--text-dim) !important; font-size: 14px; }
.social-links a { color: var(--text-dim); margin-right: 10px; }
.social-links a:hover { color: var(--accent-cyan); }

/* ============ Comentarios ============ */
.comments-section { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--border); }
.comments-title {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--accent) !important;
    margin-bottom: 16px;
}
.comment-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border-soft);
}
.comment-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.comment-name { font-family: var(--font-mono); font-size: 13px; color: var(--text); font-weight: 600; }
.comment-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.comment-delete-form { margin-left: auto; }
.comment-delete-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 13px;
}
.comment-delete-btn:hover { color: var(--accent-red); }
.comment-text { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 0; }
.comments-empty { color: var(--text-faint); font-size: 13px; font-style: italic; }

.comment-form { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; max-width: 480px; }
.comment-honeypot {
    /* campo trampa: oculto para humanos, visible para bots que llenan todos los campos */
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ============ Formularios (login, new, edit) ============ */
.reply-form, .container form {
    color: var(--text);
}
.form-control, textarea.form-control, input.form-control {
    background: var(--bg-elevated) !important;
    border: 1px solid var(--border) !important;
    color: var(--text) !important;
    font-family: var(--font-mono) !important;
    font-size: 14px !important;
    border-radius: var(--radius) !important;
}
.form-control:focus {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 0 2px rgba(86, 212, 221, 0.15) !important;
    background: var(--bg-elevated) !important;
    color: var(--text) !important;
}
.form-control::placeholder { color: var(--text-faint) !important; }

.alert-danger {
    background: rgba(255, 123, 114, 0.1) !important;
    border: 1px solid rgba(255, 123, 114, 0.35) !important;
    color: var(--accent-red) !important;
    font-family: var(--font-mono);
    font-size: 13px;
    border-radius: var(--radius) !important;
}

/* ============ Panel de Admin ============ */
.table {
    background: var(--bg-elevated) !important;
    color: var(--text) !important;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table thead {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-amber);
    text-transform: lowercase;
    border-bottom: 1px solid var(--border) !important;
}
.table th, .table td {
    border-color: var(--border-soft) !important;
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--bg-elevated-2) !important; }
.table a { color: var(--text); font-family: var(--font-mono); font-size: 14px; }
.table a:hover { color: var(--accent-cyan); }

/* ============ Footer ============ */
footer#footer {
    background: var(--bg-elevated) !important;
    border-top: 1px solid var(--border);
}
footer .copyright {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-faint) !important;
}
footer .copyright strong span { color: var(--text-dim) !important; }

/* Bootstrap trae .text-black; en el theme oscuro lo reasignamos al texto normal */
.text-black { color: var(--text) !important; }

@media (max-width: 768px) {
    .entry-single { padding: 22px 18px; }

    /* Devbar: la ruta se encoge/trunca primero, los botones (funcionales) no se sacrifican */
    .devbar-inner { gap: 10px; padding: 0 12px; }
    .devbar-path { font-size: 12px; flex-shrink: 1; min-width: 0; }
    .devbar-actions { flex-shrink: 0; gap: 6px; }
    .devbar-actions .btn { padding: 5px 10px !important; font-size: 12px !important; }

    .entry { padding: 16px 16px; }
    .entry-title { font-size: 15px; }

    .breadcrumbs h2 { font-size: 20px; padding-left: 30px; }

    /* Tabla del admin: scroll horizontal en vez de romper el layout */
    .table { min-width: 600px; }

    /* Sidebar: en móvil ya no se apila, se convierte en un drawer que se
       esconde por default y aparece al tocar el botón ☰ */
    .app-shell { flex-direction: row; }
    .sidebar-toggle-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 14px; left: 14px;
        z-index: 1200;
        width: 38px; height: 38px;
        background: var(--bg-elevated);
        border: 1px solid var(--border);
        color: var(--text);
        border-radius: var(--radius);
        font-size: 18px;
        cursor: pointer;
    }
    .sidebar-backdrop {
        position: fixed; inset: 0;
        background: rgba(0,0,0,.6);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 1150;
    }
    .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

    .sidebar-nav {
        position: fixed;
        top: 0; left: 0;
        width: 82vw;
        max-width: 300px;
        height: 100vh;
        border-right: 1px solid var(--border);
        transform: translateX(-100%);
        transition: transform .22s ease;
        z-index: 1180;
    }
    .sidebar-nav.open { transform: translateX(0); }
    .sidebar-nav-inner { padding: 70px 20px 20px; }

    .terminal-list-title { font-size: 14px; }
}

@media (max-width: 420px) {
    /* En pantallas muy angostas (con admin-actions presente), oculta la ruta
       y deja solo los puntitos + botones, que es lo funcional */
    .devbar-path:has(~ .devbar-actions) { display: none; }
}