html, body {
    height: 100%;
}

body {
    background: #090909;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6,
.text-light, .text-white, .text-muted,
p, li, a, span, code {
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace !important;
}

/* Títulos principales: extra bold */
h2 { font-weight: 800; font-size: 3rem; }
h3 { font-weight: 800; font-size: 1.6rem; }

header.row {
    margin-top: 2rem;
}

/* Subtítulos: semi bold, más grande que texto normal */
h4 { font-weight: 700; font-size: 1.3rem; }

/* Texto normal: peso regular */
p, li { font-weight: 400; }

.header-sub {
    font-size: 1.1rem;
    color: #bbbbbb;
}

a { color: #00ff41; }
a:hover { color: #00cc33; text-decoration: underline; }

/* Títulos de sección */
.console-heading::before {
    content: '> ';
    color: #00ff41;
}

/* Subtítulos con >> */
.subsection-heading::before {
    content: '>> ';
    color: #00ff41;
}

.console-list {
    list-style: none;
    padding-left: 1rem;
}

.console-list li::before {
    content: '$ ';
    color: #00ff41;
}

.bg-black {
    background: #000;
}

.card-project:hover {
    border: 1px solid #fff;
    cursor: pointer;
}

.project-img-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.project-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-title {
    height: 2.4em;
    font-size: 1.3rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.project-description {
    height: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    line-clamp: 8;
    -webkit-box-orient: vertical;
}

.commits-list {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.4s ease;
}

.card-project:hover .commits-list {
    max-height: 500px;
    opacity: 1;
}

.skeleton-line {
    height: 10px;
    background: #222;
    border-radius: 4px;
    margin-bottom: 6px;
    animation: pulse 1.5s infinite ease-in-out;
}

.skeleton-line.short {
    width: 60%;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Botones estilo consola */
.console-btn,
.console-link {
    display: inline-block;
    border: 1px solid #00ff41;
    color: #00ff41;
    background: transparent;
    padding: 0.5rem 1rem;
    font-family: 'Courier New', Courier, monospace;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.console-btn:hover,
.console-link:hover {
    background: #00ff41;
    color: #000;
    text-decoration: none;
}

.console-btn.copied {
    background: #00ff41;
    color: #000;
}

/* Divisores entre secciones */
.section-divider {
    border: 0;
    height: 1px;
    background: #00ff41;
    opacity: 0.3;
    margin: 1.5rem auto;
    max-width: 90%;
}

/* Badges de tecnologías */
.tech-badge {
    display: inline-block;
    border: 1px solid #00ff41;
    color: #000;
    background: #00ff41;
    padding: 0.35rem 0.75rem;
    font-size: 0.9rem;
    font-weight: 700;
    font-family: 'Courier New', Courier, monospace;
}

/* ============================ Chat widget ============================ */
#chat-widget {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1050;
    font-family: 'JetBrains Mono', 'Courier New', Courier, monospace;
}

/* Toggle group: botón principal + botón colapsar */
#chat-toggle-group {
    display: flex;
    align-items: stretch;
    gap: 0;
    border-radius: 999px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(0, 255, 65, 0.35);
}
#chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #00ff41;
    color: #000;
    border: none;
    padding: 0.65rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
}
#chat-toggle:hover { background: #00cc33; }
.chat-toggle-icon { font-weight: 800; }

#chat-collapse {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #00cc33;
    color: #000;
    border: none;
    border-left: 1px solid rgba(0, 0, 0, 0.15);
    padding: 0 0.6rem;
    font-size: 0.85rem;
    cursor: pointer;
}
#chat-collapse:hover { background: #00aa28; color: #fff; }

/* Botón restaurar (visible solo cuando está colapsado) */
#chat-restore {
    display: none;
    align-items: center;
    justify-content: center;
    background: #00ff41;
    color: #000;
    border: none;
    border-radius: 999px;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 255, 65, 0.35);
}
#chat-restore:hover { background: #00cc33; }

