:root[data-theme="mocha"] {
    --bg-color: #1e1e2e; /* Catppuccin Mocha Base (Terminal) */
    --app-bg: #11111b;   /* Catppuccin Mocha Crust (Fondo) - Proporciona contraste */
    --text-color: #cdd6f4;
    --prompt-user: #a6e3a1;
    --prompt-dir: #89b4fa;
    --prompt-symbol: #cdd6f4;
    --accent-red: #f38ba8;
    --accent-green: #a6e3a1;
    --accent-yellow: #f9e2af;
    --accent-pink: #f5c2e7;
    --accent-gray: #a6adc8;
    --accent-blue: #89b4fa;
    --accent-subtext: #a6adc8;
    --accent-overlay: #313244;
    --card-bg: #181825;
    --card-border: #313244;
    --window-header: #181825;
    --hover-bg: #313244;
    --shadow: none;
    --ubuntu-close: #f38ba8;
    --ubuntu-min: #f9e2af;
    --ubuntu-max: #a6e3a1;
    --bg-grid: linear-gradient(to right, #1e1e2e 1px, transparent 1px),
               linear-gradient(to bottom, #1e1e2e 1px, transparent 1px);
}

:root[data-theme="latte"] {
    --bg-color: #ffffff; /* Blanco puro para máxima claridad en terminales */
    --app-bg: #ccd0da;   /* Catppuccin Latte Surface2 - Fondo más oscuro para contraste */
    --text-color: #4c4f69;
    --prompt-user: #40a02b;
    --prompt-dir: #1e66f5;
    --prompt-symbol: #4c4f69;
    --accent-red: #d20f39;
    --accent-green: #40a02b;
    --accent-yellow: #df8e1d;
    --accent-pink: #ea76cb;
    --accent-gray: #6c6f85;
    --accent-blue: #1e66f5;
    --accent-subtext: #6c6f85;
    --accent-overlay: #bcc0cc;
    --card-bg: #eff1f5;
    --card-border: #bcc0cc;
    --window-header: #dce0e8;
    --hover-bg: #bcc0cc;
    --shadow: 0 4px 15px rgba(0,0,0,0.05); /* Sutil sombra para separar del fondo */
    --ubuntu-close: #d20f39;
    --ubuntu-min: #df8e1d;
    --ubuntu-max: #40a02b;
    --bg-grid: linear-gradient(to right, rgba(156, 160, 176, 0.3) 1px, transparent 1px),
               linear-gradient(to bottom, rgba(156, 160, 176, 0.3) 1px, transparent 1px);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--app-bg);
    background-image: var(--bg-grid);
    background-size: 40px 40px;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 90px 20px 40px 20px;
    transition: background-color 0.3s, color 0.3s, background-image 0.3s;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.6;
}

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    background-color: var(--window-header);
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 2px 10px var(--shadow);
}

.nav-menu {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.global-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.full-width {
    grid-column: span 2;
}

.terminal-window {
    background-color: var(--bg-color);
    border-radius: 10px;
    box-shadow: 0 10px 30px var(--shadow), 0 0 0 1px var(--card-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    scroll-margin-top: 100px;
}

.terminal-window:hover {
    box-shadow: 0 15px 40px var(--shadow), 0 0 0 1px var(--card-border);
    transform: translateY(-2px);
}

.terminal-header {
    background-color: var(--window-header);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    border-bottom: 1px solid var(--card-border);
    position: relative;
}

.window-title {
    text-transform: uppercase;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--text-color);
    text-align: center;
    letter-spacing: 0.5px;
    font-family: 'JetBrains Mono', monospace;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
}

/* Specific styling for skills terminal */
.skills-terminal {
    height: 250px !important;
    min-height: 250px !important;
    max-height: 250px !important;
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
}

.skills-terminal .terminal-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding-bottom: 25px;
    overflow: hidden !important;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 25px;
    padding: 20px 0;
    justify-items: center;
    flex-grow: 1; /* Allow grid to fill available space without collapsing */
}

.control {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.2s;
    font-size: 10px;
    font-weight: bold;
    color: transparent;
}

.control:hover {
    color: rgba(255, 255, 255, 0.8);
}

