/* ==========================================================================
   HOME PAGE STYLES - CATEGORY LAYOUT STYLE (5fr 7fr)
   ========================================================================== */

body.home-page {
    overflow-x: hidden;
    overflow-y: hidden !important;
}

/* Main container - Adjusted for bottom menu */
.main-container {
    height: calc(100vh - 90px); /* Giảm xuống để không bị đẩy quá cao */
    overflow-y: hidden;
    overflow-x: hidden;
    position: relative;
    padding: 1rem 4% 0 4%;
    box-sizing: border-box;
    width: 100%;
    margin: 0 auto;
    padding-bottom: 0;
}

.horizontal-container {
    display: block;
    height: 100%;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* NEWS SECTION: Grid layout 5fr (LEFT) + 7fr (RIGHT) - giống category page */
.news-section {
    display: grid;
    grid-template-columns: 5fr 7fr; /* LEFT nhỏ hơn, RIGHT lớn hơn */
    gap: 1rem;
    height: calc(100vh - 105px); /* Điều chỉnh để vừa với bottom menu */
    min-height: 60vh;
    margin-bottom: 0;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* MAIN CARD - LEFT SIDE (chiếm 5fr) */
.main-card {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: block;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
    border: 1px solid rgba(58, 134, 255, 0.2);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.05);
}

.main-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 50px rgba(0, 247, 255, 0.4);
    border-color: rgba(0, 247, 255, 0.6);
}

/* CARDS GRID - RIGHT SIDE (chiếm 7fr) */
/* 2 HÀNG cards scroll ngang - giống category page */
.cards-grid {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr 1fr; /* 2 hàng bằng nhau */
    grid-auto-flow: column; /* Cards xếp theo cột (ngang) */
    gap: 1rem;
    overflow-x: auto; /* Scroll ngang */
    overflow-y: hidden;
    grid-auto-columns: minmax(300px, 1fr); /* Mỗi card tối thiểu 300px */
    scrollbar-width: none;
    -ms-overflow-style: none;
    box-sizing: border-box;
    scroll-behavior: smooth;
}

.cards-grid::-webkit-scrollbar {
    display: none;
}

/* GRID CARD - Mỗi card trong grid */
.grid-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    border: 1px solid rgba(58, 134, 255, 0.2);
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.05);
}

.main-card,
.grid-card {
    transform-origin: center;
    will-change: transform;
}

.grid-card:hover {
    transform: translateX(5px);
    box-shadow: 0 10px 30px rgba(0, 247, 255, 0.3);
    border-color: rgba(0, 247, 255, 0.6);
}

/* Card background and overlay */
.card-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 100%;
    height: 100%;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.7) 0%,
        rgba(var(--primary-rgb), 0.1) 100%
    );
}

.card-content {
    position: relative;
    z-index: 2;
    padding: 1.5rem;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Đẩy content xuống dưới */
    box-sizing: border-box;
}

.grid-card .card-content {
    padding: 1rem;
    justify-content: flex-end;
}

/* Card titles */
.card-title {
    font-size: 2.8rem;
    font-weight: bold;
    margin: 0 0 0.5rem 0;
    line-height: 1.1;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: var(--text-primary);
}

.grid-card .card-title {
    font-size: 1.4rem;
    margin: 0 0 0.5rem 0;
    line-height: 1.2;
}

/* Card dates */
.card-date {
    color: var(--secondary-color);
    font-size: 13px;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.grid-card .card-date {
    font-size: 11px;
    margin-bottom: 0.3rem;
}

/* Specific card backgrounds */
.main-card-1 .card-bg {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"><defs><pattern id="circuit" patternUnits="userSpaceOnUse" width="40" height="40"><rect width="40" height="40" fill="%23001122"/><circle cx="20" cy="20" r="2" fill="%23FAE635"/><path d="M20,0 L20,40 M0,20 L40,20" stroke="%23FAE635" stroke-width="0.5" opacity="0.3"/></pattern></defs><rect width="800" height="600" fill="url(%23circuit)"/><circle cx="400" cy="300" r="100" fill="%23FAE635" opacity="0.1"/></svg>');
}

.grid-card-1 .card-bg {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><rect width="400" height="300" fill="%23112233"/><circle cx="200" cy="150" r="50" fill="%236BD0FA" opacity="0.4"/></svg>');
}

.grid-card-2 .card-bg {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><rect width="400" height="300" fill="%23001133"/><polygon points="200,50 250,150 150,150" fill="%23FAE635" opacity="0.6"/></svg>');
}

.grid-card-3 .card-bg {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><rect width="400" height="300" fill="%23220011"/><path d="M0,150 Q200,100 400,150" stroke="%236BD0FA" stroke-width="3" fill="none" opacity="0.4"/></svg>');
}

.grid-card-4 .card-bg {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 400 300"><rect width="400" height="300" fill="%23001122"/><rect x="50" y="50" width="100" height="100" rx="10" fill="%23FAE635" opacity="0.3"/></svg>');
}

.main-card-2 .card-bg {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"><rect width="800" height="600" fill="%23112244"/><polygon points="400,100 500,300 300,300" fill="%236BD0FA" opacity="0.3"/><circle cx="200" cy="450" r="80" fill="%23FAE635" opacity="0.2"/></svg>');
}

/* Background effects */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(
            rgba(var(--primary-rgb), 0.2) 1px,
            transparent 1px
        ),
        linear-gradient(
            90deg,
            rgba(var(--primary-rgb), 0.2) 1px,
            transparent 1px
        );
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Card overlay effects */
.card-content::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        rgba(var(--primary-rgb), 0.05) 0%,
        rgba(var(--secondary-rgb), 0.05) 100%
    );
    opacity: 0;
    transition: opacity var(--transition-normal);
    pointer-events: none;
}

