/*
Theme Name: AnhAnime4K
Theme URI: http://localhost:8080/anhanime4k
Author: AnhAnime4K Team
Description: Theme tin tức ảnh anime 4K - Magazine style
Version: 1.0.0
Text Domain: anhanime4k
*/

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #e63946;
    --primary-dark: #c1121f;
    --secondary: #1d3557;
    --accent: #457b9d;
    --bg: #0f0f0f;
    --bg-card: #1a1a2e;
    --bg-card-hover: #222240;
    --text: #e8e8e8;
    --text-muted: #9ca3af;
    --border: #2a2a3e;
    --gradient-1: linear-gradient(135deg, #e63946, #f77f00);
    --gradient-2: linear-gradient(135deg, #457b9d, #1d3557);
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --transition: all 0.3s ease;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

img { max-width: 100%; height: auto; display: block; }

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

/* ===== TOP BAR ===== */
.top-bar {
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    padding: 6px 0;
    font-size: 13px;
    color: #fff;
}
.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar a { color: #fff; opacity: 0.9; }
.top-bar a:hover { opacity: 1; }
.top-bar .date { opacity: 0.85; }

/* ===== HEADER ===== */
.site-header {
    background: var(--bg-card);
    border-bottom: 3px solid var(--primary);
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
}
.site-logo {
    font-size: 26px;
    font-weight: 900;
    color: #fff;
    letter-spacing: -1px;
    white-space: nowrap;
    flex-shrink: 0;
}
.site-logo span { color: var(--primary); }

/* ===== HAMBURGER ===== */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
    width: 44px;
    height: 40px;
    flex-shrink: 0;
}
.menu-toggle span {
    display: block;
    width: 22px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: var(--transition);
    transform-origin: center;
}
/* Ensure visible on mobile */
@media (max-width: 767px) {
    .menu-toggle {
        border-color: rgba(255,255,255,0.4);
        background: rgba(255,255,255,0.08);
    }
}
.menu-toggle.active { border-color: var(--primary); }
.menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

/* ===== NAV WRAPPER ===== */
.nav-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    justify-content: flex-end;
}

/* ===== NAVIGATION ===== */
.main-nav ul {
    display: flex;
    list-style: none;
    gap: 2px;
    flex-wrap: nowrap;
}
.main-nav a {
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.main-nav a:hover,
.main-nav .current-menu-item a {
    background: var(--primary);
    color: #fff;
}

/* ===== SEARCH ===== */
.header-search {
    position: relative;
    flex-shrink: 0;
}
.header-search input {
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 8px 40px 8px 16px;
    color: #fff;
    font-size: 14px;
    width: 200px;
    transition: var(--transition);
}
.header-search input:focus {
    outline: none;
    border-color: var(--primary);
    width: 260px;
    background: rgba(255,255,255,0.12);
}
.header-search button {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
}

/* ===== BREAKING NEWS / TICKER ===== */
.breaking-news {
    background: var(--secondary);
    padding: 10px 0;
    overflow: hidden;
}
.breaking-news .container {
    display: flex;
    align-items: center;
    gap: 16px;
}
.breaking-label {
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    white-space: nowrap;
    animation: pulse 2s ease infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}
.ticker-wrap {
    overflow: hidden;
    flex: 1;
}
.ticker {
    display: flex;
    animation: ticker 30s linear infinite;
    gap: 48px;
    white-space: nowrap;
}
.ticker a {
    color: rgba(255,255,255,0.85);
    font-size: 14px;
}
.ticker a:hover { color: #fff; }
@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ===== HERO SECTION ===== */
.hero-section {
    padding: 32px 0;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
}
.hero-main {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 440px;
}
.hero-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    transition: transform 0.6s ease;
}
.hero-main:hover img { transform: scale(1.05); }
.hero-main .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 32px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    z-index: 2;
}
.hero-main .cat-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.hero-main h2 {
    font-size: 28px;
    color: #fff;
    line-height: 1.3;
    margin-bottom: 8px;
}
.hero-main h2 a { color: #fff; }
.hero-main h2 a:hover { color: var(--primary); }
.hero-main .meta { color: rgba(255,255,255,0.6); font-size: 13px; }

.hero-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.hero-side-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    flex: 1;
    min-height: 210px;
}
.hero-side-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    inset: 0;
    transition: transform 0.5s ease;
}
.hero-side-card:hover img { transform: scale(1.05); }
.hero-side-card .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    z-index: 2;
}
.hero-side-card .cat-badge {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.hero-side-card h3 {
    font-size: 16px;
    line-height: 1.4;
    color: #fff;
}
.hero-side-card h3 a { color: #fff; }
.hero-side-card h3 a:hover { color: var(--primary); }

/* ===== SECTION TITLE ===== */
.section-title {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border);
}
.section-title h2 {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    position: relative;
    padding-left: 16px;
}
.section-title h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background: var(--primary);
    border-radius: 2px;
}
.section-title .view-all {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
}

