:root {
    --pink-primary: #FF69B4; /* Hot Pink */
    --dark-secondary: #2c333a; /* Dark Charcoal Gray (แถบ Nav และ Footer) */
    --light-bg: #F8F9FA;
    --text-light: #F0F0F0;
}
body { 
    font-family: 'Kanit', sans-serif; 
    background-color: white; 
    color: var(--dark-secondary);
}

/* --- Marquee Bar (แถบข้อความวิ่ง) --- */
.marquee-bar {
    background-color: var(--pink-primary);
    color: white;
    padding: 5px 0;
    overflow: hidden; 
    white-space: nowrap; 
}
.marquee-content {
    display: inline-block;
    animation: marquee 20s linear infinite; 
    padding-left: 100%; 
}
@keyframes marquee {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); } 
}

/* --- Navigation Bar (Navbar) --- */
.navbar-custom {
    background-color: var(--dark-secondary) !important;
    padding: 0.8rem 0;
    z-index: 1030; 
}
.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
}

/* (เสริม) ถ้าต้องการให้กรอบสี่เหลี่ยมรอบปุ่มเป็นสีขาวจางๆ ด้วย ให้เพิ่มโค้ดนี้ครับ */
.navbar-toggler {
    border-color: rgba(255, 255, 255, 0.3) !important; 
}
.navbar-brand span { 
    color: var(--pink-primary) !important; 
}
.navbar-custom .nav-link {
    color: var(--text-light) !important;
    font-weight: 500;
    transition: color 0.3s, background-color 0.3s;
    padding: 0.5rem 1rem;
    border-radius: 5px;
}
.navbar-custom .nav-link:hover,
.navbar-custom .nav-link.active {
    color: var(--pink-primary) !important;
    background-color: rgba(255, 255, 255, 0.1);
}
.navbar-brand img { 
    height: 40px !important; 
    width: auto;
    margin-right: 10px; 
}
/* Style สำหรับปุ่มแก้ไขลิงก์ Navbar */
.navbar-custom .btn-info {
    background-color: var(--dark-secondary) !important;
    border-color: var(--dark-secondary) !important;
    color: white !important;
    font-weight: 500;
}
.navbar-custom .btn-info:hover {
    background-color: #495057 !important; 
    border-color: #495057 !important;
}


/* --- Hero Section (ส่วนต้อนรับ) --- */
.hero-section {
    background: url('akarn.png') no-repeat center center / cover; 
    color: white;
    padding: 80px 0 100px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.8); 
    position: relative;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% 95%, 0 100%); 
}
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 105, 180, 0.2); 
    z-index: 0;
}
.hero-section::after {
    content: none;
}
.hero-section .container { position: relative; z-index: 1; }
.hero-section h1 { font-weight: 700; margin-bottom: 15px; }
.hero-section p.lead { font-size: 1.3rem; margin-bottom: 30px; }
.btn-hero {
    background-color: #E0509C; 
    border: none;
    transition: background-color 0.3s ease;
    padding: 12px 25px;
    font-size: 1.1rem;
}
.btn-hero:hover {
    background-color: #FF69B4; 
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.btn-outline-light-custom {
    border: 2px solid white;
    color: white;
    transition: all 0.3s ease;
}
.btn-outline-light-custom:hover {
    background-color: white;
    color: var(--pink-primary);
}


/* --- Director's Message (ผู้อำนวยการ) --- */
.director-section {
    background-color: #fce4ec; 
    padding: 30px; 
    border-top: 5px solid var(--pink-primary);
    border-bottom: 5px solid var(--pink-primary);
    border-radius: 15px !important; 
    text-align: center; 
    position: relative;
}
.director-photo {
    /* *** แก้ไข: ปรับเป็นสี่เหลี่ยมแนวตั้ง (4:5) และลบขอบชมพู *** */
    width: 180px; 
    height: 225px; 
    object-fit: cover;
    border: none; /* ลบขอบออก */
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    margin: 0 auto 20px; 
    display: block; 
    transform: none; 
    border-radius: 8px; 
}
.director-section h3 { color: var(--dark-secondary); font-weight: 600; margin-bottom: 15px; }
.director-section p { 
    color: var(--dark-secondary); 
    line-height: 1.5; 
    margin-bottom: 0;
}
.director-section p.fw-bold { 
    font-size: 1rem;
}
.director-section p.small { 
    font-size: 0.9rem; 
    color: #555;
}
.director-section .btn {
    margin-bottom: 15px !important;
}


/* --- NEW: Executive Groups (คณะผู้บริหาร) --- */
.executive-groups-panel {
    background-color: #fce4ec; /* Light Pink Background */
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-left: 5px solid var(--pink-primary); 
}
.executive-groups-panel h4 {
    color: var(--pink-primary); 
    font-weight: 600;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--pink-primary); 
    padding-bottom: 10px;
    text-align: center;
}
.executive-groups-panel .btn-executive {
    width: 100%;
    margin-bottom: 10px;
    background-color: white;
    color: var(--pink-primary); 
    border: 1px solid var(--pink-primary); 
    font-weight: 500;
    transition: all 0.2s ease;
    /* *** FIX: ปรับการแสดงผลปุ่มให้มีเนื้อหาทั้งหมด *** */
    height: auto; 
    white-space: normal; 
    padding: 10px 15px;
}
.executive-groups-panel .btn-executive:hover {
    background-color: var(--pink-primary);
    color: white;
    transform: translateX(5px);
}

