/* blog.css - Styles for blog pages */

/* Import base styles */
@import url('./base.css');
@import url('./components.css');
@import url('./themes.css');

/* Base layout */
body {
    background: var(--bg-color);
    color: var(--text-color);
}

/* Light mode base */
html.light body {
    background: #f9fafb;
    color: #111827;
}

html.light header {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #e5e7eb;
}

html.light footer {
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid #e5e7eb;
    color: #4b5563;
}

/* =================================================================
   BLOG LAYOUT
   ================================================================= */

/* Hero compacto como recursos */
.hero-section {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05), rgba(147, 51, 234, 0.05));
}

/* Hero title - Sin gradient, colores sólidos según tema */
.hero-section .gradient-text,
.hero-section h1 {
    color: #f9fafb; /* Blanco en modo oscuro */
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    background-clip: unset;
}

html.light .hero-section .gradient-text,
html.light .hero-section h1 {
    color: #111827; /* Negro en modo claro */
}

/* Quick nav buttons (como en recursos) */
.quick-nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    border-radius: 9999px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
}

.quick-nav-btn.blue {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
    color: #93c5fd;
}

.quick-nav-btn.blue:hover {
    background: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.quick-nav-btn.purple {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.4);
    color: #d8b4fe;
}

.quick-nav-btn.purple:hover {
    background: rgba(168, 85, 247, 0.4);
    transform: translateY(-2px);
}

html.light .quick-nav-btn.blue {
    background: rgba(59, 130, 246, 0.15);
    color: #1d4ed8;
}

html.light .quick-nav-btn.purple {
    background: rgba(168, 85, 247, 0.15);
    color: #7c3aed;
}

/* =================================================================
   BLOG POSTS SECTION
   ================================================================= */

.blog-posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

/* =================================================================
   BLOG FILTERS
   ================================================================= */

#blog-filters button {
    padding: 0.5rem 1.5rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-color);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

#blog-filters button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

#blog-filters button.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* =================================================================
   BLOG CARDS
   ================================================================= */

.blog-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    padding: 2rem;
    border-radius: 16px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    border-color: var(--primary-color);
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.category {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category.data-engineering {
    background: rgba(59, 130, 246, 0.2);
    color: rgb(147, 197, 253);
}

.category.python {
    background: rgba(234, 179, 8, 0.2);
    color: rgb(253, 224, 71);
}

.category.automation {
    background: rgba(34, 197, 94, 0.2);
    color: rgb(134, 239, 172);
}

.category.business-intelligence {
    background: rgba(147, 51, 234, 0.2);
    color: rgb(196, 181, 253);
}

.date {
    color: var(--secondary-color);
}

.blog-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.3;
    color: var(--text-color);
}

.blog-excerpt {
    color: var(--secondary-color);
    margin-bottom: 1.5rem;
    line-height: 1.6;
    flex-grow: 1;
}

.blog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.read-time {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.read-more {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: gap 0.3s ease;
}

.read-more:hover {
    gap: 0.75rem;
}

/* =================================================================
   VIDEOS SECTION
   ================================================================= */

#videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.video-card {
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.video-card:hover {
    transform: translateY(-4px);
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    background: #000;
}

.video-embed iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-content {
    padding: 1.5rem;
}

.video-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.video-description {
    font-size: 0.875rem;
    color: var(--secondary-color);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.video-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* =================================================================
   INDIVIDUAL POST PAGE
   ================================================================= */

.post-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

#post-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.post-category {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: var(--primary-color);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.post-title {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.post-meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--secondary-color);
    flex-wrap: wrap;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* =================================================================
   POST CONTENT STYLING
   ================================================================= */

.blog-post-content {
    color: var(--text-color);
    line-height: 1.8;
}

.blog-post-content h1,
.blog-post-content h2,
.blog-post-content h3 {
    color: var(--text-color);
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    line-height: 1.3;
}

.blog-post-content h1 {
    font-size: 2.25rem;
}

.blog-post-content h2 {
    font-size: 1.875rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.blog-post-content h3 {
    font-size: 1.5rem;
}

.blog-post-content p {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.blog-post-content ul,
.blog-post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
    color: var(--text-color);
}

.blog-post-content li {
    margin-bottom: 0.5rem;
}

.blog-post-content pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

.blog-post-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
    color: rgb(147, 197, 253);
}

.blog-post-content pre code {
    background: none;
    padding: 0;
    color: rgb(226, 232, 240);
}

.blog-post-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-color: rgba(59, 130, 246, 0.3);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.3s ease;
}

.blog-post-content a:hover {
    text-decoration-color: var(--primary-color);
}

.blog-post-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--secondary-color);
}

.blog-post-content table.markdown-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.blog-post-content table.markdown-table thead {
    background: rgba(59, 130, 246, 0.1);
}

.blog-post-content table.markdown-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
}

.blog-post-content table.markdown-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.blog-post-content table.markdown-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.blog-post-content table.markdown-table tbody tr:last-child td {
    border-bottom: none;
}

/* Light mode tables */
html.light .blog-post-content table.markdown-table {
    background: rgba(0, 0, 0, 0.02);
}

html.light .blog-post-content table.markdown-table thead {
    background: rgba(59, 130, 246, 0.1);
}

html.light .blog-post-content table.markdown-table td {
    border-bottom-color: rgba(0, 0, 0, 0.1);
}

/* =================================================================
   TABLE OF CONTENTS
   ================================================================= */

#post-toc {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: sticky;
    top: 5rem;
}