/* ===== POST CARDS GRID ===== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 48px;
}

.post-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid var(--border);
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
    background: var(--bg-card-hover);
}
.post-card .thumb {
    display: block;
    position: relative;
    padding-top: 65%;
    overflow: hidden;
    background: var(--bg-card);
}
.post-card .thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.post-card .thumb--placeholder {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #1a1a3e 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    opacity: 0.5;
}
/* Move badge below thumb area when no image */
.post-card .thumb { position: relative; }
.post-card .thumb .cat-badge { z-index: 3; }
.post-card:hover .thumb img { transform: scale(1.08); }
.post-card .thumb .cat-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    z-index: 2;
}
.post-card .thumb .img-count {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 16px;
    z-index: 2;
    backdrop-filter: blur(4px);
}
.post-card .content {
    padding: 16px;
}
.post-card h3 {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card h3 a { color: var(--text); }
.post-card:hover h3 a { color: var(--primary); }
.post-card .meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

/* ===== CATEGORY TABS ===== */
.cat-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.cat-tab {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 20px;
    border-radius: 24px;
    cursor: pointer;
    transition: var(--transition);
}
.cat-tab:hover, .cat-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== SIDEBAR ===== */
.content-with-sidebar {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 32px;
    margin-bottom: 48px;
}

.sidebar .widget {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
}
.sidebar .widget-title {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}

/* Popular posts widget */
.popular-post {
    display: flex;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.popular-post:last-child { border: 0; }
.popular-post .rank {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
    opacity: 0.4;
    line-height: 1;
    min-width: 30px;
}
.popular-post .thumb {
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}
.popular-post .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.popular-post .info h4 {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.popular-post .info h4 a { color: var(--text); }
.popular-post .info h4 a:hover { color: var(--primary); }
.popular-post .info .meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Category list widget */
.cat-list { list-style: none; }
.cat-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cat-list li:last-child { border: 0; }
.cat-list a { color: var(--text); font-size: 14px; font-weight: 500; }
.cat-list a:hover { color: var(--primary); }
.cat-list .count {
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 12px;
}

/* ===== LIST LAYOUT (for sidebar main) ===== */
.posts-list .post-list-item {
    display: flex;
    gap: 20px;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}
.posts-list .post-list-item:last-child { border: 0; }
.posts-list .post-list-thumb {
    width: 260px;
    height: 170px;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}
.posts-list .post-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.posts-list .post-list-item:hover .post-list-thumb img { transform: scale(1.05); }
.posts-list .post-list-content { flex: 1; }
.posts-list .post-list-content .cat-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.posts-list .post-list-content h3 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 8px;
}
.posts-list .post-list-content h3 a { color: var(--text); }
.posts-list .post-list-content h3 a:hover { color: var(--primary); }
.posts-list .post-list-content .excerpt {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 10px;
}
.posts-list .post-list-content .meta {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== SINGLE FEATURED IMAGE ===== */
.single-featured-image {
    padding: 0 0 24px;
}
.single-featured-image img {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: var(--radius);
}

/* ===== SINGLE POST ===== */
.single-post-header {
    padding: 40px 0 20px;
}
.single-post-header .cat-badge {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 4px;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.single-post-header h1 {
    font-size: 36px;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 16px;
}
.single-post-header .meta {
    color: var(--text-muted);
    font-size: 14px;
    display: flex;
    gap: 20px;
}

.single-post-content {
    padding: 20px 0 60px;
}
.single-post-content .entry-content {
    max-width: 860px;
}
.single-post-content .entry-content p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.8;
}
.single-post-content .entry-content h2 {
    font-size: 24px;
    font-weight: 800;
    margin: 36px 0 16px;
    color: #fff;
    padding-left: 16px;
    border-left: 4px solid var(--primary);
}
.single-post-content .entry-content figure {
    margin: 20px 0;
    border-radius: var(--radius);
    overflow: hidden;
}
.single-post-content .entry-content figcaption {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    padding: 10px;
    background: var(--bg-card);
}

/* Image gallery grid for single posts */
.single-post-content .entry-content .wp-block-image {
    margin: 12px 0;
}

/* ===== FOOTER ===== */
.site-footer {
    background: var(--bg-card);
    border-top: 3px solid var(--primary);
    padding: 48px 0 0;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    padding-bottom: 40px;
}
.footer-col h3 {
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary);
}
.footer-col p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.7;
}
.footer-col ul { list-style: none; }
.footer-col ul li { padding: 6px 0; }
.footer-col ul a { color: var(--text-muted); font-size: 14px; }
.footer-col ul a:hover { color: var(--primary); }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 20px 0;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 40px 0;
}
.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
}
.pagination a {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}
.pagination a:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.pagination .current {
    background: var(--primary);
    color: #fff;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    padding: 16px 0;
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .posts-grid { grid-template-columns: repeat(3, 1fr); }
    .content-with-sidebar { grid-template-columns: 1fr; }
    .hero-grid { grid-template-columns: 1fr; }
    .hero-main { min-height: 360px; }
}

