/* --- CSS Variables para paleta moderna y elegante --- */
:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --gradient-1: #3b82f6;
    --gradient-2: #8b5cf6;
}

/* Modo Claro */
body.light-mode {
    --bg-color: #f1f5f9;
    --text-color: #0f172a;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    --gradient-1: #2563eb;
    --gradient-2: #7c3aed;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: background-color 0.4s ease, color 0.4s ease;
    position: relative;
    overflow-x: hidden;
}

/* --- Fondo Dinámico con gradientes suaves --- */
body::before, body::after {
    content: '';
    position: absolute;
    width: 50vw;
    height: 50vw;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.4;
    transition: all 0.5s ease;
    animation: float 10s infinite ease-in-out alternate;
}

body::before {
    top: -10vw;
    left: -10vw;
    background: var(--gradient-1);
}

body::after {
    bottom: -10vw;
    right: -10vw;
    background: var(--gradient-2);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(20px) scale(1.05); }
}

/* --- Utilidad Glassmorphism (Efecto Cristal) --- */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* --- Encabezado --- */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
    transition: all 0.3s ease;
}

header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 15px 30px;
    border-radius: 20px;
}

header h1 {
    font-weight: 800;
    font-size: 1.5em;
    background: linear-gradient(to right, var(--gradient-1), var(--gradient-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header ul {
    list-style-type: none;
    display: flex;
    gap: 25px;
    align-items: center;
    flex-wrap: wrap;
}

header a {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
    position: relative;
    transition: color 0.3s ease;
}

/* Efecto hover en enlaces */
header a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

header a:hover {
    color: var(--accent-hover);
}

header a:hover::after {
    width: 100%;
}

/* --- Contenido Principal --- */
main {
    flex: 1;
    max-width: 900px;
    margin: 40px auto;
    padding: 0 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 40px;
    animation: fadeIn 0.8s ease forwards;
}

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

/* --- Perfil --- */
.profile-container {
    text-align: center;
    padding: 40px 20px;
    border-radius: 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.4);
}

body.light-mode .profile-container:hover {
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.15);
}

.profile-container img.avatar {
    border-radius: 50%;
    margin-bottom: 20px;
    border: 4px solid var(--accent-color);
    padding: 4px;
    transition: transform 0.5s ease;
}

.profile-container:hover img.avatar {
    transform: scale(1.05) rotate(3deg);
}

.profile-container h2 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 800;
}

/* --- Sección de Herramientas --- */
.section h3 {
    font-size: 1.5em;
    margin-bottom: 20px;
    font-weight: 600;
}

.languages-tools {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

.languages-tools a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 75px;
    height: 75px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

body.light-mode .languages-tools a {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.languages-tools a img {
    width: 45px;
    height: 45px;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2));
    transition: transform 0.3s ease;
}

.languages-tools a:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.25);
    border-color: var(--accent-color);
}

body.light-mode .languages-tools a:hover {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
    border-color: var(--accent-color);
}

.languages-tools a:hover img {
    transform: scale(1.1);
}

/* --- Bienvenida --- */
.welcome-section {
    text-align: center;
    padding: 40px;
    border-radius: 24px;
}

.welcome-section h2 {
    font-size: 2em;
    margin-bottom: 15px;
}

/* --- Repositorios --- */
.repos-section h3 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 25px;
}

.repos-list {
    list-style-type: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.repos-list li {
    padding: 25px;
    border-radius: 16px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
}

.repos-list li:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

body.light-mode .repos-list li:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.repos-list a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.2em;
    transition: color 0.3s ease;
}

.repos-list a:hover {
    color: var(--accent-hover);
}

.repos-desc {
    font-size: 0.95em;
    opacity: 0.9;
    flex: 1;
}

/* --- Redes Sociales --- */
.social-media {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding: 30px;
    border-radius: 24px;
}

.social-media a {
    transition: transform 0.3s ease;
}

.social-media a:hover {
    transform: scale(1.1) translateY(-3px);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 30px;
    margin-top: auto;
    font-size: 0.9em;
    opacity: 0.7;
    font-weight: 300;
}

