/* Universal Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f8fafc;
    color: #0f172a;
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: #0f172a;
}

.logo span {
    color: #2563eb;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 20px;
}

.nav-links a {
    text-decoration: none;
    color: #475569;
    font-weight: 500;
    padding: 5px 0;
}

.nav-links a:hover, .nav-links a.active {
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

/* Hero */
.hero {
    background: #ffffff;
    padding: 40px 0;
    border-bottom: 1px solid #e2e8f0;
    text-align: center;
}

.hero h1 {
    font-size: 2.2rem;
    margin-bottom: 10px;
}

.hero p {
    color: #64748b;
    font-size: 1.1rem;
}

/* Layout */
.main-content, .article-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 50px;
}

/* Cards Feed */
.card-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.card {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 280px 1fr;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

.card-img {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.card-body {
    padding: 20px;
}

.category {
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-block;
}

.card h3 {
    margin: 10px 0;
    font-size: 1.3rem;
}

.card h3 a {
    text-decoration: none;
    color: #0f172a;
}

.card h3 a:hover {
    color: #2563eb;
}

.card p {
    color: #475569;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.read-more {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

/* Article Copy & Media */
.article-content {
    background: #ffffff;
    padding: 35px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.article-content h1 {
    font-size: 2rem;
    margin: 10px 0;
}

.article-content .meta {
    color: #64748b;
    font-size: 0.88rem;
    margin-bottom: 20px;
}

.featured-media, .article-img-box {
    margin: 20px 0;
}

.featured-media img, .article-img-box img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 6px;
}

figcaption {
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
    margin-top: 8px;
    font-style: italic;
}

.lead {
    font-size: 1.15rem;
    color: #334155;
    margin-bottom: 20px;
}

.article-content h2 {
    margin: 30px 0 12px;
    font-size: 1.4rem;
}

.article-content p {
    margin-bottom: 16px;
    color: #334155;
}

.article-content ul, .article-content ol {
    margin: 10px 0 20px 20px;
    color: #334155;
}

.article-content li {
    margin-bottom: 8px;
}

/* Tables */
.table-container {
    overflow-x: auto;
    margin: 25px 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

th, td {
    padding: 12px 15px;
    border: 1px solid #e2e8f0;
    text-align: left;
}

th {
    background-color: #f1f5f9;
    color: #0f172a;
}

/* Buttons */
.page-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.nav-btn {
    text-decoration: none;
    background: #f1f5f9;
    color: #0f172a;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
}

.next-btn {
    background: #2563eb;
    color: #ffffff;
}

/* Ads & Widgets */
.widget {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}

.ad-slot {
    background: #e2e8f0;
    border: 2px dashed #94a3b8;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin: 20px 0;
    border-radius: 6px;
}

.ad-leaderboard { height: 90px; width: 100%; }
.ad-banner { height: 120px; width: 100%; }
.ad-sidebar { height: 250px; width: 100%; position: sticky; top: 90px; }

/* Footer */
footer {
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    padding: 25px 0;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #64748b;
    font-size: 0.9rem;
}

.footer-links {
    display: flex;
    list-style: none;
    gap: 15px;
}

.footer-links a {
    color: #64748b;
    text-decoration: none;
}

/* Responsive */
@media (max-width: 768px) {
    .main-content, .article-layout {
        grid-template-columns: 1fr;
    }
    
    .card {
        grid-template-columns: 1fr;
    }
    
    .card-img {
        height: 200px;
    }
}

/* Code Snippet Container */
.code-block {
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid #334155;
}

.code-header {
    background: #1e293b;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #94a3b8;
    font-size: 0.85rem;
    font-family: monospace;
}

.copy-btn {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.copy-btn:hover {
    background: #1d4ed8;
}

.code-block pre {
    padding: 16px;
    margin: 0;
    overflow-x: auto;
    color: #f8fafc;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Filter Bar */
.filter-section {
    margin-bottom: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#searchInput {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

#searchInput:focus {
    border-color: #2563eb;
}

.tag-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tag-btn {
    background: #e2e8f0;
    color: #475569;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

.tag-btn.active, .tag-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

/* Progress Bar */
.progress-bar-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    background: #2563eb;
    width: 0%;
    transition: width 0.1s ease-out;
}

.meta-pills {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 8px 0;
}

.pill {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
}

.level-pill {
    background: #fef3c7;
    color: #d97706;
}

.time-pill {
    background: #f1f5f9;
    color: #64748b;
}

/* Newsletter Widget Styles */
.newsletter-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #334155;
    border-radius: 10px;
    padding: 1.75rem;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 2rem 0;
}

.newsletter-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #f8fafc;
}

.newsletter-card p {
    font-size: 0.875rem;
    color: #94a3b8;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.newsletter-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid #475569;
    background-color: #0f172a;
    color: #f8fafc;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.newsletter-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}

.newsletter-input::placeholder {
    color: #64748b;
}

.newsletter-btn {
    width: 100%;
    background-color: #2563eb;
    color: #ffffff;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s ease;
}

.newsletter-btn:hover {
    background-color: #1d4ed8;
}

.newsletter-privacy {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.75rem;
    display: block;
    text-align: center;
}

/* Success State */
.newsletter-success {
    display: none;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid #22c55e;
    color: #4ade80;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    text-align: center;
}

/* Enhanced Success Box */
.newsletter-success {
    display: none;
    background: #0f291e;
    border: 1px solid #22c55e;
    color: #f8fafc;
    padding: 1.25rem;
    border-radius: 8px;
    text-align: center;
    animation: fadeIn 0.3s ease-in-out;
}

.newsletter-success .success-icon {
    font-size: 1.8rem;
    color: #22c55e;
    margin-bottom: 0.5rem;
}

.newsletter-success h4 {
    color: #22c55e;
    font-size: 1.1rem;
    margin-bottom: 0.4rem;
}

.newsletter-success p {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