@media (max-width: 767px) {
    /* Show hamburger */
    .menu-toggle { display: flex; }

    /* Hide nav by default, show as dropdown */
    .nav-wrapper {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border);
        border-bottom: 3px solid var(--primary);
        flex-direction: column;
        padding: 16px 20px;
        gap: 12px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.5);
        z-index: 999;
    }
    .nav-wrapper.open { display: flex; }

    .main-nav { width: 100%; }
    .main-nav ul {
        flex-direction: column;
        gap: 4px;
    }
    .main-nav a {
        display: block;
        padding: 12px 16px;
        font-size: 14px;
        border-radius: 8px;
    }
    .main-nav a:hover,
    .main-nav .current-menu-item a {
        background: rgba(230,57,70,0.15);
    }

    .header-search {
        width: 100%;
    }
    .header-search input {
        width: 100%;
    }
    .header-search input:focus { width: 100%; }

    /* Header */
    .site-header .container { position: relative; }
    .site-header .container {
        position: relative;
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .site-header .container { overflow: visible; }
    .site-logo { font-size: 18px; }
    .menu-toggle { margin-left: auto; flex-shrink: 0 !important; }

    /* Hero */
    .hero-main h2 { font-size: 20px; }
    .hero-main { min-height: 280px; }
    .hero-main .overlay { padding: 20px; }
    .hero-side-card h3 { font-size: 14px; }

    /* Grid */
    .posts-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    /* Cards */
    .post-card h3 { font-size: 13px; }
    .post-card .content { padding: 12px; }
    .post-card .thumb .cat-badge { font-size: 9px; padding: 2px 8px; top: 8px; left: 8px; }
    .post-card .thumb .img-count { font-size: 10px; padding: 2px 8px; bottom: 8px; right: 8px; }

    /* List */
    .posts-list .post-list-item { flex-direction: column; gap: 12px; padding: 16px 0; }
    .posts-list .post-list-thumb { width: 100%; height: 200px; }
    .posts-list .post-list-content h3 { font-size: 16px; }

    /* Single */
    .single-post-header h1 { font-size: 24px; }
    .single-post-header { padding: 24px 0 12px; }

    /* Section titles */
    .section-title h2 { font-size: 18px; }
    .section-title .view-all { font-size: 12px; }

    /* Footer */
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }

    /* Top bar */
    .top-bar { font-size: 12px; padding: 5px 0; }

    /* Breaking news */
    .breaking-news { padding: 8px 0; }
    .breaking-label { font-size: 10px; padding: 3px 8px; }
}

@media (max-width: 480px) {
    .posts-grid { grid-template-columns: 1fr; }
    .top-bar .date { display: none; }
    .hero-main { min-height: 240px; }
    .hero-main h2 { font-size: 18px; }
    .hero-sidebar { gap: 12px; }
    .hero-side-card { min-height: 160px; }
    .container { padding: 0 14px; }
    .site-logo { font-size: 20px; }
    .post-card .thumb { padding-top: 70%; }
}