/* --- Academic Groups (กลุ่มสาระ) --- */
.academic-groups-panel {
    background-color: #e3f2fd; 
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-left: 5px solid #28a745; 
}
.academic-groups-panel h4 {
    color: #28a745; 
    font-weight: 600;
    margin-bottom: 25px;
    border-bottom: 2px solid #28a745;
    padding-bottom: 10px;
    text-align: center;
}
.academic-groups-panel .btn-academic {
    width: 100%;
    margin-bottom: 10px;
    background-color: white;
    color: #28a745;
    border: 1px solid #28a745;
    font-weight: 500;
    transition: all 0.2s ease;
}
.academic-groups-panel .btn-academic:hover {
    background-color: #28a745;
    color: white;
    transform: translateX(5px);
}


/* --- Announcement Board (บอกเล่าชาว จ.อ.) --- */
.announcement-board-lg {
    border: 2px solid var(--pink-primary);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    background-color: white;
    position: relative; 
    overflow: hidden; 
}
.board-header {
    background-color: var(--pink-primary);
    color: white;
    padding: 10px 0;
    border-top-left-radius: 13px;
    border-top-right-radius: 13px;
    position: relative;
}
.board-logo {
    position: absolute;
    left: 20px;
    top: 5px;
    height: 50px; 
}
.board-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    padding-top: 5px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

/* กำหนดความสูงของ carousel-inner */
.announcement-board-lg .carousel-inner {
    height: auto; 
    position: relative;
    overflow: hidden;
    padding: 15px; 
}

.announcement-board-lg .carousel-item {
    height: auto; 
    padding: 0; 
}

.board-item {
    border: 1px solid #DDD;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 0; 
    height: 100%; 
    display: flex; 
    flex-direction: column;
}

/* 1. Aspect Ratio 16:9 Container */
.board-image-area {
    position: relative;
    width: 100%;
    
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-color: #F8F9FA; 
    
    transition: opacity 0.3s;
}

.card-body a {
    display: block;
    position: relative;
    overflow: hidden;
    flex-grow: 1; 
    
    /* **16:9 Aspect Ratio** */
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
}

/* 2. Aspect Ratio Box (ใช้สำหรับพื้นที่รูปภาพ) */
.card-body a > div:first-child {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0; 
}

/* 3. ทำให้รูปภาพเต็มพื้นที่ Aspect Ratio Box */
.board-image-area {
    position: absolute; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    text-align: center;
}


.board-image-area:hover {
    opacity: 0.9;
}

/* **ซ่อนองค์ประกอบข้อความที่เคยแสดงบนรูปภาพ** */
.board-content-text {
    display: none !important; 
}

.board-topic {
    font-size: 1.8rem;
    font-weight: 800;
    color: white; 
    margin-bottom: 5px;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 1.0); 
}
.board-subtitle {
    font-size: 1rem;
    color: white; 
    line-height: 1.4;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 1.0); 
}

