/* Thailand News Portal - Premium Design */

/* ===== CSS Variables ===== */
:root {
    /* Color Palette - Deep Navy + Gold/Orange Accents */
    --bg-dark: #0a0e17;
    --bg-card: #111827;
    --bg-card-hover: #1a2235;
    --bg-glass: rgba(17, 24, 39, 0.8);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-dark: #d97706;
    --accent-glow: rgba(245, 158, 11, 0.3);

    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --gradient-hero: linear-gradient(180deg, transparent 0%, rgba(10, 14, 23, 0.7) 50%, var(--bg-dark) 100%);
    --gradient-card: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);

    --border: rgba(255, 255, 255, 0.08);
    --border-accent: rgba(245, 158, 11, 0.3);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--accent-glow);

    /* Typography */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --container-width: 1400px;
    --header-height: 70px;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-light);
}

/* ===== Breaking News Ticker ===== */
.breaking-news {
    background: var(--gradient-accent);
    padding: 8px 0;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.breaking-label {
    background: var(--bg-dark);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 4px 12px;
    margin-left: 16px;
    border-radius: 4px;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.ticker-wrapper {
    flex: 1;
    overflow: hidden;
    margin-left: 16px;
}

.ticker {
    display: flex;
    gap: 60px;
    animation: ticker 30s linear infinite;
    white-space: nowrap;
}

.ticker-item {
    font-size: 13px;
    font-weight: 500;
    color: white;
    cursor: pointer;
}

.ticker-item:hover {
    text-decoration: underline;
}

@keyframes ticker {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

/* ===== Header ===== */
.header {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 32px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-icon {
    font-size: 32px;
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.4));
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.logo-tagline {
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search */
.search-container {
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Header Stats */
.header-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

/* ===== Category Navigation ===== */
.category-nav {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-nav-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    gap: 10px;
}

.category-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.category-pill:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.category-pill.active {
    background: var(--gradient-accent);
    border-color: transparent;
    color: white;
}

.pill-icon {
    font-size: 14px;
}

/* ===== Main Content ===== */
.main {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Hero Section ===== */
.hero {
    margin: 32px 0;
}

.hero-article {
    position: relative;
    height: 500px;
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.hero-article:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-glow);
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: var(--gradient-hero);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 48px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-accent);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    width: fit-content;
    margin-bottom: 16px;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    max-width: 800px;
}

.hero-excerpt {
    font-size: 18px;
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== Section Titles ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 24px;
}

.title-accent {
    width: 4px;
    height: 24px;
    background: var(--gradient-accent);
    border-radius: 2px;
}

/* ===== Featured Grid ===== */
.featured-section {
    margin: 48px 0;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.featured-card {
    position: relative;
    height: 320px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.featured-card:hover .featured-image {
    transform: scale(1.05);
}

.featured-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.featured-overlay {
    position: absolute;
    inset: 0;
    background: var(--gradient-card);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.featured-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 8px;
}

.featured-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===== Content Layout ===== */
.content-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 40px;
    margin: 48px 0;
}

/* Articles Stream */
.articles-stream {
    min-width: 0;
}

.stream-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.article-count {
    font-size: 14px;
    color: var(--text-muted);
}

.articles-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Article Card (List Style) */
.article-card {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
}

.article-card:hover {
    transform: translateX(4px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-sm);
}

.article-card:hover .card-image {
    transform: scale(1.05);
}

.card-image-wrapper {
    height: 180px;
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.card-content {
    padding: 20px 20px 20px 0;
    display: flex;
    flex-direction: column;
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.card-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.card-date {
    font-size: 12px;
    color: var(--text-muted);
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

.card-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.card-keyword {
    font-size: 11px;
    padding: 4px 10px;
    background: var(--bg-card-hover);
    border-radius: 100px;
    color: var(--text-muted);
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 40px;
}

.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    background: transparent;
    border: 2px solid var(--accent);
    border-radius: 100px;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    background: var(--accent);
    color: var(--bg-dark);
}

.load-more-btn svg {
    width: 16px;
    height: 16px;
    transform: rotate(-90deg);
}

/* ===== Sidebar ===== */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
}

.sidebar-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.sidebar-icon {
    font-size: 18px;
}

/* Trending */
.trending-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.trending-item {
    display: flex;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s;
}

.trending-item:hover {
    transform: translateX(4px);
}

.trending-rank {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-muted);
    width: 32px;
    flex-shrink: 0;
}

.trending-content {
    flex: 1;
}

.trending-title {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.trending-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Category Stats */
.category-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-card-hover);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-stat:hover {
    background: var(--bg-dark);
    border-left: 3px solid var(--accent);
}

.category-stat-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.category-stat-count {
    font-size: 12px;
    color: var(--accent);
    font-weight: 600;
}

/* About */
.about-card p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.about-features {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.about-features span {
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    margin-top: 64px;
    padding: 48px 24px 32px;
}

.footer-container {
    max-width: var(--container-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 32px;
    align-items: center;
}

.footer-brand {
    text-align: left;
}

.footer-logo {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.footer-brand p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    font-size: 14px;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--accent);
}

.footer-copy {
    text-align: right;
}

.footer-copy p {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Back to Top ===== */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: var(--bg-dark);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--accent-light);
    transform: translateY(-4px);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
}

/* ===== Loading States ===== */
.loading {
    text-align: center;
    padding: 60px;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 0%, var(--bg-card-hover) 50%, var(--bg-card) 100%);
    background-size: 200% 100%;
    animation: skeleton 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes skeleton {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .content-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .featured-grid {
        grid-template-columns: 1fr 1fr;
    }

    .featured-grid .featured-card:last-child {
        grid-column: span 2;
    }

    .header-stats {
        display: none;
    }
}

@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
        height: auto;
        padding: 16px;
        gap: 12px;
    }

    .search-container {
        order: 3;
        max-width: 100%;
        flex-basis: 100%;
    }

    .hero-article {
        height: 400px;
    }

    .hero-title {
        font-size: 28px;
    }

    .hero-overlay {
        padding: 24px;
    }

    .featured-grid {
        grid-template-columns: 1fr;
    }

    .featured-grid .featured-card:last-child {
        grid-column: span 1;
    }

    .article-card {
        grid-template-columns: 1fr;
    }

    .card-image-wrapper {
        height: 200px;
    }

    .card-content {
        padding: 20px;
    }

    .sidebar {
        grid-template-columns: 1fr;
    }

    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 20px;
    }

    .footer-brand,
    .footer-copy {
        text-align: center;
    }

    .footer-links {
        justify-content: center;
    }
}

/* ===== Article Detail Page ===== */
.article-detail {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.article-detail .back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    font-size: 14px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.article-detail .back-link:hover {
    color: var(--accent);
}

.article-detail .article-header {
    margin-bottom: 32px;
}

.article-detail .category-badge {
    display: inline-block;
    background: var(--gradient-accent);
    padding: 6px 14px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    margin-bottom: 16px;
}

.article-detail h1 {
    font-family: var(--font-display);
    font-size: 36px;
    line-height: 1.3;
    margin-bottom: 16px;
}

.article-detail .article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.article-detail figure {
    margin: 32px 0;
}

.article-detail figure img {
    width: 100%;
    height: auto;
    border-radius: 16px;
}

.article-detail figure figcaption {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
}

.article-detail .article-body {
    font-size: 18px;
    line-height: 1.8;
}

.article-detail .article-body p {
    margin-bottom: 24px;
}

.article-detail .article-keywords {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.article-detail .keywords-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.article-detail .keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.article-detail .keyword {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 13px;
    color: var(--text-secondary);
}

.article-detail .article-sources {
    margin-top: 32px;
}

.article-detail .sources-title {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.article-detail .sources-list {
    list-style: none;
}

.article-detail .sources-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.article-detail .sources-list li:last-child {
    border-bottom: none;
}

/* No results */
.no-results {
    text-align: center;
    padding: 80px 24px;
}

.no-results-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.no-results h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-muted);
}

/* ===== Legal Pages ===== */
.legal-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
}

.legal-page .back-link {
    display: inline-block;
    margin-bottom: 32px;
    color: var(--text-muted);
}

.legal-page .back-link:hover {
    color: var(--accent);
}

.legal-page h1 {
    font-family: var(--font-display);
    font-size: 36px;
    margin-bottom: 32px;
}

.legal-page h2 {
    font-size: 22px;
    margin: 32px 0 16px;
    color: var(--accent);
}

.legal-page h3 {
    font-size: 18px;
    margin: 20px 0 12px;
}

.legal-page p {
    margin-bottom: 16px;
    line-height: 1.8;
    color: var(--text-secondary);
}

.legal-page section {
    margin-bottom: 32px;
}

.legal-page ul {
    margin-left: 24px;
    margin-bottom: 16px;
}

.legal-page li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.legal-date {
    margin-top: 48px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ===== Contact Page ===== */
.contact-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 40px 24px;
}

.contact-page h1 {
    font-family: var(--font-display);
    font-size: 36px;
    margin-bottom: 16px;
}

.contact-intro {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-body);
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.checkbox-group {
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent);
}

.checkbox-group label {
    font-size: 13px;
    line-height: 1.5;
}

.honeypot {
    position: absolute;
    left: -9999px;
}

.submit-btn {
    padding: 16px 32px;
    background: var(--gradient-accent);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.form-note {
    font-size: 12px;
    color: var(--text-muted);
}

.success-message {
    text-align: center;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.success-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.success-message h3 {
    font-size: 24px;
    margin-bottom: 8px;
}

.success-message p {
    color: var(--text-secondary);
}

.contact-alternative {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.contact-alternative h3 {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* ===== Admin Console ===== */
.admin-login {
    max-width: 400px;
    margin: 80px auto;
    padding: 40px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.admin-login h1 {
    text-align: center;
    margin-bottom: 32px;
}

.admin-login .form-group {
    margin-bottom: 20px;
}

.admin-dashboard {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 24px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.admin-header h1 {
    font-size: 28px;
}

.logout-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.stat-card .stat-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.stat-card .stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.admin-section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.admin-table th {
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover {
    background: var(--bg-card-hover);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status-badge.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--accent);
}

.message-card {
    background: var(--bg-card-hover);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.message-from {
    font-weight: 600;
}

.message-date {
    font-size: 12px;
    color: var(--text-muted);
}

.message-subject {
    color: var(--accent);
    font-size: 14px;
    margin-bottom: 8px;
}

.message-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ===== Article Body Styling ===== */
.article-body .lead-sentence {
    font-size: 1.1em;
    color: var(--text-primary);
}

.article-body p:first-of-type {
    font-size: 19px;
    line-height: 1.7;
}

.keyword-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dotted var(--accent);
    transition: all 0.2s;
}

.keyword-link:hover {
    color: var(--accent-light);
    border-bottom-style: solid;
}

/* Keyword tags as links */
.article-detail .keyword {
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.article-detail .keyword:hover {
    background: var(--accent);
    color: var(--bg-dark);
    border-color: var(--accent);
}

/* ===== Admin Trigger ===== */
.admin-trigger {
    cursor: pointer;
    transition: color 0.3s;
}

.admin-trigger:hover {
    color: var(--accent);
}

/* ===== Admin Modal ===== */
.admin-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.admin-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 18px;
    margin: 0;
}

.modal-controls {
    display: flex;
    gap: 8px;
}

.modal-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: var(--bg-dark);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-btn:hover {
    background: var(--accent);
    color: white;
}

.close-btn:hover {
    background: #ef4444;
}

.modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ===== Admin Minimized Bar ===== */
.admin-minimized {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    box-shadow: var(--shadow-md);
}

.admin-minimized button {
    background: var(--accent);
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    color: white;
    font-size: 12px;
    cursor: pointer;
}

/* ===== Admin Stats Mini ===== */
.admin-stats-mini {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.stat-mini {
    flex: 1;
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    font-size: 13px;
}

.stat-mini span {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

/* ===== Admin Tabs ===== */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ===== Mini Table ===== */
.mini-table {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.stat-row:last-child {
    border-bottom: none;
}

/* ===== Message Items ===== */
.message-item {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
    border-left: 3px solid var(--accent);
}

.message-item.read {
    border-left-color: #22c55e;
    opacity: 0.7;
}

.msg-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
}

.msg-date {
    font-size: 11px;
    color: var(--text-muted);
}

.msg-subject {
    color: var(--accent);
    font-size: 12px;
    margin-bottom: 6px;
}

.msg-body {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    line-height: 1.5;
}

.msg-email {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.msg-actions {
    display: flex;
    gap: 8px;
}

.msg-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.done-btn {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.done-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.delete-btn:hover {
    background: #ef4444;
    color: white;
}

/* ===== Ad Info ===== */
.ad-info {
    background: var(--bg-dark);
    border-radius: 8px;
    padding: 12px;
}

.ad-info div {
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.ad-info div:last-child {
    border-bottom: none;
}

/* ===== Affiliate Placeholders ===== */
.affiliate-placeholder {
    background: repeating-linear-gradient(45deg,
            var(--bg-card),
            var(--bg-card) 10px,
            var(--bg-dark) 10px,
            var(--bg-dark) 20px);
    border: 2px dashed var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    min-height: 90px;
    margin: 24px 0;
}

.affiliate-placeholder.wide {
    height: 90px;
}

.affiliate-placeholder:not(.wide) {
    height: 250px;
}

/* ===== Admin Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid var(--border);
}

.stat-card.full-width {
    grid-column: 1 / -1;
}

.stat-card h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
}

.stat-card .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card .stat-row:last-child {
    border-bottom: none;
}

.stat-card strong {
    color: var(--text-primary);
}

/* Category List in Card */
.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    display: flex;
    gap: 6px;
}

.category-badge span:last-child {
    color: var(--accent);
    font-weight: bold;
}

/* ===== Affiliate Manager ===== */
.affiliates-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.affiliate-item {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 14px;
    border: 1px solid var(--border);
}

.affiliate-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.affiliate-header strong {
    color: var(--accent);
    font-size: 14px;
}

.affiliate-info {
    font-size: 12px;
    color: var(--text-muted);
}

.affiliate-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 100px;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    margin-left: auto;
}

.affiliate-status.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.affiliate-script {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: monospace;
    font-size: 11px;
    resize: vertical;
    margin-bottom: 10px;
}

.affiliate-script:focus {
    outline: none;
    border-color: var(--accent);
}

.affiliate-save-btn {
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.affiliate-save-btn:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

/* Tall affiliate placeholder */
.affiliate-placeholder.tall {
    height: 600px;
}

/* Extra wide affiliate placeholder */
.affiliate-placeholder.extra-wide {
    height: 90px;
    max-width: 970px;
    margin-left: auto;
    margin-right: auto;
}

/* Ad content container */
.ad-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Image Generator UI ===== */
.images-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.generate-all-btn {
    padding: 10px 16px;
    background: var(--gradient-accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.generate-all-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.generate-all-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.missing-images-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.missing-image-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-dark);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.missing-image-item .article-id {
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    min-width: 40px;
}

.missing-image-item .article-title {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gen-single-btn {
    padding: 6px 10px;
    background: var(--accent);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.gen-single-btn:hover:not(:disabled) {
    background: var(--accent-light);
}

.gen-single-btn:disabled {
    cursor: wait;
}

.generation-progress {
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-dark);
    border-radius: 8px;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s;
}

/* ===== TTS Controls ===== */
.tts-controls {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.tts-btn {
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tts-btn:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}

.tts-btn.stop {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.tts-btn.stop:hover {
    background: #ef4444;
    color: white;
}

/* ===== Mobile Bottom Navigation ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 4px 0;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
    z-index: 1000;
    justify-content: space-around;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 4px 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    min-width: 50px;
}

.bottom-nav-item .nav-icon {
    font-size: 16px;
}

.bottom-nav-item .nav-label {
    font-weight: 500;
}

.bottom-nav-item.active,
.bottom-nav-item:hover {
    color: var(--accent);
}

.bottom-nav-item.active .nav-icon {
    transform: scale(1.1);
}

/* ===== Mobile-specific Improvements ===== */
@media (max-width: 768px) {

    /* Show bottom nav */
    .bottom-nav {
        display: flex;
    }

    /* Add padding for bottom nav */
    body {
        padding-bottom: 70px;
    }

    /* Hide desktop elements */
    .sidebar {
        display: none;
    }

    /* Improve hero on mobile */
    .hero-article {
        height: 300px;
        border-radius: 0;
        margin: 0 -24px;
        width: calc(100% + 48px);
    }

    .hero-title {
        font-size: 22px;
        line-height: 1.3;
    }

    .hero-summary {
        display: none;
    }

    /* Category pills - horizontal scroll */
    .category-nav-container {
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .category-nav-container::-webkit-scrollbar {
        display: none;
    }

    .category-pill {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Featured cards - swipe-friendly */
    .featured-grid {
        display: flex;
        overflow-x: auto;
        gap: 16px;
        padding: 0 24px 16px;
        margin: 0 -24px;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .featured-card {
        min-width: 280px;
        scroll-snap-align: start;
    }

    /* Article cards - full width, larger touch targets */
    .article-card {
        padding: 0;
    }

    .card-content {
        padding: 16px;
    }

    .card-title {
        font-size: 16px;
    }

    /* Bigger touch targets */
    .category-pill {
        padding: 10px 16px;
        font-size: 13px;
    }

    /* Footer adjustments */
    .footer {
        padding-bottom: 80px;
    }

    /* Back-to-top - move to top right on mobile */
    .back-to-top {
        bottom: auto;
        top: 80px;
        right: 16px;
        width: 40px;
        height: 40px;
    }

    .back-to-top svg {
        width: 16px;
        height: 16px;
    }

    /* Breaking news - compact */
    .breaking-news {
        padding: 6px 0;
    }

    .breaking-label {
        font-size: 9px;
        padding: 3px 8px;
    }
}

/* Extra small screens (iPhone SE, etc.) */
@media (max-width: 480px) {
    .header-container {
        padding: 12px;
    }

    .logo-text h1 {
        font-size: 18px;
    }

    .logo-icon {
        font-size: 28px;
    }

    .hero-title {
        font-size: 20px;
    }

    .featured-card {
        min-width: 260px;
    }

    .section-title {
        font-size: 18px;
    }

    .main {
        padding: 0 16px;
    }

    /* Compact article cards */
    .card-image-wrapper {
        height: 160px;
    }
}

/* ===== Article Detail Mobile Optimization ===== */
@media (max-width: 768px) {

    /* Article image - smaller on mobile */
    .article-detail figure img,
    #articleImage {
        max-height: 250px;
        object-fit: cover;
        width: 100%;
    }

    /* Article title - 20% smaller */
    .article-detail h1,
    #articleTitle {
        font-size: 1.5rem !important;
        line-height: 1.3;
    }

    /* Article body text - 20% smaller */
    .article-body,
    #articleBody {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    .article-body p,
    #articleBody p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* Lead sentence - slightly larger but still reduced */
    .lead-sentence {
        font-size: 1rem !important;
    }

    /* Article meta info */
    .article-meta {
        font-size: 0.75rem;
    }

    /* Category badge */
    .article-detail .category-badge {
        font-size: 0.7rem;
        padding: 4px 10px;
    }

    /* TTS controls - smaller on mobile */
    .tts-controls {
        flex-wrap: wrap;
    }

    .tts-btn {
        font-size: 0.8rem;
        padding: 8px 14px;
    }

    /* Keywords - smaller */
    .keyword-tag {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    /* Sources section */
    .sources-section {
        font-size: 0.85rem;
    }

    /* Article header spacing */
    .article-header {
        padding: 0 12px;
    }

    /* Back link */
    .back-link {
        font-size: 0.85rem;
    }
}

/* Extra small screens - even smaller */
@media (max-width: 480px) {

    .article-detail h1,
    #articleTitle {
        font-size: 1.3rem !important;
    }

    .article-body,
    #articleBody {
        font-size: 0.85rem;
    }

    .article-body p,
    #articleBody p {
        font-size: 0.85rem;
    }

    .lead-sentence {
        font-size: 0.95rem !important;
    }

    .article-detail figure img,
    #articleImage {
        max-height: 200px;
    }
}

/* ===== PWA Install Banner ===== */
.install-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 1001;
    box-shadow: var(--shadow-glow);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

.install-banner span {
    font-size: 14px;
    color: var(--text-primary);
}

.install-banner button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.install-banner button:first-of-type {
    background: var(--gradient-accent);
    color: white;
}

.install-banner button:first-of-type:hover {
    transform: scale(1.05);
}

.install-banner button.dismiss {
    background: transparent;
    color: var(--text-muted);
    padding: 8px;
}

.install-banner button.dismiss:hover {
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .install-banner {
        bottom: 90px;
        left: 16px;
        right: 16px;
        transform: none;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}

/* ===== Header Install Button ===== */
.header-install-btn {
    padding: 8px 14px;
    background: var(--gradient-accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.header-install-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

/* ===== Auto-Hide Header on Scroll ===== */
.header {
    transition: transform 0.3s ease;
}

.header.hidden {
    transform: translateY(-100%);
}

/* ===== Mobile Categories Popup ===== */
.categories-popup {
    position: fixed;
    bottom: 50px;
    left: 10px;
    right: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    z-index: 999;
    max-height: 50vh;
    overflow-y: auto;
    display: none;
    animation: slideUp 0.2s ease-out;
    box-shadow: var(--shadow-md);
}

.categories-popup.visible {
    display: block;
}

.categories-popup h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--text-muted);
}

.categories-popup .category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.categories-popup .popup-category {
    padding: 12px;
    background: var(--bg-dark);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-size: 14px;
}

.categories-popup .popup-category:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
}

.categories-popup .popup-category .cat-icon {
    font-size: 20px;
}

.categories-popup .popup-category .cat-count {
    margin-left: auto;
    background: var(--accent);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.categories-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

.categories-popup-overlay.visible {
    display: block;
}

/* ===== Affiliate Placeholders (Admin Only) ===== */
.affiliate-placeholder {
    display: none;
    /* Hidden by default for normal users */
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    text-align: center;
}

.affiliate-placeholder .ad-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.affiliate-placeholder.wide {
    max-width: 728px;
    margin: 24px auto;
}

.affiliate-placeholder.tall {
    min-height: 300px;
}

.affiliate-placeholder.extra-wide {
    max-width: 970px;
    margin: 24px auto;
}

/* Show placeholders when admin is logged in */
body.admin-mode .affiliate-placeholder {
    display: block;
}

/* Affiliate link asterisk marker */
.affiliate-link::after,
a[href*="affiliate"]::after,
a[data-affiliate]::after {
    content: " *";
    color: var(--accent);
    font-weight: bold;
}

/* ===== Analytics Tab Styles ===== */
.analytics-period-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.period-btn {
    padding: 8px 16px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}

.period-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

.analytics-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.analytics-stat {
    background: var(--bg-card-hover);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.analytics-stat .stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.analytics-stat .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.daily-chart {
    background: var(--bg-card-hover);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.daily-chart h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.daily-bars {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 60px;
    overflow-x: auto;
}

.daily-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 30px;
}

.daily-bar .bar {
    width: 20px;
    background: var(--gradient-accent);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s;
}

.daily-bar .date {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
}

.top-articles h4 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.analytics-article-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-card-hover);
    border-radius: 8px;
    margin-bottom: 8px;
}

.analytics-article-item .rank {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    min-width: 30px;
}

.analytics-article-item .title {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analytics-article-item .views {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== Affiliate Admin Redesign ===== */

/* Sub-tabs in Ads section */
.ads-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

.subtab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.subtab-btn:hover {
    background: var(--bg-card-hover);
}

.subtab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
}

.ads-subtab-content {
    display: none;
}

.ads-subtab-content.active {
    display: block;
}

/* Placements List */
.placements-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.placement-card {
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}

.placement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.placement-header strong {
    color: var(--accent);
}

.placement-info {
    font-size: 12px;
    color: var(--text-muted);
}

.placement-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-card);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.checkbox-option:hover {
    background: var(--bg-card-hover);
}

.checkbox-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.checkbox-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.placement-selects {
    margin: 12px 0;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 8px;
}

.placement-selects label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.placement-selects select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.placement-save-btn {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.placement-save-btn:hover {
    background: var(--accent-light);
}

/* Banners Header */
.banners-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.banners-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.add-banner-btn {
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.add-banner-btn:hover {
    background: var(--accent-light);
}

/* Banners List */
.banners-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.banner-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.banner-info strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}

.banner-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.banner-actions {
    display: flex;
    gap: 8px;
}

.banner-actions button {
    padding: 6px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.banner-actions .edit-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
}

.banner-actions .delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Banner Modal */
.banner-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

/* === Banner Modal Overlay === */
.banner-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.banner-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.banner-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.banner-modal-header h3 {
    font-size: 18px;
    color: var(--text-primary);
}

.close-banner-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.banner-modal form {
    padding: 20px;
}

.banner-modal .form-group {
    margin-bottom: 16px;
}

.banner-modal .form-group label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.banner-modal .form-group input,
.banner-modal .form-group select,
.banner-modal .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
}

.banner-modal .form-group textarea {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    resize: vertical;
}

.banner-modal .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.banner-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.banner-modal-actions .cancel-btn {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
}

.banner-modal-actions .save-btn {
    padding: 10px 20px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-weight: 600;
    cursor: pointer;
}

/* === Ads Subtabs === */
.ads-subtabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.subtab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.subtab-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.subtab-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-dark);
    font-weight: 600;
}

.ads-subtab-content {
    display: none;
}

.ads-subtab-content.active {
    display: block;
}

/* Banners Library Header */
.banners-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.banners-header p {
    font-size: 14px;
    color: var(--text-muted);
}

.add-banner-btn {
    padding: 8px 16px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.add-banner-btn:hover {
    background: var(--accent-light);
}

/* Banner Items */
.banner-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
}

.banner-info strong {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
}

.banner-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.banner-actions {
    display: flex;
    gap: 8px;
}

.banner-actions button {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.banner-actions .edit-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    border-color: var(--accent);
}

.banner-actions .delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}