@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --tech-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-blue: #3b82f6;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --surface-light: rgba(255, 255, 255, 0.95);
    --surface-glass: rgba(255, 255, 255, 0.1);
    --border-tech: rgba(6, 182, 212, 0.2);
    --shadow-tech: 0 8px 32px rgba(6, 182, 212, 0.15);
    --shadow-primary: 0 20px 40px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--tech-gradient);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
}

/* Modo oscuro por defecto */
body.dark-mode {
    background: var(--tech-gradient);
    color: var(--text-primary);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

.main-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    grid-template-rows: auto 1fr;
    gap: 30px;
    position: relative;
    z-index: 1;
}

.header-container {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.95));
    border-radius: 24px;
    padding: 50px 40px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-tech);
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
}

.header-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 400"><defs><linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%2306b6d4;stop-opacity:0.1" /><stop offset="50%" style="stop-color:%238b5cf6;stop-opacity:0.05" /><stop offset="100%" style="stop-color:%233b82f6;stop-opacity:0.1" /></linearGradient></defs><rect width="1200" height="400" fill="url(%23grad1)"/><circle cx="100" cy="100" r="50" fill="%2306b6d4" opacity="0.1"/><circle cx="1100" cy="300" r="80" fill="%238b5cf6" opacity="0.08"/><circle cx="600" cy="200" r="30" fill="%233b82f6" opacity="0.12"/><polygon points="200,50 250,100 200,150 150,100" fill="%2306b6d4" opacity="0.08"/><polygon points="1000,100 1050,150 1000,200 950,150" fill="%238b5cf6" opacity="0.06"/><path d="M300,200 Q400,150 500,200 T700,200" stroke="%2306b6d4" stroke-width="2" fill="none" opacity="0.15"/><path d="M800,300 Q900,250 1000,300 T1200,300" stroke="%238b5cf6" stroke-width="2" fill="none" opacity="0.1"/></svg>') center/cover;
    opacity: 0.7;
    z-index: -1;
}

.header-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple), var(--accent-blue));
    border-radius: 24px 24px 0 0;
}

.content-container {
    background: var(--surface-light);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-primary);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-tech);
    position: relative;
    overflow: hidden;
}

.content-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple), var(--accent-blue));
    border-radius: 24px 24px 0 0;
}

.sidebar {
    background: var(--surface-glass);
    border-radius: 24px;
    padding: 30px;
    box-shadow: var(--shadow-tech);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-tech);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    position: sticky;
    top: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header {
    text-align: center;
    position: relative;
    z-index: 1;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
    border-radius: 2px;
}

.header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
    letter-spacing: -0.02em;
    position: relative;
}

.header h1::before {
    content: '🤖';
    position: absolute;
    left: -70px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.3));
}

.header .subtitle {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 15px;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.header .date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
}

.dark-mode-toggle {
    width: 100%;
    background: var(--surface-glass);
    border: 1px solid var(--border-tech);
    border-radius: 16px;
    padding: 16px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 30px;
    color: var(--accent-cyan);
    font-family: 'Inter', sans-serif;
    position: relative;
    overflow: hidden;
}

.dark-mode-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.1), transparent);
    transition: left 0.6s;
}

.dark-mode-toggle:hover::before {
    left: 100%;
}

.dark-mode-toggle:hover {
    background: rgba(6, 182, 212, 0.1);
    transform: translateY(-2px);
    box-shadow: var(--shadow-tech);
    border-color: var(--accent-cyan);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-tech);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-item {
    margin-bottom: 12px;
    padding: 16px 20px;
    background: var(--surface-glass);
    border-radius: 12px;
    border: 1px solid var(--border-tech);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.archive-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--accent-cyan), var(--accent-purple));
    transform: scaleY(0);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.archive-item:hover::before {
    transform: scaleY(1);
}

.archive-item:hover {
    background: rgba(6, 182, 212, 0.05);
    transform: translateX(8px);
    box-shadow: var(--shadow-tech);
    border-color: var(--accent-cyan);
}

.archive-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: block;
    transition: color 0.3s ease;
    font-family: 'JetBrains Mono', monospace;
}

.archive-link:hover {
    color: var(--accent-purple);
}