/* 4. แก้ปัญหาข้อความ Footer อ่านไม่ออก (สีน้ำเงิน/ดำ) */
.board-footer-link {
    background-color: var(--pink-primary);
    transition: background-color 0.3s;
    flex-shrink: 0; 
    padding: 8px 15px; 
}
.board-footer-link a {
    text-decoration: none;
    color: white; 
    font-size: 1rem; 
}
.board-footer-link:hover {
    background-color: #E0509C;
}
.board-footer-link a:hover {
    color: #F8F9FA; 
}


/* --- Announcement Cards (ข่าวสารย่อย) --- */
.announcement-card {
    border-radius: 15px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
    background-color: white;
    border: none;
}
.announcement-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}
.announcement-card .card-body {
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 200px;
}
.announcement-card .card-icon {
    font-size: 3rem;
    color: var(--pink-primary);
    margin-bottom: 15px;
    display: block;
}
.announcement-card .card-title {
    color: var(--dark-secondary);
    font-weight: 600;
    margin-bottom: 10px;
}
.announcement-card .card-text {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.6;
}
.announcement-card .btn-outline-primary {
    color: var(--pink-primary);
    border-color: var(--pink-primary);
    transition: background-color 0.3s, color 0.3s;
    align-self: flex-start; 
}
.announcement-card .btn-outline-primary:hover {
    background-color: var(--pink-primary);
    color: white;
}


/* --- Quick Links (ลิงก์ด่วน) --- */
.quick-links-panel {
    background-color: var(--light-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.quick-links-panel h4 {
    color: var(--pink-primary);
    font-weight: 600;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--pink-primary);
    padding-bottom: 10px;
    text-align: center;
}
.quick-links-panel .list-group-item {
    border: none;
    background-color: transparent;
    padding: 12px 0;
    border-bottom: 1px dashed #DDD;
    transition: background-color 0.2s ease, transform 0.2s ease;
    color: var(--dark-secondary);
    font-weight: 500;
}
.quick-links-panel .list-group-item:last-child { border-bottom: none; }
.quick-links-panel .list-group-item:hover {
    background-color: rgba(255, 105, 180, 0.1); 
    transform: translateX(5px);
    color: var(--pink-primary);
}
.quick-links-panel .list-group-item i {
    margin-right: 15px;
    color: var(--pink-primary);
}


/* --- Academic Groups (กลุ่มสาระ) --- */
.academic-groups-panel {
    background-color: #e3f2fd; 
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border-left: 5px solid #28a745; 
}
.academic-groups-panel h4 {
    color: #28a745; 
    font-weight: 600;
    margin-bottom: 25px;
    border-bottom: 2px solid #28a745;
    padding-bottom: 10px;
    text-align: center;
}
.academic-groups-panel .btn-academic {
    width: 100%;
    margin-bottom: 10px;
    background-color: white;
    color: #28a745;
    border: 1px solid #28a745;
    font-weight: 500;
    transition: all 0.2s ease;
}
.academic-groups-panel .btn-academic:hover {
    background-color: #28a745;
    color: white;
    transform: translateX(5px);
}


/* --- Footer (ส่วนท้าย) --- */
footer {
    background-color: var(--dark-secondary);
    color: #ADB5BD; 
    padding: 40px 0;
    margin-top: 50px;
}
footer h5 { color: white; margin-bottom: 20px; font-weight: 600; }
footer a { color: var(--pink-primary); text-decoration: none; transition: color 0.3s; }
footer a:hover { color: white; }
footer .social-icons a { font-size: 1.8rem; margin: 0 10px; }


/* --- Carousel Control for Announcement Board --- */
#mainBoardCarousel {
    position: relative;
}

#mainBoardCarousel .carousel-control-prev,
#mainBoardCarousel .carousel-control-next {
    z-index: 100; 
    width: 10%; 
    top: 50%;
    transform: translateY(-40%); 
    bottom: auto;
    
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

#mainBoardCarousel .carousel-control-prev-icon,
#mainBoardCarousel .carousel-control-next-icon {
    background-color: var(--dark-secondary); 
    border-radius: 50%;
    padding: 15px;
}

