/**
 * TutoScore - Blog Styles
 */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #7c3aed;
    --accent: #06b6d4;
    --success: #10b981;
    --dark: #1e293b;
    --gray-900: #0f172a;
    --gray-700: #334155;
    --gray-500: #64748b;
    --gray-300: #cbd5e1;
    --gray-100: #f1f5f9;
    --white: #ffffff;
    --gradient-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--white);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-100);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.nav-logo img {
    height: 60px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-link {
    padding: 8px 16px;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
}

/* Module Dropdown */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    color: var(--gray-700);
    font-weight: 500;
    font-size: 1rem;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.nav-dropdown-btn:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-dropdown-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
}

.nav-dropdown.open .nav-dropdown-btn svg {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1001;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.nav-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-dropdown-menu a:hover {
    background: var(--gray-100);
    color: var(--primary);
}

.nav-dropdown-menu a svg {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.lang-selector {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}

.lang-btn {
    width: 25px;
    height: 25px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0.75;
    transition: all 0.2s;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

.lang-btn:hover,
.lang-btn.active {
    opacity: 1;
    transform: scale(1.15);
}

.lang-btn.fr { background-image: url('../images/fr.png'); }
.lang-btn.en { background-image: url('../images/en.png'); }
.lang-btn.es { background-image: url('../images/es.png'); }

/* Blog Header */
.blog-header {
    padding: 120px 24px 60px;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4f46e5;
    background-image: linear-gradient(135deg, rgba(37, 99, 235, 0.85) 0%, rgba(124, 58, 237, 0.85) 100%), url('../images/blog-hero.webp');
    background-size: 100% auto;
    background-position: center center;
    background-repeat: no-repeat;
    text-align: center;
}

.blog-header-content {
    max-width: 800px;
    margin: 0 auto;
}

.blog-header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 16px;
}

.blog-header p {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Blog Main */
.blog-main {
    flex: 1;
    padding: 60px 24px;
    background: var(--gray-100);
}

.blog-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Blog Grid */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

/* Blog Card */
.blog-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}

.blog-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* Blog Card Image (Thumbnail) */
.blog-card-image {
    width: 100%;
    height: 0;
    padding-bottom: 32.1%; /* Ratio 680x218 = 32.05% */
    position: relative;
    overflow: hidden;
    background: var(--gray-100);
}

.blog-card-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-content {
    padding: 24px;
}

.blog-card-date {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 12px;
}

.blog-card-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 12px;
    line-height: 1.4;
}

.blog-card-excerpt {
    font-size: 0.95rem;
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-read-more {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    transition: color 0.2s;
}

.blog-card:hover .blog-card-read-more {
    color: var(--primary-dark);
}

/* Loading */
.blog-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--gray-500);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-300);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* Empty State */
.blog-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    color: var(--gray-500);
    text-align: center;
}

.blog-empty svg {
    margin-bottom: 24px;
    opacity: 0.5;
}

.blog-empty p {
    font-size: 1.125rem;
}

/* Load More */
.blog-load-more {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.btn-load-more {
    padding: 12px 32px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-load-more:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-load-more:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Error */
.blog-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--gray-500);
}

/* ============================================
   ARTICLE PAGE
   ============================================ */

.article-main {
    flex: 1;
    padding: 100px 24px 60px;
    background: var(--white);
}

.article-container {
    max-width: 800px;
    margin: 0 auto;
}

.back-to-blog {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    margin-bottom: 32px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.back-to-blog:hover {
    background: var(--gray-100);
    color: var(--primary);
}

/* Article Loading */
.article-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px;
    color: var(--gray-500);
}

/* Article Not Found */
.article-not-found {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
    color: var(--gray-500);
}

.article-not-found svg {
    margin-bottom: 24px;
    opacity: 0.5;
}

.article-not-found h2 {
    font-size: 1.5rem;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.article-not-found p {
    margin-bottom: 24px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--white);
    background: var(--primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-back:hover {
    background: var(--primary-dark);
}

/* Language Warning */
.lang-warning {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 24px;
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 8px;
    color: #92400e;
    font-size: 0.875rem;
}

.lang-warning svg {
    flex-shrink: 0;
}

/* Article Content */
.article-content {
    /* Container is styled by JS */
}

/* Article Hero Image */
.article-hero {
    width: 100%;
    margin-bottom: 32px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.article-hero img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 2000 / 642;
    object-fit: cover;
}

.article-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gray-100);
}

.article-date {
    display: block;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.article-title {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

/* Article Body - Markdown Content */
.article-body {
    font-size: 1.0625rem;
    line-height: 1.8;
    color: var(--gray-700);
}

.article-body h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 48px 0 24px;
}

.article-body h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 36px 0 16px;
}

.article-body h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin: 24px 0 12px;
}

.article-body p {
    margin-bottom: 20px;
}

.article-body ul,
.article-body ol {
    margin: 20px 0;
    padding-left: 28px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body blockquote {
    margin: 24px 0;
    padding: 20px 24px;
    background: var(--gray-100);
    border-left: 4px solid var(--primary);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--gray-700);
}

.article-body blockquote p:last-child {
    margin-bottom: 0;
}

.article-body code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--secondary);
}

.article-body pre {
    margin: 24px 0;
    padding: 20px;
    background: var(--gray-900);
    border-radius: 8px;
    overflow-x: auto;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: #e0e0e0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.article-body a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body a:hover {
    color: var(--primary-dark);
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
}

.article-body hr {
    margin: 40px 0;
    border: none;
    border-top: 1px solid var(--gray-300);
}

.article-body table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
}

.article-body th,
.article-body td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-300);
}

.article-body th {
    font-weight: 600;
    color: var(--gray-900);
    background: var(--gray-100);
}

/* Article Footer */
.article-footer {
    margin-top: 60px;
    padding-top: 32px;
    border-top: 1px solid var(--gray-100);
}

.btn-back-bottom {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    background: var(--gray-100);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-back-bottom:hover {
    background: var(--gray-200);
    color: var(--primary);
}

/* Footer */
.footer {
    padding: 60px 24px 32px;
    background: var(--gray-900);
    color: var(--gray-300);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-main {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    padding-bottom: 48px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-brand img {
    height: 48px;
    margin-bottom: 16px;
}

.footer-brand p {
    font-size: 0.875rem;
    line-height: 1.7;
}

.footer-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--white);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--gray-300);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 32px;
    text-align: center;
    font-size: 0.875rem;
}

/* Legacy blog-footer (backward compatibility) */
.blog-footer {
    padding: 24px;
    background: var(--gray-900);
    color: var(--gray-300);
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        height: 64px;
    }

    .nav-links {
        gap: 4px;
    }

    .nav-link {
        padding: 6px 12px;
        font-size: 0.875rem;
    }

    .blog-header {
        padding: 100px 16px 40px;
    }

    .blog-header h1 {
        font-size: 2rem;
    }

    .blog-header p {
        font-size: 1rem;
    }

    .blog-main {
        padding: 40px 16px;
    }

    .blog-grid {
        grid-template-columns: 1fr;
    }

    .footer-main {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }

    .footer-brand {
        grid-column: span 2;
    }

    .article-main {
        padding: 80px 16px 40px;
    }

    .article-title {
        font-size: 1.75rem;
    }

    .article-body {
        font-size: 1rem;
    }

    .article-body h2 {
        font-size: 1.5rem;
    }

    .article-body h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .nav-link {
        display: none;
    }

    .nav-link.active {
        display: block;
    }

    .lang-selector {
        margin-left: 8px;
    }

    .blog-header h1 {
        font-size: 1.75rem;
    }
}