.control.close::after { content: "×"; line-height: 1; font-family: sans-serif; }
.control.minimize::after { content: "−"; line-height: 1; font-family: sans-serif; }
.control.maximize::after { content: "□"; line-height: 1; font-size: 12px; font-family: sans-serif; }

.control.close { background-color: var(--ubuntu-close); }
.control.minimize { background-color: var(--ubuntu-min); }
.control.maximize { background-color: var(--ubuntu-max); }

.btn {
    background: var(--bg-color);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85em;
    font-weight: bold;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    background-color: var(--hover-bg);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.terminal-body {
    padding: 25px;
    flex-grow: 1;
    overflow-wrap: break-word;
    word-break: break-word;
}

.boot-screen {
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.8;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 800px;
}

.boot-screen p {
    margin-bottom: 4px;
}

.section {
    opacity: 0;
    margin-bottom: 0; 
}

.section.animate-in {
    animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.prompt {
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.05em;
}

span.prompt {
    margin-bottom: 0;
    font-size: 1em;
}

.prompt .user { color: var(--prompt-user); }
.prompt .dir { color: var(--prompt-dir); }

.clickable-phrase {
    color: var(--prompt-user);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.clickable-phrase:hover {
    color: var(--accent-yellow);
}

.output {
    padding-left: 20px;
}

/* Hero Section */
.hero-output {
    display: flex;
    gap: 30px;
    align-items: center;
}

.profile-pic {
    flex-shrink: 0;
}

.profile-pic img {
    width: 250px;
    height: 250px;
    border-radius: 12px;
    object-fit: cover;
    border: 3px solid var(--card-border);
    box-shadow: 0 8px 16px var(--shadow);
    transition: transform 0.3s ease;
}

.profile-pic img:hover {
    transform: scale(1.05) rotate(-2deg);
}

.my-name {
    font-size: 2.2em;
    margin-bottom: 5px;
    color: var(--prompt-dir);
    letter-spacing: -0.5px;
    font-weight: 800;
}

.bio h2 {
    font-size: 1.5em;
    margin-bottom: 15px;
    color: var(--accent-yellow);
    letter-spacing: -0.5px;
    min-height: 35px;
    font-weight: normal;
}

.bio p {
    font-size: 1em;
    color: var(--text-color);
    opacity: 0.9;
}

/* Skills */
.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: transparent;
    padding: 10px;
    border-radius: 8px;
    border: none;
    transition: none;
    box-shadow: none;
    opacity: 0;
    transform: scale(0.5);
    width: 100%;
}

.skill-item.pop-in {
    animation: springPop 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.skill-item.pop-out {
    animation: springPopOut 0.4s ease-in forwards;
}

@keyframes springPop {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes springPopOut {
    0% { opacity: 1; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.15); }
    100% { opacity: 0; transform: scale(0.8); }
}

.skill-item img {
    width: 48px;
    height: 48px;
    margin-bottom: 8px;
}

.skill-item span {
    font-size: 16px;
    font-weight: bold;
    color: var(--accent-pink);
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
}

/* Projects */
.projects-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.project-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px var(--shadow);
}

.project-card h3 {
    margin-bottom: 10px;
    color: var(--prompt-dir);
    font-size: 1.2em;
    padding-right: 25px; /* prevent overlap with github icon */
}

.project-card p {
    font-size: 0.9em;
    margin-bottom: 15px;
    opacity: 0.8;
}

.github-link-icon {
    position: absolute;
    top: 20px;
    right: 20px;
    color: var(--prompt-user);
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.github-link-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.github-link-icon svg {
    display: block;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto; /* Pushes to bottom */
}

.tech-tag {
    font-size: 0.75em;
    padding: 3px 8px;
    background-color: rgba(0,0,0,0.15);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    color: var(--accent-yellow);
    font-family: 'JetBrains Mono', monospace;
}

.btn-live-demo {
    display: inline-block;
    margin-top: 15px;
    padding: 8px 12px;
    background-color: transparent;
    border: 1px solid var(--prompt-user);
    color: var(--prompt-user);
    text-decoration: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    font-weight: bold;
    border-radius: 6px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(166, 227, 161, 0.2); /* Mocha Green glow */
    animation: pulseGlow 2s infinite;
}

.btn-live-demo:hover {
    background-color: var(--prompt-user);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(166, 227, 161, 0.5);
    transform: translateY(-2px);
}

@keyframes pulseGlow {
    0% { box-shadow: 0 0 5px rgba(166, 227, 161, 0.2); }
    50% { box-shadow: 0 0 15px rgba(166, 227, 161, 0.6); }
    100% { box-shadow: 0 0 5px rgba(166, 227, 161, 0.2); }
}

.btn-link {
    display: inline-flex;
    align-items: center;
    color: var(--prompt-user);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9em;
}

.btn-link::after {
    content: "→";
    margin-left: 6px;
    transition: transform 0.2s ease;
}

.btn-link:hover::after {
    transform: translateX(4px);
}

/* Certifications Horizontal Grid */
.certs-grid {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 10px 5px 20px 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--prompt-dir) transparent;
}

.certs-grid::-webkit-scrollbar {
    height: 6px;
}

.certs-grid::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

.certs-grid::-webkit-scrollbar-thumb:hover {
    background: var(--prompt-dir);
}

.cert-card {
    min-width: 200px;
    max-width: 200px;
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}

.cert-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--shadow);
    border-color: var(--prompt-dir);
}

