/* ==========================================
   1. SYSTEM VARIABLES & THEME SETUP
   ========================================== */
:root {
    /* Color Palette */
    --primary-color: #1a73e8;
    --primary-dark: #0d47a1;
    --primary-light: #e8f0fe;
    --dark-navy: #0b1e3a;
    --brand-blue: #0b2b5c;
    --danger-red: #d93025;
    --success-green: #34a853;
    --warning-orange: #f9ab00;

    /* Neutrals & Surfaces */
    --bg-main: #f0f4f9;
    --bg-card: #ffffff;
    --bg-secondary: #f8fafc;
    --text-primary: #1a2639;
    --text-muted: #5f6b7a;
    --border-color: #eef2f7;

    /* Radius & Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions & Shadows */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
}

/* Auto Dark Mode Preference */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-main: #0f172a;
        --bg-card: #1e293b;
        --bg-secondary: #334155;
        --text-primary: #f8fafc;
        --text-muted: #94a3b8;
        --border-color: #334155;
        --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
        --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    }
}

/* ==========================================
   2. GLOBAL RESETS & ACCESSIBILITY
   ========================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

/* Accessible Focus States */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* ==========================================
   3. COMPONENTS & LAYOUT MODULES
   ========================================== */

/* Utility Card Container */
.card-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    transition: var(--transition);
}
.card-box:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* News & Content Cards */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.news-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.news-card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Multi-line Text Truncation */
.news-card-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-body p {
    color: var(--text-muted);
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}
.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-danger {
    background-color: var(--danger-red);
    color: #ffffff;
}

/* Sticky Navigation / Header Glassmorphism */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

@media (prefers-color-scheme: dark) {
    .sticky-header {
        background: rgba(15, 23, 42, 0.8);
    }
}

/* ==========================================
   4. RESPONSIVE BREAKPOINTS
   ========================================== */

/* Tablet & Desktop Adjustments */
@media (max-width: 991px) {
    .news-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1rem;
    }
}

/* Mobile Devices */
@media (max-width: 768px) {
    .card-box {
        padding: 1rem;
        border-radius: var(--radius-md);
    }
    
    /* Navigation Bar Dưới Đáy Màn Hình Cho Mobile */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--bg-card);
        border-top: 1px solid var(--border-color);
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 999;
    }
}

/* Small Mobile Screens */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    .news-grid {
        grid-template-columns: 1fr;
    }
}