/* Estado colapsado */
#chat-widget.chat-collapsed #chat-toggle-group,
#chat-widget.chat-collapsed #chat-panel {
    display: none !important;
}
#chat-widget.chat-collapsed #chat-restore {
    display: flex;
}

#chat-panel {
    position: absolute;
    right: 0;
    bottom: 3.5rem;
    width: 380px;
    height: 520px;
    max-width: calc(100vw - 2rem);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    border: 1px solid #00ff41;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
}
#chat-panel.chat-resizing { user-select: none; }
#chat-panel.chat-resizing .chat-messages { pointer-events: none; }

/* Manijas de redimensionado */
.chat-resize { position: absolute; z-index: 30; }
.chat-resize-left {
    top: 14px; left: -3px; bottom: 0; width: 8px;
    cursor: ew-resize;
}
.chat-resize-top {
    top: -3px; left: 14px; right: 0; height: 8px;
    cursor: ns-resize;
}
.chat-resize-corner {
    top: -3px; left: -3px; width: 18px; height: 18px;
    cursor: nwse-resize;
    border-top: 2px solid rgba(0, 255, 65, 0.5);
    border-left: 2px solid rgba(0, 255, 65, 0.5);
    border-top-left-radius: 10px;
}
.chat-resize-corner:hover { border-color: #00ff41; }

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.7rem;
    background: #000;
    border-bottom: 1px solid rgba(0, 255, 65, 0.4);
    flex: 0 0 auto;
}
.chat-title { color: #00ff41; font-weight: 700; font-size: 0.95rem; flex: 1; }
.chat-counter {
    color: #888;
    font-size: 0.78rem;
    font-weight: 600;
    background: #111;
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 999px;
    padding: 0.1rem 0.5rem;
    white-space: nowrap;
}
.chat-counter-low { color: #ff6b6b; border-color: rgba(255, 107, 107, 0.4); }
.chat-icon-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.15rem 0.3rem;
    line-height: 1;
}
.chat-icon-btn:hover { color: #fff; }
#chat-close {
    background: none;
    border: none;
    color: #bbbbbb;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}
#chat-close:hover { color: #fff; }

.chat-body {
    position: relative;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
}
.chat-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-msg {
    max-width: 85%;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: inherit;
    line-height: 1.45;
    word-wrap: break-word;
}
.chat-msg-user { white-space: pre-wrap; }
.chat-msg-bot {
    align-self: flex-start;
    background: #111;
    color: #e6e6e6;
    border: 1px solid rgba(0, 255, 65, 0.25);
}
.chat-msg-user {
    align-self: flex-end;
    background: #00ff41;
    color: #000;
    font-weight: 700;
}
.chat-typing { opacity: 0.7; font-style: italic; }
.chat-cached-badge {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.68em;
    color: #00ff41;
    opacity: 0.65;
    letter-spacing: 0.03em;
}
.chat-cached-badge::before { content: "\26A1 "; }

.chat-limit-note {
    margin-top: 0.4rem;
    font-size: 0.85em;
    color: #888;
    border-top: 1px dashed rgba(0, 255, 65, 0.15);
    padding-top: 0.4rem;
}

/* Markdown rendering inside bot messages */
.chat-msg-bot p { margin: 0 0 0.4rem 0; }
.chat-msg-bot p:last-child { margin-bottom: 0; }
.chat-msg-bot .chat-md-h { color: #00ff41; margin: 0.5rem 0 0.3rem; font-size: 1.05em; }
.chat-msg a { color: #00ff41; text-decoration: underline; word-break: break-all; }
.chat-msg a:hover { color: #00cc33; }
.chat-msg-bot .chat-md-ul,
.chat-msg-bot .chat-md-ol { margin: 0.3rem 0; padding-left: 1.2rem; }
.chat-msg-bot .chat-md-ul li,
.chat-msg-bot .chat-md-ol li { margin-bottom: 0.2rem; }
.chat-msg-bot .chat-md-code {
    background: #000;
    color: #00ff41;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.9em;
}
.chat-msg-bot .chat-md-codeblock {
    background: #000;
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 6px;
    padding: 0.5rem;
    overflow-x: auto;
    margin: 0.4rem 0;
}
.chat-msg-bot .chat-md-codeblock code { color: #00ff41; font-size: 0.9em; }
.chat-msg-bot a { color: #00ff41; text-decoration: underline; }
.chat-msg-bot strong { color: #fff; }
.chat-msg-bot em { color: #ccc; }

/* Overlays (conversaciones / ajustes) — mismo estilo que la ventana */
.chat-overlay {
    position: absolute;
    inset: 0;
    background: #0a0a0a;
    z-index: 20;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.chat-overlay.open {
    opacity: 1;
    visibility: visible;
    transform: none;
}
.chat-overlay-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.7rem;
    background: #000;
    border-bottom: 1px solid rgba(0, 255, 65, 0.4);
    flex: 0 0 auto;
}
.chat-overlay-title {
    color: #00ff41;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
}
.chat-overlay-back { font-size: 1.4rem; }
.chat-overlay-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.chat-new-conv {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: transparent;
    border: 1px dashed rgba(0, 255, 65, 0.5);
    color: #00ff41;
    border-radius: 6px;
    padding: 0.55rem;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    flex: 0 0 auto;
}
.chat-new-conv:hover { background: rgba(0, 255, 65, 0.1); border-style: solid; }
.chat-new-conv-icon { font-weight: 800; font-size: 1rem; }
.chat-conv-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.chat-conv-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #bbb;
    border: 1px solid transparent;
}
.chat-conv-item:hover { background: #111; border-color: rgba(0, 255, 65, 0.15); }
.chat-conv-item.active {
    background: rgba(0, 255, 65, 0.08);
    color: #00ff41;
    border-color: rgba(0, 255, 65, 0.4);
}
.chat-conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-conv-del {
    background: none;
    border: none;
    color: #555;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.chat-conv-del:hover { color: #ff6b6b; }

/* Ajustes */
.chat-setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    background: #111;
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 8px;
}
.chat-setting-label { font-size: 0.85rem; color: #ddd; }
.chat-setting-control { display: flex; align-items: center; gap: 0.5rem; }
.chat-font-val { font-size: 0.8rem; color: #888; min-width: 2.6rem; text-align: center; }
.chat-font-btn {
    background: #000;
    border: 1px solid rgba(0, 255, 65, 0.4);
    color: #00ff41;
    border-radius: 5px;
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}
.chat-font-btn:hover { background: #00ff41; color: #000; }
.chat-reset-size {
    background: transparent;
    border: 1px solid rgba(0, 255, 65, 0.4);
    color: #00ff41;
    border-radius: 6px;
    padding: 0.5rem;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
}
.chat-reset-size:hover { background: rgba(0, 255, 65, 0.1); }
.chat-setting-hint {
    margin: 0;
    font-size: 0.74rem;
    color: #777;
    line-height: 1.4;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0 0.85rem 0.4rem;
}
.chat-chip {
    background: transparent;
    border: 1px solid #00ff41;
    color: #00ff41;
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    cursor: pointer;
}
.chat-chip:hover { background: #00ff41; color: #000; }

.chat-form {
    display: flex;
    gap: 0.4rem;
    padding: 0.6rem;
    border-top: 1px solid rgba(0, 255, 65, 0.4);
    background: #000;
}
.chat-input {
    flex: 1 1 auto;
    background: #090909;
    border: 1px solid rgba(0, 255, 65, 0.4);
    border-radius: 6px;
    color: #fff;
    padding: 0.5rem 0.6rem;
    font-size: 0.9rem;
    font-family: inherit;
}
.chat-input:focus { outline: none; border-color: #00ff41; }
.chat-input:disabled { opacity: 0.5; }
.chat-send {
    background: #00ff41;
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 0 0.85rem;
    font-size: 1rem;
    cursor: pointer;
}
.chat-send:hover { background: #00cc33; }
.chat-send:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 480px) {
    .chat-toggle-text { display: none; }
}