.provider-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    margin-bottom: 12px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.cert-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.cert-title {
    font-size: 0.95em;
    color: var(--text-color);
    font-weight: bold;
    min-height: 2.4em;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.btn-cert {
    color: var(--prompt-user);
    text-decoration: none;
    font-weight: bold;
    font-size: 0.85em;
    border: 1px solid var(--prompt-user);
    padding: 5px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    display: inline-block;
    width: fit-content;
    align-self: center;
}

.btn-cert:hover {
    background-color: var(--prompt-user);
    color: var(--bg-color);
    box-shadow: 0 0 10px var(--prompt-user);
}

@media (max-width: 600px) {
    .cert-card {
        min-width: 180px;
        padding: 15px;
    }
    .provider-logo {
        width: 45px;
        height: 45px;
    }
}

/* PowerBI Placeholder & Iframe */
.powerbi-iframe-container iframe {
    aspect-ratio: 16 / 9;
    height: auto;
    min-height: 250px;
}

.powerbi-placeholder {
    padding: 40px;
    text-align: center;
    border: 2px dashed var(--card-border);
    background-color: rgba(0,0,0,0.1);
    color: var(--accent-yellow);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--card-border);
    border-top-color: var(--accent-yellow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Contact */
.contact-card {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    width: 100%;
}

.contact-card p {
    margin-bottom: 15px;
    font-size: 1.05em;
}

.contact-card a:not(.btn) {
    color: var(--prompt-dir);
    text-decoration: none;
    font-weight: bold;
}

.contact-card a:not(.btn):hover {
    text-decoration: underline;
}

.contact-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.linkedin-btn {
    background-color: #0a66c2;
    color: white !important;
    border: none;
}

.linkedin-btn:hover {
    background-color: #004182;
}

.github-btn {
    background-color: #24292e;
    color: white !important;
    border: none;
}

.github-btn:hover {
    background-color: #444d56;
}

.inline-icon {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

.cv-btn {
    background-color: var(--prompt-user);
    color: var(--bg-color) !important;
    border: none;
}

.cv-btn:hover {
    background-color: #8bd496;
}

/* Analyzer */
#analyzer {
    /* animation: subtleTerminalGlitch 12s infinite; */ /* Uncomment to enable glitch effect */
}

.analyzer-container {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    word-break: break-word;
    overflow-wrap: break-word;
}

@keyframes subtleTerminalGlitch {
    0%, 95%, 100% {
        transform: none;
        filter: none;
        opacity: 1;
    }
    95.2% {
        transform: translate(-3px, 2px) skew(-2deg) scale(1.01);
        filter: hue-rotate(15deg) contrast(1.2);
        opacity: 0.9;
    }
    95.6% {
        transform: translate(3px, -2px) skew(2deg) scale(0.99);
        filter: hue-rotate(-15deg) brightness(1.3) invert(0.1);
        opacity: 0.8;
    }
    96.0% {
        transform: translate(-2px, 3px) skew(-1deg) scale(1.005);
        filter: hue-rotate(10deg);
        opacity: 0.95;
    }
    96.4% {
        transform: translate(2px, -1px) skew(1deg) scale(1);
        filter: none;
        opacity: 1;
    }
}

.analyzer-header {
    margin-bottom: 15px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 10px;
}

.info {
    color: var(--accent-yellow);
    font-size: 0.9em;
}

.analyzer-log-window {
    min-height: 80px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.input-line {
    display: flex;
    align-items: baseline;
    background-color: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 4px;
}

#analyzer-input {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: inherit;
    font-size: 1em;
    flex-grow: 1;
    margin-left: 10px;
    outline: none;
    caret-color: var(--accent-yellow);
    caret-shape: block;
    padding: 0;
    line-height: inherit;
}

.cursor {
    display: inline-block;
    width: 10px;
    height: 1.2em;
    background-color: var(--accent-yellow);
    animation: blink 1s step-end infinite;
    vertical-align: middle;
}

.input-cursor {
    background-color: var(--text-color);
    width: 8px;
}

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

.analyzer-result {
    margin-top: 10px;
    margin-bottom: 15px;
    border-left: 3px solid var(--prompt-dir);
    padding-left: 15px;
    background-color: rgba(0,0,0,0.1);
    padding: 10px 15px;
    border-radius: 0 4px 4px 0;
}

.analyzer-result div {
    margin-bottom: 4px;
}

.val-positive { color: var(--accent-green); font-weight: bold; }
.val-negative { color: var(--accent-red); font-weight: bold; }

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 5px;
    border: 2px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--prompt-dir);
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
        flex-grow: 1;
    }
    .skills-terminal {
        height: 480px !important;
        min-height: 480px !important;
        max-height: 480px !important;
    }
}

