/* ===== Base Formats ===== */
body {
    background: #faf5f5;
    min-height: 100vh;
    font-family: 'Kanit', sans-serif;
    color: #333;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255,107,107,0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255,107,107,0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ===== Hero Section ===== */
.hero-section {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #ff5252 100%);
    color: white;
    padding: 100px 0 140px;
    position: relative;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0% 100%);
}

.hero-section::before {
    content: ''; position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(255,255,255,0.12) 0%, transparent 70%);
    top: -200px; right: -100px; border-radius: 50%;
    animation: heroFloat 8s ease-in-out infinite;
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

/* ===== Content Container ===== */
.content-container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    padding: 40px;
    margin-top: -80px;
    margin-bottom: 50px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255,107,107,0.1);
}

/* ===== Sub-Menu Tabs ===== */
.admin-nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 30px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px dashed rgba(255,107,107,0.2);
}

.admin-nav-tabs .tab-pill {
    border: none;
    color: #555 !important;
    background: #fff;
    border-radius: 8px;
    font-weight: 500;
    padding: 10px 18px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    font-size: 0.95rem;
    text-decoration: none;
}

.admin-nav-tabs .tab-pill:hover {
    color: #ff6b6b !important;
    background: #fffafa;
}

.admin-nav-tabs .tab-pill.active {
    color: #fff !important;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    box-shadow: 0 4px 15px rgba(255,107,107,0.3);
}

/* ===== Modern DataTable Customization ===== */
.table {
    margin-bottom: 0;
    border-collapse: collapse;
}

.table thead th {
    background: linear-gradient(135deg, #ff6b6b, #ff5252) !important;
    color: white !important;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 15px 15px;
    border: none;
}

.table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
    font-weight: 400;
}

.table tbody tr:hover {
    background-color: #fff8f8;
    /* เอา Hover Effect Scale/Shadow ออก เพื่อป้องกันการล้นกรอบแล้วเกิด Scroll Bar */
}

.file-icon-box {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: #f8f9fa;
}

.btn-modern {
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-preview {
    background: rgba(255, 107, 107, 0.1);
    color: #ff5252;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-preview:hover {
    background: #ff5252;
    color: white;
    border-color: #ff5252;
}

.btn-download-modern {
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(255,107,107,0.2);
}

.btn-download-modern:hover {
    opacity: 0.9;
    color: white;
}

/* แก้อาการเบียดในเมนู DataTable ให้เป็นระเบียบ */
.dataTables_wrapper .row {
    align-items: center;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 0.5rem;
}

.dataTables_wrapper .dataTables_length select {
    margin: 0 0.5rem; /* เพิ่มช่องว่างรอบๆ ตัวเลือก */
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 5px 10px;
    outline: none;
    display: inline-block;
    width: auto;
}

/* แก้ปัญหาตัวเลขทับกับลูกศร */
.dataTables_wrapper .dataTables_length select {
    padding-right: 30px !important;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #ff6b6b;
    box-shadow: 0 0 0 0.2rem rgba(255,107,107,0.15);
}

.page-item.active .page-link {
    background-color: #ff6b6b;
    border-color: #ff6b6b;
}

.page-link {
    color: #ff6b6b;
}

.page-link:hover {
    color: #ff5252;
}

/* ===== Scroll Reveal ===== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 768px) {
    .hero-section { padding: 80px 0 110px; clip-path: polygon(0 0, 100% 0, 100% 92%, 0% 100%); }
    .content-container { padding: 20px; margin-top: -60px; border-radius: 16px; }
    .admin-nav-tabs { flex-direction: column; }
    .admin-nav-tabs .tab-pill { text-align: center; }

    /* Modern Mobile Table (Card Style) */
    .table-responsive { border: none; box-shadow: none; background: transparent; overflow-x: visible; }
    .table thead { display: none; }
    
    .table tbody tr {
        display: block;
        background: #fff;
        border: 1px solid rgba(255,107,107,0.2) !important;
        border-radius: 12px;
        margin-bottom: 15px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.04);
    }
    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right !important;
        border-bottom: 1px dashed #f0f0f0;
        padding: 12px 15px !important;
    }
    .table tbody td:last-child { border-bottom: none; }
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #ff6b6b;
        text-transform: uppercase;
        font-size: 0.85rem;
        flex-shrink: 0;
        margin-right: 15px;
    }
    /* ให้ช่องหัวข้อเรื่อง จัดบรรทัดใหม่ได้ถ้าเนื้อหายาว */
    .table tbody td[data-label="หัวข้อเรื่อง"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left !important;
    }
    .table tbody td[data-label="หัวข้อเรื่อง"]::before {
        margin-bottom: 8px;
    }
}
