/*
 * **********************************************************
 * 💡 NOTE: ต้องเพิ่มลิงก์เรียกใช้ฟอนต์ในไฟล์ header.php ด้วย
 * <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Lao:wght@100..900&display=swap" rel="stylesheet">
 * **********************************************************
 */
* {
    /* 🌟 เพิ่ม Noto Sans Lao เข้ามาเป็นฟอนต์แรกสำหรับรองรับภาษาลาว */
    font-family: "Noto Sans Lao", "Merriweather", serif;
}

.navbar-brand,
.hero-section h1,
.section-title,
h3,
h4 {
    /* ฟอนต์หัวข้อหลักยังคงเป็น Playfair Display โดยมี Noto Sans Lao รองรับ */
    font-family: "Noto Sans Lao", "Playfair Display", serif;
}

:root {
    /* Theme: Peach & Dark Teal (Original) */
    --primary-color: #008080;
    /* Dark Teal */
    --secondary-color: #fff5ee;
    /* Light Peach/Seashell */
    --accent-color: #ffb347;
    /* Peach/Cantaloupe */
    --text-dark: #004d4d;
    /* Darker Teal */
    --text-light: #468499;
    /* Muted Teal */
}

/* --- Navbar Customization: ไม่มีเงา/เส้นแบ่ง และสีเขียวเข้มคงที่ --- */
.navbar {
    /* FIXED STATE: Dark Teal background always */
    background-color: var(--primary-color) !important;
    transition: all 0.3s ease-in-out;
    z-index: 1030;
    box-shadow: none !important;
    /* ลบเงาและเส้นแบ่งออก */
}

/* FIXED TEXT: White text always */
.navbar-brand,
.navbar-nav .nav-link,
.navbar-nav .nav-link i {
    color: white !important;
    transition: color 0.3s ease-in-out;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Button in Navbar adjustment for fixed dark background (ปุ่ม Login) */
.navbar .btn-primary {
    background: white;
    /* White button for contrast */
    color: var(--primary-color) !important;
    /* Dark Teal text */
    border: none;
    transition: all 0.3s ease;
}

.navbar .btn-primary:hover {
    background: #f0f0f0;
}

/* --- End Navbar Customization --- */

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
}

.hero-section {
    background: linear-gradient(135deg,
            var(--primary-color) 0%,
            #006666 100%);
    color: white;
    padding: 100px 0;
    padding-top: 150px;
    position: relative;
    overflow: hidden;
}

/* เพิ่มเงาให้กับตัวอักษรใน Hero Section */
.hero-section h1,
.hero-section p.lead {
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
}

.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* CSS สำหรับภาพปกวารสาร */
.journal-cover {
    /*background-image: url("../files_upload/page_cover/cover_issue_2_en.png");*/
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    width: 250px;
    height: 350px;
    margin: 0 auto;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
}

.journal-cover:hover {
    transform: scale(1.05);
}

.section-title {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 2rem;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--accent-color);
}

.card {
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.journal-card {
    border-left: 4px solid var(--primary-color);
}

/* ปรับขนาด Stats Card */
.stats-card {
    background: linear-gradient(135deg, var(--primary-color), #006666);
    color: white;
    text-align: center;
    padding: 1.5rem;
}

/* ปรับขนาดตัวเลข */
.stats-number {
    font-size: 2rem;
    font-weight: 700;
    display: block;
}

.btn-primary {
    background: var(--primary-color);
    border: none;
    padding: 12px 30px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: #006666;
    transform: translateY(-2px);
}

.navbar .btn-primary {
    padding: 8px 15px;
}

.footer {
    background: var(--text-dark);
    color: white;
    padding: 3rem 0 1rem;
}

.search-box {
    position: relative;
}

.search-box input {
    border-radius: 25px;
    padding-left: 45px;
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

.news-item {
    border-bottom: 1px solid #eee;
    padding: 1rem 0;
}

.news-item:last-child {
    border-bottom: none;
}

.badge-custom {
    background: var(--accent-color);
    color: var(--text-dark);
    font-weight: 500;
}

.journal-meta {
    color: var(--text-light);
    font-size: 0.9rem;
}

.journal-meta .volume-issue {
    font-weight: 700;
    color: var(--text-dark);
}

#journals,
#submissions,
#about {
    background-color: var(--secondary-color) !important;
}

.animate-fade-in {
    animation: fadeIn 0.8s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.navbar-toggler {
    border: none;
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* --- Mobile Optimization (<= 768px) --- */
@media (max-width: 768px) {
    .hero-section {
        padding: 30px 0;
        /* ลด vertical padding ให้กระชับ */
        padding-top: 70px;
        /* เว้นระยะห่างด้านบนสำหรับ Navbar */
    }

    .journal-cover {
        display: none;
        /* ซ่อนรูปภาพปกบนมือถือตามที่ร้องขอ */
    }

    .hero-section h1 {
        font-size: 1.8rem;
        /* ลดขนาด Font ของ Title */
    }

    .stats-number {
        font-size: 2rem;
    }

    /* Mobile navbar (ไม่มีเงา) */
    .navbar {
        background-color: var(--primary-color) !important;
        box-shadow: none !important;
    }

    .navbar-brand,
    .navbar-nav .nav-link,
    .navbar-nav .nav-link i,
    .navbar .btn-primary {
        color: white !important;
        text-shadow: none !important;
    }

    .navbar .btn-primary {
        width: 100%;
        margin-top: 10px;
        background: white !important;
        color: var(--primary-color) !important;
    }
}

/* --- Active Link Styles (Higher Specificity Fix) --- */

/* 1. กำหนดสไตล์สำหรับเมนูหลักและไอคอนที่ Active */
/* ใช้ความจำเพาะเจาะจงสูงเพื่อ override สีขาวของ Navbar */
.navbar-nav .nav-item .nav-link.active,
.navbar-nav .nav-item .nav-link.active i {
    color: var(--accent-color) !important;
    /* ใช้สีเน้น (Peach) */
    font-weight: 700 !important;
    /* ให้ตัวหนาทำงาน */
    text-shadow: none !important;
    /* ลบเงาข้อความออกเมื่อ Active */
}

/* 2. สไตล์สำหรับ Dropdown Item ที่ Active */
.dropdown-item.active {
    background-color: var(--primary-color) !important;
    /* พื้นหลังสี Dark Teal */
    color: white !important;
    /* ข้อความสีขาว */
}

/* 3. Optional: เพิ่มขีดเส้นใต้สำหรับ Active link บน Desktop */
@media (min-width: 769px) {
    .navbar-nav .nav-item .nav-link.active::after {
        content: '';
        position: absolute;
        bottom: -5px;
        left: 0;
        width: 100%;
        height: 3px;
        background-color: var(--accent-color);
        border-radius: 1px;
    }
}