/* Tech News Enhanced Styling - Modern, Clean Design */
/* No Gradients, Improved Hover Effects, Better White Theme Support */

:root {
    /* Primary Colors */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;

    /* Light Theme */
    --light-bg: #ffffff;
    --light-surface: #f8fafc;
    --light-border: #e2e8f0;
    --light-text-primary: #0f172a;
    --light-text-secondary: #475569;
    --light-text-muted: #94a3b8;

    /* Dark Theme */
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-border: #334155;
    --dark-text-primary: #f1f5f9;
    --dark-text-secondary: #cbd5e1;
    --dark-text-muted: #64748b;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

/* Light Theme (Default) */
body, [data-theme="light"] {
    --bg-color: var(--light-bg);
    --surface-color: var(--light-surface);
    --border-color: var(--light-border);
    --text-primary: var(--light-text-primary);
    --text-secondary: var(--light-text-secondary);
    --text-muted: var(--light-text-muted);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-color: var(--dark-bg);
    --surface-color: var(--dark-surface);
    --border-color: var(--dark-border);
    --text-primary: var(--dark-text-primary);
    --text-secondary: var(--dark-text-secondary);
    --text-muted: var(--dark-text-muted);
}

/* Apply theme colors to body */
body {
    background-color: var(--bg-color);
    color: var(--text-primary);
}

/* Ensure all headings use proper theme colors */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--dark-text-primary);
}

/* Ensure all text elements use proper theme colors */
[data-theme="dark"] p,
[data-theme="dark"] span,
[data-theme="dark"] li {
    color: var(--dark-text-secondary);
}

/* Ensure links use proper colors */
[data-theme="dark"] a {
    color: var(--primary-color);
}

[data-theme="dark"] a:hover {
    color: var(--primary-hover);
}

/* =========================
   Hero Section
   ========================= */
.hero-section {
    padding: var(--space-12) 0;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

/* Ensure dark theme hero section has proper dark background */
[data-theme="dark"] .hero-section {
    background-color: var(--dark-bg);
    border-bottom-color: var(--dark-border);
}

.hero-featured {
    background-color: var(--bg-color);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    transition: var(--transition-base);
    border: 1px solid var(--border-color);
}

/* Ensure dark theme hero has proper dark background */
[data-theme="dark"] .hero-featured {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.hero-featured:hover {
    box-shadow: var(--shadow-2xl);
    transform: translateY(-4px);
}

.hero-image {
    position: relative;
    height: 500px;
    overflow: hidden;
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.hero-featured:hover .hero-image img {
    transform: scale(1.05);
}

.hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    padding: var(--space-12) var(--space-8);
    color: white;
}

.hero-category {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
}

.hero-title {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-4);
}

.hero-title a {
    color: white;
    text-decoration: none;
    transition: var(--transition-fast);
}

.hero-title a:hover {
    color: rgba(255, 255, 255, 0.9);
}

.hero-excerpt {
    font-size: 1.125rem;
    line-height: 1.6;
    margin-bottom: var(--space-6);
    color: rgba(255, 255, 255, 0.95);
}

.hero-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-4);
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.9);
}

.hero-meta span {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* =========================
   Articles Section
   ========================= */
.articles-section {
    padding: var(--space-16) 0;
    background-color: var(--bg-color);
}

/* Ensure dark theme articles section has proper dark background */
[data-theme="dark"] .articles-section {
    background-color: var(--dark-bg);
}

.section-header {
    text-align: center;
    margin-bottom: var(--space-12);
}

.section-title {
    font-size: clamp(2rem, 4vw, 2.5rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* Article Cards Grid */
.articles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

@media (min-width: 768px) {
    .articles-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Article Card - Enhanced Design */
.article-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: var(--transition-base);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Ensure dark theme cards have proper dark background */
[data-theme="dark"] .article-card {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition-base);
}

.article-card:hover::before {
    transform: scaleX(1);
}

.article-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-xl);
    transform: translateY(-8px);
}

.article-badge {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    background: #ef4444;
    color: white;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
    box-shadow: var(--shadow-md);
}

.article-image {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: var(--surface-color);
}

.article-image a {
    display: block;
    height: 100%;
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-slow);
}

.article-card:hover .article-image img {
    transform: scale(1.1) rotate(1deg);
}

.article-content {
    padding: var(--space-6);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    font-size: 0.875rem;
}