.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    .window-title {
        position: static;
        transform: none;
        font-size: 0.9em;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 10px;
    }

    .terminal-header {
        justify-content: space-between;
    }

    .top-bar {
        padding: 10px 15px;
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: space-between !important;
        background-color: var(--window-header);
        border-bottom: 1px solid var(--card-border);
        top: 0;
        gap: 10px;
    }

    .nav-menu {
        display: none; /* Hidden by default on mobile */
        flex-direction: column;
        width: 100%;
        order: 3;
        background-color: var(--bg-color);
        border: 1px solid var(--card-border);
        border-radius: 8px;
        padding: 10px;
        margin-top: 10px;
        box-shadow: 0 8px 16px var(--shadow);
    }

    .nav-menu.active {
        display: flex; /* Show when active */
    }

    .nav-menu .btn {
        width: 100%;
        justify-content: flex-start;
        border: none;
        padding: 12px;
    }

    .global-actions {
        order: 2;
    }

    body {
        padding-top: 80px;
    }

    .workspace {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .full-width {
        grid-column: span 1;
    }

    .hero-output {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .profile-pic img {
        width: 160px;
        height: 160px;
    }

    .bio h1 {
        font-size: 1.4em;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        flex-grow: 1;
        gap: 8px; /* Further reduced gap */
        padding: 10px 0; /* Reduced padding */
    }
    
    .skills-terminal {
        height: 550px !important;
        min-height: 550px !important;
        max-height: 550px !important;
    }
    
    .skill-item {
        padding: 5px; /* Reduced padding on mobile */
    }

    .skill-item img {
        width: 40px; /* Even smaller icons */
        height: 40px;
    }

    .skill-item span {
        font-size: 13px; /* Slightly smaller labels */
    }

    .input-line {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #analyzer-input {
        margin-left: 0;
        margin-top: 5px;
        width: 100%;
    }
}

.btn-terminal-action {
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: 5px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.btn-terminal-action:hover {
    opacity: 1;
    transform: scale(1.1);
    color: var(--prompt-user);
}

.btn-terminal-action svg {
    display: block;
}

.prebuilt-comments {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px dashed var(--card-border);
    padding-top: 15px;
}

.prebuilt-btn {
    font-size: 0.85em;
    color: var(--prompt-user);
    border-color: var(--prompt-user);
    background-color: transparent;
    font-weight: normal;
}

.prebuilt-btn:hover {
    background-color: var(--prompt-user);
    color: var(--bg-color);
}
