/* ==========================================================================
   Variables & Theme Setup
   ========================================================================== */
:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --badge-bg: rgba(99, 102, 241, 0.15);
    --badge-text: #818cf8;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

[data-theme="light"] {
    --bg-main: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --badge-bg: rgba(79, 70, 229, 0.1);
    --badge-text: #4f46e5;
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    padding-bottom: 60px;
    position: relative;
    overflow-x: hidden;
}

/* Ambient Background Light */
.ambient-bg {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
}

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

/* ==========================================================================
   Navbar
   ========================================================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
}

.logo-icon { font-size: 1.8rem; }
.logo h2 { font-size: 1.5rem; font-weight: 700; }
.logo h2 span { color: var(--accent); }

.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
}
.theme-toggle:hover { transform: scale(1.05); }

/* ==========================================================================
   Featured Hero Card
   ========================================================================== */
.featured-wrapper { margin: 20px 0 40px; }

.featured-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    box-shadow: var(--shadow);
}

.featured-badge {
    display: inline-block;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.featured-content h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    margin-bottom: 14px;
    line-height: 1.2;
}

.featured-content p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
}

.meta-info {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.featured-image-holder {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: white;
}

/* ==========================================================================
   Controls & Filter Section
   ========================================================================== */
.controls-section { margin-bottom: 30px; }

.search-sort-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.search-box {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    padding: 14px 40px 14px 45px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.search-box input:focus { border-color: var(--accent); }

.clear-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: none;
}

.sort-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0 16px;
    border-radius: 12px;
    color: var(--text-secondary);
}

.sort-box select {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.category-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 18px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
}

.pill.active, .pill:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.results-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.blog-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: relative;
}

.blog-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.category-badge {
    background: var(--badge-bg);
    color: var(--badge-text);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.new-tag {
    background: #10b981;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

.card-actions button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    margin-left: 8px;
}

.card-actions button:hover { color: var(--accent); }

.blog-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 10px;
    line-height: 1.4;
}

.blog-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(10px);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .featured-card { grid-template-columns: 1fr; }
    .search-sort-bar { flex-direction: column; }
}