.category-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: var(--transition-fast);
}

.category-pill:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.article-meta time {
    color: var(--text-muted);
}

.article-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: var(--space-3);
    color: var(--text-primary);
}

.article-title a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-fast);
}

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

.article-excerpt {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
    flex-grow: 1;
}

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

.author-info {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition: var(--transition-fast);
}

.read-more:hover {
    color: var(--primary-hover);
    gap: var(--space-3);
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
    position: sticky;
    top: var(--space-6);
}

.sidebar-widget {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
}

/* Ensure dark theme sidebar widgets have proper dark background */
[data-theme="dark"] .sidebar-widget {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.sidebar-widget:hover {
    box-shadow: var(--shadow-md);
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--border-color);
}

.widget-title i {
    color: var(--primary-color);
}

/* Trending List */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.trending-item {
    display: flex;
    gap: var(--space-4);
    padding: var(--space-3);
    border-radius: var(--radius-lg);
    transition: var(--transition-fast);
}

.trending-item:hover {
    background-color: var(--surface-color);
}

/* Ensure dark theme trending item hover has proper dark background */
[data-theme="dark"] .trending-item:hover {
    background-color: var(--dark-surface);
}

.trending-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1.125rem;
}

.trending-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: var(--space-2);
}

.trending-content h4 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.trending-content h4 a:hover {
    color: var(--primary-color);
}

.trending-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Category Cards - Enhanced */
.categories-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.category-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
}

/* Ensure dark theme category cards have proper dark background */
[data-theme="dark"] .category-card {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
}

.category-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: currentColor;
    transition: var(--transition-base);
}

.category-card:hover {
    background-color: var(--bg-color);
    border-color: currentColor;
    box-shadow: var(--shadow-lg);
    transform: translateX(8px);
}

/* Ensure dark theme category card hover has proper dark background */
[data-theme="dark"] .category-card:hover {
    background-color: var(--dark-bg);
}

.category-card:hover .category-icon {
    transform: scale(1.2) rotate(5deg);
}

.category-icon {
    font-size: 1.75rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(var(--primary-color-rgb, 37, 99, 235), 0.1);
    transition: var(--transition-base);
}

.category-info {
    flex-grow: 1;
}

.category-info h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    margin-bottom: var(--space-1);
}

.category-info span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Newsletter Widget */
.newsletter-widget {
    background: var(--primary-color);
    color: white;
    border: none;
}

.newsletter-widget .widget-title {
    color: white;
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.newsletter-widget .widget-title i {
    color: white;
}

.newsletter-widget p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--space-4);
}

.newsletter-form .input-group {
    display: flex;
    gap: var(--space-2);
}

.newsletter-form .form-control {
    flex-grow: 1;
    padding: var(--space-3) var(--space-4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9375rem;
    transition: var(--transition-fast);
}

.newsletter-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.newsletter-form .form-control:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.2);
}

.newsletter-form .btn {
    padding: var(--space-3) var(--space-5);
    background: white;
    color: var(--primary-color);
    border: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.newsletter-form .btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.tag-pill {
    padding: var(--space-2) var(--space-3);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    transition: var(--transition-fast);
    position: relative;
}

/* Ensure dark theme tag pills have proper dark background */
[data-theme="dark"] .tag-pill {
    background-color: var(--dark-surface);
    border-color: var(--dark-border);
    color: var(--dark-text-secondary);
}

.tag-pill:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tag-pill::after {
    content: attr(data-count);
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.tag-pill:hover::after {
    background: var(--primary-hover);
}

/* =========================
   Responsive Design
   ========================= */
@media (max-width: 991px) {
    .sidebar {
        position: static;
        margin-top: var(--space-12);
    }

    .hero-image {
        height: 400px;
    }
}

@media (max-width: 767px) {
    .articles-grid {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .hero-image {
        height: 300px;
    }

    .hero-overlay {
        padding: var(--space-6) var(--space-5);
    }

    .hero-title {
        font-size: 1.5rem;
    }

    .hero-excerpt {
        font-size: 0.9375rem;
    }

    .article-image {
        height: 200px;
    }

    .section-header {
        margin-bottom: var(--space-8);
    }
}

@media (max-width: 575px) {
    .article-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-3);
    }

    .category-card {
        padding: var(--space-3);
    }

    .category-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}
