html, body {
    height: 100%;
}

body {
    margin: 0;
    display: flex;
    flex-direction: column;
    font-family: 'Sarabun', sans-serif;
    background: #f3f3f3;
}

/* 🔥 ตัวดัน footer ลง */
main {
    flex: 1;
    display: block;
}

/* HEADER */
.header {
    background: #fff;
    padding: 15px 40px;
    border-bottom: 1px solid #ddd;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    width: 50px;
    margin-right: 10px;
}

.font-size span {
    margin-left: 10px;
    background: #5a1a1a;
    color: #fff;
    padding: 5px 8px;
    border-radius: 50%;
    cursor: pointer;
}

/* NAV */
.nav ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    gap: 20px;
}

.nav a {
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.nav a:hover {
    color: #800000;
}

/* DROPDOWN */
.dropdown {
    position: relative;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    background: #7a0f0f;
    padding: 10px;
    min-width: 180px;
    z-index: 9999;
    border-radius: 4px;
}

.dropdown-menu a {
    display: block;
    color: #fff;
    padding: 8px;
}

.dropdown.active .dropdown-menu {
    display: block;
}

/* HERO */
.hero {
    height: 300px;
    background: url('https://images.unsplash.com/photo-1549880338-65ddcdfd017b') center/cover;
    position: relative;
}

.hero-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(80, 60, 40, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: #fff;
}

.hero-overlay h1 {
    font-size: 48px;
}

/* 🔥 AGENCY */
.agency {
    padding: 40px;
}

.agency-header {
    background: #7a0f0f;
    color: #fff;
    padding: 12px 40px;

    margin: -40px -40px 20px -40px; /* 🔥 ดันออกให้เต็ม */
    font-size: 20px;
}

.agency-container {
    display: flex;
    gap: 40px;
}

.agency-col {
    width: 50%;
}

/* list หลัก */
.agency-col ul {
    padding-left: 20px;
}

/* 🔥 list ย่อย */
.sub-list {
    margin-top: 5px;
    padding-left: 20px;
    list-style-type: circle; /* 👈 เปลี่ยนรูปจุด */
}

/* เพิ่มความห่างให้อ่านง่าย */
.agency-col li {
    margin-bottom: 6px;
}


/* SECTION */
.section {
    text-align: center;
    padding: 40px;
}

.section h2 {
    color: #7a0f0f;
}

/* CARDS */
.cards {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.card {
    width: 350px;
    background: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.card img {
    width: 100%;
}

/* 🔥 TAB */
.commander-tabs {
    text-align: center;
    margin-bottom: 20px;
}

.commander-tabs {
    text-align: center;
    margin: 20px 0;
    font-size: 16px;
}

.tab {
    cursor: pointer;
    color: #333;
    padding: 0 5px;
}

/* 🔥 ตัวที่เลือก */
.tab.active {
    color: #000;
    font-weight: bold;
    text-decoration: underline;
}

.tab.active {
    color: #800000;
    font-weight: bold;
}

/* 🔥 CONTENT */
.commander-content {
    display: none;
    text-align: center;
    padding: 40px 20px;
}

.commander-content.active {
    display: block;
}

/* 🔥 รูปใหญ่แบบในภาพ */
.commander-content img {
    width: 350px;        /* ขนาดรูป */
    max-width: 90%;
    height: auto;
    
    border: 1px solid #ccc;   /* กรอบบาง */
    padding: 10px;            /* เว้นขอบด้านใน */
    background: #fff;         /* พื้นขาว */
}

/* 🔥 ชื่อ */
.commander-content h3 {
    margin-top: 15px;
    font-size: 20px;
}

/* 🔥 ตำแหน่ง */
.commander-content p {
    margin-top: 5px;
    color: #333;
}

/* 🔥 PAGE TITLE */
.page-title {
    background: #7a0f0f;
    color: #fff;
    padding: 12px 40px;
    font-size: 20px;
    margin-top: 10px;
}

/* 🔥 HERO */
.laws-hero {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e9e4dd;
    padding: 40px;
}

.laws-text h1 {
    margin: 0;
    font-size: 32px;
}

.laws-text p {
    margin-top: 10px;
    color: #555;
}

.laws-img {
    font-size: 80px;
}

/* 🔥 TABLE */
.laws-table {
    padding: 20px 40px;
}

.table-header {
    display: grid;
    grid-template-columns: 80px 1fr 150px;
    background: #7a0f0f;
    color: white;
    padding: 10px;
}

.table-row {
    display: grid;
    grid-template-columns: 80px 1fr 150px;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    background: #fff;
}

.table-row:hover {
    background: #f9f9f9;
}

.file-icons {
    text-align: center;
}

/* 🔥 TAB */
.law-tabs {
    display: flex;
    gap: 10px;
    padding: 20px 40px;
}

.law-list {
    margin: 5px 0;
    padding-left: 20px;
    list-style: disc;
}

.law-list li {
    text-align: left;   /* 🔥 กันมันไปกลาง */
    margin-bottom: 6px;
}



.tab {
    background: #eee;
    padding: 8px 15px;
    cursor: pointer;
    border-radius: 4px;
}

.tab.active {
    background: #7a0f0f;
    color: #fff;
}



/* 🔥 COPY BUTTON */
.copy-btn {
    margin-top: 5px;
    padding: 5px 10px;
    border: none;
    background: #7a0f0f;
    color: #fff;
    cursor: pointer;
    border-radius: 4px;
}

.copy-btn:hover {
    background: #500909;
}

.laws-table {
    counter-reset: rowNumber;
}

.table-row {
    counter-increment: rowNumber;
}

.row-number::before {
    content: counter(rowNumber, thai);
}

/* 🔥 หัวข้อใหญ่ */
.law-title,
.law-section {
    display: block;
    width: 100%;
    max-width: 1000px;   /* 🔥 เท่ากัน */
    margin: 0 auto 15px; /* 🔥 จัดกึ่งกลางเหมือนกัน */

    font-weight: bold;
    color: #8B0000;

    border-bottom: 3px solid #8B0000; /* 🔥 เส้นเท่ากัน */
    padding-bottom: 5px;
}

/* แยกขนาดตัวอักษร */
.law-title {
    font-size: 26px;
}

.law-section {
    font-size: 20px;
    margin-top: 20px;
}

.laws-table {
    max-width: 1000px;
    margin: auto;
}

.hero-slider {
    display: flex;
    justify-content: center;
    margin: 30px 0;
}

.slider {
    width: 1100px;
    height: 400px;
    position: relative;
    overflow: hidden;
    border: 4px solid #5a0000;
}

/* กล่องเลื่อน */
.slides {
    display: flex;
    height: 100%;
    transition: transform 0.5s ease;
}

/* แต่ละรูป */
.slide {
    min-width: 100%;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;   /* 🔥 เปลี่ยนตรงนี้ */
    background: #000;      /* กันพื้นโล่ง */
}

/* ปุ่ม */
.prev, .next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 28px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
}

.prev { left: 10px; }
.next { right: 10px; }

.prev:hover, .next:hover {
    background: rgba(0,0,0,0.8);
}



/* FOOTER */
.footer {
    background: #6b0d0d;
    color: #fff;
    padding: 40px 60px 0;
}

.footer-container {
    display: flex;
    justify-content: space-between;
}

.footer-col a {
    color: #fff !important;
    text-decoration: none;
}

.footer-col a:visited {
    color: #fff !important;
}

.footer-col a:hover {
    color: #ddd;
    text-decoration: underline;
}
.footer-bottom {
    margin-top: 30px;
    padding: 15px;
    background: #222;
    text-align: center;
}
@media (max-width: 768px) {

    /* 🔥 FIX ล้นจอ */
    body {
        overflow-x: hidden;
    }

    /* =========================
    HEADER
    ========================= */
    .header {
        padding: 10px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .logo {
        width: 100%;
    }

    /* =========================
    🔥 NAV (แก้พังหลัก)
    ========================= */
    .nav {
        overflow-x: auto;
    }

    .nav ul {
        display: flex;
        flex-wrap: nowrap;        /* ❌ ห้ามขึ้นบรรทัดใหม่ */
        gap: 10px;
        padding: 10px 0;
        width: max-content;       /* 🔥 ยาวตามเนื้อหา */
    }

    .nav li {
        flex: 0 0 auto;
    }

    .nav a {
        white-space: nowrap;     /* 🔥 กันคำแตก */
        background: #eee;
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 14px;
    }

    /* =========================
    HERO
    ========================= */
    .laws-hero {
        flex-direction: column;
        text-align: center;
        padding: 20px 10px;
    }

    .laws-text h1 {
        font-size: 22px;
    }

    .laws-text p {
        font-size: 14px;
    }

    .laws-img {
        font-size: 50px;
        margin-top: 10px;
    }

    /* =========================
    🔥 TAB (เลื่อนแนวนอน)
    ========================= */
    .law-tabs {
        display: flex;
        overflow-x: auto;
        gap: 10px;
        padding: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .law-tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        flex: 0 0 auto;
        min-width: 130px;
        text-align: center;
        font-size: 14px;
        padding: 10px;
    }

    /* =========================
    🔥 TABLE เต็มจอ
    ========================= */
    .laws-table {
        max-width: 100%;
        padding: 10px;
    }

    .table-header,
    .table-row {
        grid-template-columns: 50px 1fr;
        font-size: 14px;
    }

    .table-header div:last-child,
    .table-row div:last-child {
        display: none;
    }

    /* =========================
    🔥 SECTION เต็มจอ
    ========================= */
    .section {
        padding: 20px 10px;
    }

    .agency {
        padding: 20px 10px;
    }

    .page-title {
        padding: 10px;
    }

    /* =========================
    CARD
    ========================= */
    .cards {
        flex-direction: column;
        align-items: center;
    }

    .card {
        width: 95%;
    }

    /* =========================
    SLIDER
    ========================= */
    .slider {
        width: 100%;
        height: 200px;
    }

    /* =========================
    FOOTER
    ========================= */
    .footer-container {
        flex-direction: column;
        gap: 15px;
    }
}