#post-toc h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list li.h3 {
    padding-left: 1rem;
}

.toc-list a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.toc-list a:hover {
    color: var(--primary-color);
}

/* =================================================================
   RELATED POSTS
   ================================================================= */

#related-posts {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-color);
}

#related-posts h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-post-card {
    padding: 1.5rem;
    border-radius: 12px;
    text-decoration: none;
    display: block;
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.related-post-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.related-post-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* =================================================================
   SHARE BUTTONS
   ================================================================= */

.post-share {
    margin: 3rem 0;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.post-share h4 {
    color: var(--text-color);
}

.post-share .flex {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.share-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    min-width: 140px;
}

.share-btn i {
    font-size: 1.25rem;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.share-btn.twitter {
    background: #000000;
    color: white;
}

.share-btn.twitter:hover {
    background: #1a1a1a;
}

.share-btn.linkedin {
    background: #0077B5;
    color: white;
}

.share-btn.linkedin:hover {
    background: #006399;
}

.share-btn.github {
    background: #333333;
    color: white;
}

.share-btn.github:hover {
    background: #24292e;
}

/* =================================================================
   RESPONSIVE
   ================================================================= */

@media (max-width: 768px) {
    .blog-posts-container {
        grid-template-columns: 1fr;
    }
    
    #videos-grid {
        grid-template-columns: 1fr;
    }
    
    .post-title {
        font-size: 1.875rem;
    }
    
    .post-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    #post-toc {
        position: static;
    }
    
    .post-share .flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .share-btn {
        width: 100%;
        justify-content: center;
    }
}

/* =================================================================
   LIGHT MODE - MEJORADO PARA LEGIBILIDAD
   ================================================================= */

html.light {
    --text-color: #111827;
    --secondary-color: #4b5563;
    --bg-color: #f9fafb;
    --border-color: #e5e7eb;
    --card-bg: rgba(255, 255, 255, 0.95);
}

html.light .hero-section {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(147, 51, 234, 0.08));
}

html.light .blog-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

html.light .blog-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    border-color: #3b82f6;
}

html.light .blog-title {
    color: #111827;
}

html.light .blog-excerpt {
    color: #4b5563;
}

html.light .date {
    color: #6b7280;
}

html.light #blog-filters button {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: #374151;
}

html.light #blog-filters button:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: #3b82f6;
    color: #1e40af;
}

html.light #blog-filters button.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

html.light .blog-post-content {
    color: #111827;
}

html.light .blog-post-content h1,
html.light .blog-post-content h2,
html.light .blog-post-content h3 {
    color: #111827;
    border-bottom-color: #e5e7eb;
}

html.light .blog-post-content p {
    color: #374151;
}

html.light .blog-post-content pre {
    background: #f3f4f6;
    border-color: #d1d5db;
}

html.light .blog-post-content code {
    background: #f3f4f6;
    color: #1e40af;
    border: 1px solid #e5e7eb;
}

html.light .blog-post-content pre code {
    background: none;
    color: #1f2937;
    border: none;
}

html.light .blog-post-content strong {
    color: #111827;
}

html.light .blog-post-content a {
    color: #2563eb;
    text-decoration-color: rgba(37, 99, 235, 0.3);
}

html.light .blog-post-content a:hover {
    text-decoration-color: #2563eb;
}

html.light .blog-post-content blockquote {
    border-left-color: #3b82f6;
    color: #4b5563;
    background: rgba(59, 130, 246, 0.05);
    padding: 1rem 1.5rem;
}

html.light .blog-post-content table.markdown-table {
    background: white;
    border-color: #d1d5db;
}

html.light .blog-post-content table.markdown-table thead {
    background: #f3f4f6;
}

html.light .blog-post-content table.markdown-table th {
    color: #111827;
    border-bottom-color: #3b82f6;
}

html.light .blog-post-content table.markdown-table td {
    color: #374151;
    border-bottom-color: #e5e7eb;
}

html.light .blog-post-content table.markdown-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

html.light #post-toc {
    background: white;
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

html.light #post-toc h4 {
    color: #111827;
}

html.light .toc-list a {
    color: #4b5563;
}

html.light .toc-list a:hover {
    color: #2563eb;
}

html.light .video-card {
    background: white;
    border: 1px solid #e5e7eb;
}

html.light .video-title {
    color: #111827;
}

html.light .video-description {
    color: #4b5563;
}

html.light .video-meta {
    color: #6b7280;
}

html.light .post-category {
    background: #3b82f6;
    color: white;
}

html.light .post-meta {
    color: #6b7280;
}

html.light .post-share {
    background: #f9fafb;
    border-color: #e5e7eb;
}

html.light .post-share h4 {
    color: #111827;
}

html.light .related-post-card {
    background: white;
    border-color: #e5e7eb;
}

html.light .related-post-card:hover {
    border-color: #3b82f6;
}

html.light .related-post-card h4 {
    color: #111827;
}

html.light .related-post-card p {
    color: #4b5563;
}

/* =================================================================
   LOADING STATES
   ================================================================= */

.blog-loading {
    text-align: center;
    padding: 4rem 1rem;
}

.blog-loading i {
    font-size: 3rem;
    color: var(--primary-color);
    animation: spin 1s linear infinite;
}

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

/* =================================================================
   ERROR STATES
   ================================================================= */

.error-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary-color);
}

.error-message i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-container {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-container a {
    color: var(--primary-color);
    text-decoration: underline;
}