/* --- Switch Toggle (Modo Oscuro) --- */
.theme-toggle-container {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.toggle-switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #4b5563;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* --- Responsivo --- */
@media (max-width: 768px) {
    header nav {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    header ul {
        flex-direction: column;
        gap: 15px;
    }
    .profile-container h2 {
        font-size: 2em;
    }
    .welcome-section h2 {
        font-size: 1.5em;
    }
}
pre {
    background: rgba(0, 0, 0, 0.5);
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 15px 0;
}

code {
    font-family: 'Courier New', Courier, monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

body.light-mode pre {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode code {
    background: rgba(0, 0, 0, 0.08);
}

/* --- Advanced Blog Features --- */
.blog-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.blog-search-container {
    position: relative;
    width: 100%;
}

.blog-search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1em;
    border: none;
    border-radius: 12px;
    color: var(--text-color);
    outline: none;
    transition: box-shadow 0.3s ease;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    font-family: inherit;
}

.blog-search-input::placeholder {
    color: var(--text-color);
    opacity: 0.6;
}

.blog-search-input:focus {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    border-color: var(--accent-color);
}

.blog-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

body.light-mode .filter-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0,0,0,0.1);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.blog-card.hero {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .blog-card.hero {
        grid-template-columns: 1fr 1fr;
        align-items: center;
    }
}

.blog-card.hero .blog-title {
    font-size: 2em;
}

.blog-card.hero .blog-excerpt {
    font-size: 1.1em;
}

.blog-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.blog-tag {
    font-size: 0.75em;
    padding: 3px 8px;
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border-radius: 12px;
    font-weight: 600;
}

body.light-mode .blog-tag {
    color: #2563eb;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    opacity: 0.7;
    margin-bottom: 10px;
}

.blog-card:hover {
    box-shadow: 0 15px 35px rgba(59, 130, 246, 0.15);
}

body.light-mode .blog-card:hover {
    box-shadow: 0 15px 35px rgba(37, 99, 235, 0.15);
}

/* --- Final Portfolio Features (Projects, Badges, CV) --- */
.btn-cv {
    display: inline-block;
    background: linear-gradient(to right, var(--gradient-1), var(--gradient-2));
    color: white;
    text-decoration: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 800;
    font-size: 1.1em;
    margin-top: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn-cv:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.4);
    color: white;
}

.projects-section {
    margin-top: 40px;
}

.projects-section h3 {
    text-align: center;
    font-size: 1.8em;
    margin-bottom: 30px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.project-card {
    padding: 25px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
}

body.light-mode .project-card:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--glass-border);
}

.project-title {
    font-size: 1.5em;
    font-weight: 800;
}

.project-desc {
    font-size: 0.95em;
    opacity: 0.9;
    flex: 1;
}

.project-tech {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.project-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
}

.project-link:hover {
    text-decoration: underline;
}

.badges-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.badge-card {
    text-align: center;
    padding: 20px;
    border-radius: 16px;
    transition: transform 0.3s ease;
}

.badge-card:hover {
    transform: translateY(-5px) scale(1.02);
}

.badge-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 10px;
}

.badge-card h4 {
    font-size: 1.1em;
    color: var(--accent-color);
}

/* --- Nuevos Estilos Hacker --- */
.hacker-quote {
    border-left: 4px solid var(--accent-color);
    background: rgba(59, 130, 246, 0.05);
    padding: 20px;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    margin: 30px 0;
    line-height: 1.8;
}

.hacker-quote strong {
    color: var(--accent-color);
    font-style: normal;
}

.stats-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
}

.stats-container img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    min-height: 195px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.9em;
}

.domain-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    overflow: hidden;
}

body.light-mode .domain-table {
    background: rgba(0, 0, 0, 0.02);
}

.domain-table th, .domain-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.domain-table th {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-color);
    font-weight: 600;
}

.crypto-table {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.crypto-table td {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 15px;
    vertical-align: middle;
}

.crypto-table td:first-child {
    border-radius: 12px 0 0 12px;
    width: 50px;
    text-align: center;
}

.crypto-table td:nth-child(2) {
    font-weight: 800;
    color: var(--accent-color);
    width: 80px;
}

.crypto-table td:last-child {
    border-radius: 0 12px 12px 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    word-break: break-all;
}

.hero-project {
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 40px;
    backdrop-filter: blur(10px);
}

.hero-project h3 {
    font-size: 2em;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.hero-project ul {
    margin: 15px 0 15px 20px;
    line-height: 1.8;
}

.bash-snippet {
    background: #0D1117;
    color: #C9D1D9;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Fira Code', monospace;
    overflow-x: auto;
    margin-top: 20px;
    border: 1px solid #30363D;
}

.bash-snippet .comment {
    color: #8B949E;
}

.bash-snippet .cmd {
    color: #79C0FF;
}

.badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.badge-row img {
    height: 25px;
}

/* --- Nuevas clases de refactorización --- */
.section-title {
    margin-top: 40px;
    color: var(--accent-color);
}

.subsection-title {
    margin-top: 20px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.certs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.ctf-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.ctf-container img {
    border-radius: 6px;
}

.mb-20 {
    margin-bottom: 20px;
}

.about-section {
    padding: 40px;
    border-radius: 24px;
    margin-bottom: 40px;
}
.about-section h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: var(--accent-color);
}
.about-section h3 {
    font-size: 1.8em;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--accent-hover);
}
.about-section p {
    font-size: 1.1em;
    margin-bottom: 15px;
    line-height: 1.8;
}
.timeline {
    border-left: 4px solid var(--accent-color);
    padding-left: 20px;
    margin-top: 20px;
}
.timeline-item {
    margin-bottom: 20px;
    position: relative;
}
.timeline-item::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    left: -30px;
    top: 5px;
    border: 3px solid var(--bg-color);
}
.timeline-item h4 {
    font-size: 1.3em;
    margin-bottom: 5px;
}
.timeline-item span {
    font-size: 0.9em;
    opacity: 0.7;
}
