/* =========================================
   INDEX.CSS - REORGANIZED & CLEAN VERSION
   ========================================= */

/* --- 1. HERO SLIDER (ส่วนบนสุดของหน้า) --- */
.hero-slider {
    position: relative;
    width: 100%;
    height: 38vh; /* ความสูงครึ่งหน้าจอ */
    background-color: #000;
    overflow: hidden;
}

.slider-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

.slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    z-index: 1;
}

.slide.active {
    opacity: 1;
    z-index: 2;
}

.hero-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0.6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    text-align: center;
}

.hero-content h1 {
    color: #fff;
    font-size: clamp(20px, 4vw, 38px);
    font-weight: bold;
    text-transform: uppercase;
    margin: 0;
}

.hero-content p {
    color: #fff;
    font-size: clamp(12px, 2vw, 18px);
    margin-top: 10px;
}

/* --- 2. MAIN INFO SECTION (เกริ่นนำและสถิติ) --- */
.info-grid { 
    display: grid; 
    grid-template-columns: 2fr 1fr; 
    gap: 40px; 
}

.content-left {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.content-left h1 {
    color: #000; 
    font-size: 30px;
}

.description-iot {
    line-height: 1.5; 
    color: #555555; 
    font-size: 20px;
    text-align: justify;
    font-weight: normal;
}

.btn-admission {
    display: flex;
    align-items: center;
    background: linear-gradient(90deg, #ff7a00 0%, #ffe6cc 100%); 
    color: #000000;
    text-decoration: none;
    padding: 15px 30px;
    border-radius: 50px; 
    font-size: 20px;
    font-weight: bold;
    margin-top: auto;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.btn-admission:hover { transform: scale(1.02); }
.btn-admission span { flex: 1; text-align: center; }
.btn-admission .btn-icon {
    position: absolute;
    right: 25px; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 15px;
    height: 100%;
}

.stat-card {
    background: #ffffff;
    border: 2px solid #ce8d5e; 
    border-radius: 20px;
    padding: 20px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.05);
}

.stat-img { height: 45px; object-fit: contain; margin-bottom: 10px; }
.stat-desc { font-size: 15px; color: #555555; line-height: 1.5; }

/* --- 3. ANNOUNCEMENT & NEWS SECTION --- */
.community-action {
    text-align: center;
    margin: 40px 0 60px 0;
    display: flex;
    justify-content: center;
}

.announcement-title-box {
    background-color: #FF6F00;
    color: #ffffff !important;
    padding: 15px 40px; 
    border-radius: 12px; /* ทรงสี่เหลี่ยมขอบมนตามรูป */
    font-size: 30px; 
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(255, 111, 0, 0.3);
    cursor: default;
    user-select: none;
}

.community-main-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.news-card-item {
    display: flex;
    gap: 25px;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
}

.news-img-box {
    flex: 0 0 220px; 
    height: 180px;
    border-radius: 15px;
    overflow: hidden;
}

.news-img-box img { width: 100%; height: 100%; object-fit: cover; }

.news-content-box h3 {
    font-size: 24px;
    margin: 10px 0;
    color: #333;
    font-weight: bold;
}

.news-tags-row span {
    font-size: 12px;
    color: #888;
    background: #f0f0f0;
    padding: 4px 12px;
    border-radius: 20px;
    margin-right: 8px;
    font-weight: 500;
}

/* --- 4. SIDEBAR (ประกาศสำคัญ & ปฏิทิน) --- */
.sidebar-block {
    background: #fff; border-radius: 20px; padding: 25px;
    margin-bottom: 30px; box-shadow: 0 4px 20px rgba(0,0,0,0.05); border: 1px solid #f0f0f0;
}

.sidebar-block h3 { margin-top: 0; border-bottom: 2px solid #FF6F00; padding-bottom: 12px; margin-bottom: 20px; }

.announcement-list ul { padding: 0; list-style: none; }
.announcement-list li { padding: 12px 0; border-bottom: 1px solid #f9f9f9; font-size: 15px; color: #444; }

.event-calendar { background: #FF6F00; color: #fff; border: none; border-radius: 25px !important; }
.event-calendar h3 { border-color: #fff; color: #fff; }
.event-row { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }

.event-pill {
    background: rgba(255,255,255,0.2); 
    padding: 8px 15px; 
    border-radius: 15px; 
    font-weight: bold; 
    font-size: 13px;
    text-align: center;
    min-width: 120px;
}

/* --- 5. BANNERS (INTERNSHIP & PROJECTS) --- */
.community-banners {
    display: flex;
    flex-direction: column;
    margin-top: 50px;
    gap: 30px !important;
    width: 100% !important;
}

.banner-item {
    display: block !important;
    width: 100% !important;
    height: 220px; 
    background-size: cover;
    background-position: center;
    position: relative;
    border-radius: 50px !important; /* ทรงมน Pill Shape */
    overflow: hidden; 
    text-decoration: none !important;
    color: #fff !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.banner-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.internship-banner { background-image: url('../assets/internship_banner.png'); }
.projects-banner { background-image: url('../assets/project_banner.png'); }

.banner-text-wrap {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-end; 
    padding-right: 60px;
}

/* 🟢 ส่วนรูป Overlay แยกตามประเภทแบนเนอร์ */
.internship-banner .banner-text-wrap {
    background: url('../assets/intern_overlay_pattern.png') no-repeat center !important;
    background-size: cover;
}

.projects-banner .banner-text-wrap {
    background: url('../assets/project_overlay_pattern.png') no-repeat center !important;
    background-size: cover;
}

.banner-text-wrap h2 {
    color: #fff !important;
    font-size: 36px;
    font-weight: bold;
    margin: 0;
    text-shadow: 2px 2px 15px rgba(0,0,0,0.5);
}

/* --- 6. GALLERY AUTO-SLIDER (ส่วนท้ายที่เลือนวนเอง) --- */
.gallery-slider-container {
    width: 100%;
    height: 500px; /* ปรับความสูงได้ตามใจชอบ */
    position: relative;
    margin-top: 50px;
    border-radius: 30px; /* ขอบมนเข้ากับ Banner */
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.gallery-slider {
    width: 100%;
    height: 100%;
    position: relative;
}

.gallery-slide {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    opacity: 0; /* ซ่อนไว้ก่อน */
    transition: opacity 1.5s ease-in-out; /* ความเนียนตอน Fade */
    z-index: 1;
}

.gallery-slide.active {
    opacity: 1; /* แสดงรูปที่กำลังทำงาน */
    z-index: 2;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* บังคับรูปเต็มกรอบสวยๆ */
}

/* ส่วนของปุ่มแก้ไข (ถ้ามึง Login เป็นแอดมิน) */
.edit-overlay-gallery {
    position: absolute;
    bottom: 25px;
    right: 25px;
    background: rgba(255, 111, 0, 0.85);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    z-index: 10;
    font-weight: 500;
}

/* --- 7. RESPONSIVE DESIGN (MOBILE) --- */
@media (max-width: 992px) {

    /* บังคับ grid เป็น column เดียว */
    .info-grid,
    .image-grid,
    .community-main-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* สำคัญมาก ป้องกัน grid ล้น */
    .info-grid>*,
    .community-main-grid>* {
        min-width: 0;
    }

    .content-left h1 {
        font-size: 20px;
    }

    .description-iot {
        font-size: 16px;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    /* 🔴 ปรับขนาดตัวอักษรและปุ่มรับสมัครสำหรับมือถือ */
    .btn-admission {
        font-size: 16px;
        /* ลดขนาดเหลือ 16px */
        padding: 12px 20px;
        /* ปรับกรอบปุ่มให้เล็กลงสมส่วน */
        justify-content: center;
        /* จัดให้ข้อความและไอคอนอยู่ตรงกลาง */
    }

    .btn-admission .btn-icon {
        position: static;
        /* เลิกใช้ absolute ย้ายมาต่อท้ายข้อความเนียนๆ */
        margin-left: 2px;
        transform: scale(0.8);
    }

    /* stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 10px;
        min-width: 0;
    }

    .stat-desc {
        font-size: 11px;
        line-height: 1.3;
        overflow-wrap: break-word;
    }

    /* banner */
    .banner-item {
        height: 180px;
        border-radius: 35px !important;
    }

    .banner-text-wrap {
        padding: 20px;
        justify-content: center;
    }

    .banner-text-wrap h2 {
        font-size: 22px;
        text-align: center;
    }

    /* news */
    .news-card-item {
        flex-direction: column;
        gap: 15px;
    }

    .news-img-box {
        height: 200px;
        width: 100%;
        flex: none;
    }

    /* announcement */
    .announcement-title-box {
        padding: 12px 40px;
        font-size: 20px;
        text-align: center;
    }
}