.no-archives {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: 30px;
    background: var(--surface-glass);
    border-radius: 12px;
    border: 1px dashed var(--border-tech);
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.news-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-tech);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.news-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><defs><linearGradient id="cardGradLight" x1="0%" y1="0%" x2="100%" y2="100%"><stop offset="0%" style="stop-color:%2306b6d4;stop-opacity:0.06" /><stop offset="50%" style="stop-color:%238b5cf6;stop-opacity:0.04" /><stop offset="100%" style="stop-color:%233b82f6;stop-opacity:0.06" /></linearGradient></defs><rect width="400" height="300" fill="url(%23cardGradLight)"/><circle cx="50" cy="50" r="20" fill="%2306b6d4" opacity="0.08"/><circle cx="350" cy="250" r="30" fill="%238b5cf6" opacity="0.06"/><circle cx="200" cy="150" r="15" fill="%233b82f6" opacity="0.1"/><polygon points="100,20 120,40 100,60 80,40" fill="%2306b6d4" opacity="0.07"/><polygon points="320,180 340,200 320,220 300,200" fill="%238b5cf6" opacity="0.05"/><path d="M50,150 Q100,120 150,150 T250,150" stroke="%2306b6d4" stroke-width="1" fill="none" opacity="0.12"/><path d="M150,250 Q200,220 250,250 T350,250" stroke="%238b5cf6" stroke-width="1" fill="none" opacity="0.08"/><rect x="10" y="10" width="20" height="20" fill="%233b82f6" opacity="0.04" transform="rotate(45 20 20)"/><rect x="360" y="260" width="15" height="15" fill="%2306b6d4" opacity="0.06" transform="rotate(30 367.5 267.5)"/></svg>') center/cover;
    opacity: 0.7;
    z-index: 0;
    border-radius: 20px;
}

.news-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple), var(--accent-blue));
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

.news-card:hover::after {
    transform: scaleX(1);
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border-color: var(--accent-cyan);
}

.news-card > * {
    position: relative;
    z-index: 2;
}

.news-title {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 15px;
    margin-top: 0;
    line-height: 1.4;
    min-height: 1.4em;
    letter-spacing: -0.01em;
}

.news-title.no-title {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
    min-height: 1.4em;
}

.news-title a {
    color: inherit;
    text-decoration: none;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    background-size: 0% 2px;
    background-position: 0% 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}

.news-title a:hover {
    background-size: 100% 2px;
}

.news-title.no-title a:hover {
    color: var(--text-secondary);
}

.news-title:empty {
    display: none;
}

.news-date {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
}

.news-date::before {
    content: "⚡";
    font-size: 0.9rem;
    color: var(--accent-cyan);
}

.news-summary {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 0.95rem;
    min-height: 1.6em;
}

.news-summary.no-summary {
    color: var(--text-secondary);
    font-style: italic;
    font-weight: 400;
    opacity: 0.7;
}

.news-summary:empty {
    display: none;
}

.news-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-tech);
}

.news-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 12px 24px;
    background: var(--surface-glass);
    border-radius: 12px;
    border: 1px solid var(--border-tech);
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    align-self: center;
    width: fit-content;
}

.news-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.1), transparent);
    transition: left 0.6s;
}

.news-link:hover::before {
    left: 100%;
}

.news-link:hover {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-purple);
    transform: translateX(3px);
    border-color: var(--accent-cyan);
}

.news-link::after {
    content: "→";
    font-weight: bold;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.news-source {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
}

.footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border-tech);
    color: var(--text-secondary);
}

.footer p {
    margin-bottom: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.footer p:first-child {
    font-weight: 600;
    color: var(--text-primary);
}

.no-news {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin: 60px 0;
    padding: 50px;
    background: var(--surface-glass);
    border-radius: 20px;
    border: 1px dashed var(--border-tech);
}

.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--surface-glass);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--accent-cyan);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--accent-purple);
}

.back-to-top {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: var(--accent-cyan);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(6, 182, 212, 0.3);
    backdrop-filter: blur(10px);
}

.back-to-top:hover {
    background: var(--accent-purple);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.4);
}

.back-to-top:active {
    transform: translateY(-1px);
}

.back-to-top.show {
    display: block;
    animation: fadeInUp 0.3s ease;
}

@media (max-width: 768px) {
    .back-to-top.show {
        display: block;
    }
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
    }

    .header-container {
        grid-column: 1;
        order: 1;
    }

    .sidebar {
        position: static;
        max-height: 400px;
        order: 2;
    }

    .content-container {
        order: 3;
    }
}

@media (max-width: 768px) {
    .main-container {
        gap: 20px;
    }

    .header-container {
        padding: 40px 25px;
        margin: 10px;
    }

    .content-container, .sidebar {
        padding: 25px;
        margin: 0 10px;
    }

    .header h1 {
        font-size: 2.5rem;
    }

    .header h1::before {
        left: -50px;
        font-size: 2.2rem;
    }

    .header .subtitle {
        font-size: 1.1rem;
    }

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

    .sidebar {
        max-height: 350px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
}

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.news-card {
    animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.archive-item {
    animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.news-card:nth-child(1) { animation-delay: 0.1s; }
.news-card:nth-child(2) { animation-delay: 0.2s; }
.news-card:nth-child(3) { animation-delay: 0.3s; }
.news-card:nth-child(4) { animation-delay: 0.4s; }
.news-card:nth-child(5) { animation-delay: 0.5s; }
.news-card:nth-child(6) { animation-delay: 0.6s; }

.archive-item:nth-child(1) { animation-delay: 0.1s; }
.archive-item:nth-child(2) { animation-delay: 0.15s; }
.archive-item:nth-child(3) { animation-delay: 0.2s; }
.archive-item:nth-child(4) { animation-delay: 0.25s; }
.archive-item:nth-child(5) { animation-delay: 0.3s; }