.main-card:hover .card-content::before,
.grid-card:hover .card-content::before {
    opacity: 1;
}

/* ==========================================================================
   RESPONSIVE DESIGN - GIỐNG CATEGORY PAGE
   ========================================================================== */

@media (min-width: 1400px) {
    .main-container {
        padding: 1.5rem 6% 0 6%;
    }

    .news-section {
        gap: 2rem;
        height: calc(100vh - 130px);
    }

    .cards-grid {
        grid-auto-columns: auto;
    }
}

@media (max-width: 1200px) {
    .main-container {
        padding: 1rem 1.5rem 0 1.5rem;
        height: calc(100vh - 90px);
    }

    .news-section {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        height: calc(100vh - 120px);
        min-height: 50vh;
    }

    .card-title {
        font-size: 2.4rem;
    }

    .grid-card .card-title {
        font-size: 1.2rem;
    }
}

@media (max-width: 992px) {
    .main-container {
        padding: 1rem 1rem 0 1rem;
        height: calc(100vh - 90px);
    }

    .news-section {
        grid-template-columns: 1fr;
        gap: 1rem;
        height: auto;
        min-height: auto;
    }

    .main-card {
        width: 100%;
        height: 35vh;
        min-height: 250px;
    }

    .cards-grid {
        width: 100%;
        height: 40vh;
        min-height: 300px;
        grid-template-rows: 1fr 1fr;
        grid-auto-flow: column;
        gap: 1rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 0;
        grid-auto-columns: auto;
        margin-bottom: 0;
    }

    .grid-card {
        width: 100%;
        height: 100%;
    }

    .card-content {
        padding: var(--spacing-md);
    }

    .grid-card .card-content {
        padding: var(--spacing-sm);
    }

    .card-title {
        font-size: 2rem;
        margin: 15px 0;
    }

    .grid-card .card-title {
        font-size: 1rem;
        margin: 10px 0;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 0.8rem 1rem 0 1rem;
        height: calc(100vh - 85px);
    }

    .news-section {
        gap: 1rem;
        margin-bottom: 0;
    }

    .main-card {
        height: 32vh;
        min-height: 220px;
    }

    .cards-grid {
        height: 38vh;
        min-height: 280px;
        gap: 0.8rem;
        grid-auto-columns: auto;
        margin-bottom: 0;
    }

    .card-content {
        padding: var(--spacing-sm);
    }

    .grid-card .card-content {
        padding: 12px;
    }

    .card-title {
        font-size: 1.6rem;
        margin: 10px 0;
    }

    .grid-card .card-title {
        font-size: 0.9rem;
        margin: 8px 0;
    }

    .card-date {
        font-size: 11px;
    }

    .grid-card .card-date {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .main-container {
        padding: 0.5rem 0.8rem 0 0.8rem;
        height: calc(100vh - 75px);
    }

    .news-section {
        gap: 0.8rem;
    }

    .main-card {
        height: 30vh;
        min-height: 180px;
    }

    .cards-grid {
        height: 35vh;
        min-height: 240px;
        gap: 0.6rem;
        grid-auto-columns: auto;
    }

    .card-title {
        font-size: 1.4rem;
    }

    .grid-card .card-title {
        font-size: 0.8rem;
    }

    .card-content {
        padding: 12px;
    }

    .grid-card .card-content {
        padding: 10px;
    }
}

/* Extra small mobile */
@media (max-width: 380px) {
    .main-container {
        padding: 0.5rem 0.5rem 0 0.5rem;
        height: calc(100vh - 70px);
    }

    .main-card {
        height: 28vh;
        min-height: 160px;
    }

    .cards-grid {
        height: 33vh;
        min-height: 220px;
        grid-auto-columns: auto;
    }

    .card-title {
        font-size: 1.2rem;
    }

    .grid-card .card-title {
        font-size: 0.75rem;
    }
}

/* High DPI optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card-bg {
        background-size: cover;
        image-rendering: crisp-edges;
    }

    .card-title {
        text-rendering: optimizeLegibility;
    }
}

/* Landscape mobile - bottom menu active */
@media (max-height: 500px) and (orientation: landscape) {
    .main-container {
        height: calc(100vh - 60px);
        padding: 0.5rem 2rem 0 2rem;
    }

    .news-section {
        height: calc(100vh - 80px);
        gap: 1rem;
    }

    .main-card {
        height: 100%;
        min-height: unset;
    }

    .cards-grid {
        height: 100%;
        min-height: unset;
        grid-auto-columns: auto;
    }
}

/* Prevent content from being hidden behind bottom menu - REDUCED */
body.home-page {
    padding-bottom: 0;
}

@media (max-width: 640px) {
    body.home-page {
        padding-bottom: 0;
    }
}

@media (max-width: 380px) {
    body.home-page {
        padding-bottom: 0;
    }
}
body.page-white  .news-section .card-title {
    color: #fff!important;
}