/* --- Carousel Indicators Style --- */
.carousel-indicators {
    z-index: 100;
    position: absolute;
    bottom: -15px; 
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 0;
}

.carousel-indicators [data-bs-target] {
    background-color: var(--dark-secondary); 
    opacity: 0.6;
    height: 10px;
    width: 10px;
    border-radius: 50%;
    margin: 0 5px;
    border: 1px solid white;
    transition: opacity 0.3s, background-color 0.3s;
}

.carousel-indicators .active {
    opacity: 1;
    background-color: var(--pink-primary); 
}

/* --- Admin Board Button on Carousel Header (New Style) --- */
.btn-board-admin {
    position: absolute;
    top: 50%; 
    right: 15px; 
    transform: translateY(-50%); 
    z-index: 10;
    font-size: 0.8rem;
    padding: 3px 8px;
    font-weight: 600;
    color: var(--dark-secondary) !important;
}

/* --- MANUAL/JOURNAL Panel Styles (FIXED FOR BOTH) --- */
.manual-panel, .journal-panel {
    background-color: white; 
    border: 2px solid var(--pink-primary); 
    border-radius: 15px;
    padding: 10px; 
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.manual-panel h4, .journal-panel h4 {
    color: var(--pink-primary); 
    font-weight: 700;
    margin-bottom: 10px;
}
.manual-panel .manual-image, .journal-panel .journal-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    transition: transform 0.3s ease;
    margin-bottom: 5px; 
}
.manual-panel .manual-link:hover .manual-image, .journal-panel .journal-link:hover .journal-image {
    transform: scale(1.02);
}
.btn-manual-edit {
    background-color: #17A2B8; /* Info Blue */
    border-color: #17A2B8;
    color: white;
    font-size: 0.8rem;
}
.btn-journal-edit {
    background-color: #28a745; /* Success Green */
    border-color: #28a745;
    color: white;
    font-size: 0.8rem;
}

/* Image preview in modal (used by all modals) */
.img-preview { 
    max-width: 100%; 
    max-height: 150px; 
    object-fit: contain; 
    border-radius: 5px; 
    border: 1px solid #ddd; 
    padding: 5px; 
}
.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%); /* ทำให้ไอคอนเป็นสีขาว */
}

/* --- News List View Styles --- */
.news-item-card {
    border: 1px solid #eee;
    transition: box-shadow 0.3s;
}
.news-item-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}

.news-thumbnail {
    width: 120px; /* ขนาดรูปย่อ */
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
}

.news-title-link a {
    color: var(--dark-secondary);
    text-decoration: none;
    transition: color 0.2s;
    font-size: 1.1rem;
}
.news-title-link a:hover {
    color: var(--pink-primary);
    text-decoration: underline;
}
.modal-mission {
            /* ใช้ pink-primary จาก :root */
            background-color: var(--pink-primary); 
            color: white;
            position: relative;
            padding-bottom: 40px !important; 
            border-top-left-radius: .3rem; 
            border-top-right-radius: .3rem;
            border-bottom: none;
        }
        
        /* FIX: เพิ่ม Border สีชมพูให้กับกรอบ Modal โดยรวม */
        #MissionModal .modal-content {
            border: 3px solid var(--pink-primary); /* เพิ่มขอบหนา 3px */
            border-radius: .3rem !important;
            box-shadow: 0 4px 15px rgba(255, 105, 180, 0.5); /* เพิ่มเงาชมพู */
        }
        
        /* FIX: ปรับตำแหน่งและขนาดโลโก้ */
        .modal-mission-logo {
            position: absolute;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            height: 50px; /* ลดขนาดลงเล็กน้อยเพื่อให้ดูสมดุล */
            width: auto;
            z-index: 1050;
        }
        
        /* FIX: ปรับตำแหน่ง Title ให้ต่ำลงเพื่อเว้นที่ให้โลโก้ */
        .modal-mission-content {
            background-color: white;
            color: var(--dark-secondary);
            padding: 30px;
            margin-top: 25px; /* ลดระยะห่างด้านบนให้สมดุลขึ้น */
        }