@charset "UTF-8";

/* =========================================
   1. ตั้งค่าพื้นฐาน (Base & Variables) - ธีม Academic Trust
   ========================================= */
:root {
    --primary-color: #0ea5e9;       /* น้ำเงินสดใส */
    --secondary-color: #10b981;     /* เขียวสบายตา */
    --accent-color: #0284c7;        /* น้ำเงินเข้ม */
    
    --text-dark: #0f172a;           /* เทาเข้ม อ่านสบายตา */
    --text-light: #475569;          /* เทากลาง */
    --bg-light: #eff6ff;            /* ฟ้าพาสเทล */
    --white: #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Prompt', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* Form Elements */
button, input, optgroup, select, textarea {
    font-family: 'Prompt', sans-serif !important;
}

a { text-decoration: none; color: inherit; transition: 0.3s; }
ul { list-style: none; }

/* Global Section Styles */
section { position: relative; }

.section-title {
    font-size: 2rem;
    color: var(--text-dark);
    font-weight: 600;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    letter-spacing: -0.5px; /* ปรับให้ดูแน่นขึ้นเล็กน้อย */
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin-bottom: 40px;
    border-bottom: 2px solid #e2e8f0; /* เส้นสีอ่อนลง */
    padding-bottom: 15px;
}

.section-header-row .section-title { margin-bottom: 0; }

/* =========================================
   2. Header & Navbar
   ========================================= */
header {
    background-color: rgba(255, 255, 255, 0.98); /* ทึบขึ้นเล็กน้อยเพื่อความเป็นทางการ */
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color); /* ใช้สีหลักแทน Gradient */
    text-decoration: none;
    display: flex; align-items: center; gap: 10px;
    transition: transform 0.3s;
}
.logo:hover { transform: scale(1.02); } /* ลดการขยายลง */
.logo i { color: var(--accent-color); } /* ไอคอนเป็นสีทอง */

/* --- Nav Links --- */
.nav-links { display: flex; gap: 30px; }

.nav-item {
    color: var(--text-dark);
    font-weight: 500;
    position: relative;
    padding: 5px 0;
}

.nav-item::after {
    content: '';
    position: absolute;
    width: 0; height: 2px;
    bottom: 0; left: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}
.nav-item:hover { color: var(--primary-color); }
.nav-item:hover::after { width: 100%; }

/* Dropdown Menu */
.nav-dropdown { position: relative; display: inline-block; }
.dropdown-toggle { cursor: pointer; display: flex; align-items: center; gap: 5px; }

.nav-dropdown-menu {
    display: none; position: absolute; top: 100%; left: 0;
    background-color: #fff; min-width: 200px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1); /* เงาคมขึ้น */
    border-radius: 6px; /* ลดความมน */
    padding: 10px 0; z-index: 1100;
    border: 1px solid #e2e8f0; animation: fadeIn 0.2s ease-in-out;
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }

.nav-dropdown-menu a {
    display: block; padding: 10px 20px;
    color: var(--text-dark); font-size: 0.95rem; transition: 0.2s;
    border-bottom: 1px solid #f8fafc;
}
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover {
    background-color: #f1f5f9; color: var(--primary-color); padding-left: 25px;
}
.nav-dropdown-menu a i { width: 20px; color: var(--primary-color); }

/* Buttons & Auth */
.btn-contact {
    background: var(--primary-color); /* สีพื้น */
    color: var(--white); padding: 8px 25px; 
    border-radius: 6px; /* ลดความมน */
    font-weight: 500; box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    transition: 0.3s;
}
.btn-contact:hover { transform: translateY(-1px); background-color: var(--secondary-color); }

.hamburger {
    display: none;
    cursor: pointer; width: 40px; height: 40px;
    align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--text-dark);
    border-radius: 6px; transition: 0.3s;
    border: none; background: transparent; z-index: 2000;
}
.hamburger i { width: 1.25em; text-align: center; display: inline-block; }
.hamburger:hover { background: #f1f5f9; }

.mobile-only-btn { display: none; }
.mobile-auth-wrapper { display: none; }

.user-dropdown { position: relative; display: flex; align-items: center; height: 100%; }
.dropbtn {
    background: var(--primary-color);
    color: white; padding: 8px 20px; 
    border-radius: 6px; /* ลดความมน */
    border: none;
    font-family: 'Prompt', sans-serif; font-size: 0.95rem; font-weight: 500;
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); transition: 0.3s;
}
.dropbtn:hover { background-color: var(--secondary-color); }
.dropdown-content {
    display: none; position: absolute; top: 100%; right: 0;
    background-color: #fff; min-width: 220px; box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-radius: 6px; z-index: 1001; border: 1px solid #e2e8f0;
    transform: translateY(15px); opacity: 0; transition: all 0.2s ease; padding: 5px 0;
}
.dropdown-content::before { content: ""; position: absolute; top: -20px; left: 0; width: 100%; height: 20px; background: transparent; }
.user-dropdown:hover .dropdown-content { display: block; opacity: 1; transform: translateY(5px); }
.dropdown-content a { color: var(--text-dark); padding: 12px 20px; display: flex; gap: 10px; font-size: 0.95rem; }
.dropdown-content a:hover { background-color: #f1f5f9; color: var(--primary-color); padding-left: 25px; }
.dropdown-content a.logout-item { color: #b91c1c; border-top: 1px solid #f1f5f9; }
.dropdown-content a.logout-item:hover { background-color: #fef2f2; }

/* =========================================
   3. Modal Styles
   ========================================= */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.5); z-index: 2000;
    justify-content: center; align-items: center; backdrop-filter: blur(2px); animation: fadeIn 0.3s;
}
.modal-content {
    background: white; width: 90%; max-width: 500px; padding: 30px; 
    border-radius: 8px; /* ลดความมน */
    box-shadow: 0 10px 25px rgba(0,0,0,0.08); position: relative; animation: slideUp 0.3s;
    border-top: 4px solid var(--secondary-color); /* เพิ่มแถบสีด้านบน */
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; border-bottom: 1px solid #f0f0f0; padding-bottom: 15px; }
.modal-header h3 { margin: 0; color: var(--primary-color); font-size: 1.3rem; }
.close-modal { background: none; border: none; font-size: 1.5rem; color: #94a3b8; cursor: pointer; }
.close-modal:hover { color: #b91c1c; }

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.95rem; color: var(--text-dark); }
.form-group input, .form-group select, .form-group textarea, .form-input {
    width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 6px;
    font-family: 'Prompt', sans-serif; outline: none; transition: 0.2s; background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus, .form-input:focus { 
    border-color: var(--secondary-color); box-shadow: 0 0 0 3px rgba(6, 95, 70, 0.12); 
}

.btn-submit-modal, .btn-submit-app {
    width: 100%; padding: 10px; background: var(--primary-color);
    color: white; border: none; border-radius: 6px; 
    font-size: 1rem; font-weight: 600; cursor: pointer; margin-top: 10px;
    transition: background 0.2s;
}
.btn-submit-modal:hover, .btn-submit-app:hover { background: var(--secondary-color); }

/* =========================================
   4. Page Header & Announcements Specific
   ========================================= */
.page-header { 
    background: linear-gradient(180deg, rgba(2, 132, 199, 0.88), rgba(16, 185, 129, 0.35)),
                url('../../img/banner7.jpg');
    background-size: cover;       /* ยืดรูปให้เต็มพื้นที่ */
    background-position: center;  /* จัดกึ่งกลางรูป */
    background-repeat: no-repeat; /* ห้ามปูซ้ำ */
    background-blend-mode: multiply;
    padding: 120px 0 60px; color: white; text-align: center; margin-bottom: 40px; 
    position: relative; 
    box-shadow: inset 0 -10px 20px rgba(0,0,0,0.1);
}
.page-header h1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 2.8rem;
    line-height: 1.1;
}
.page-header-logo {
    width: 56px;
    height: auto;
    border-radius: 14px;
    background: rgba(255,255,255,0.85);
    padding: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.header-actions {
    position: absolute; bottom: -20px; right: 50%; transform: translateX(50%);
    display: flex; gap: 10px; z-index: 10;
}

.search-box {
    width: 100%; max-width: 760px;
    margin: 24px auto 0;
}
.search-row {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    flex-wrap: wrap;
}
.search-input {
    flex: 1 1 320px;
    min-width: 220px;
    padding: 14px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.95);
    color: #0f172a;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    border-color: rgba(16,185,129,0.8);
    box-shadow: 0 0 0 4px rgba(16,185,129,0.15);
}

.btn-action {
    background: var(--secondary-color); color: white; border: none; padding: 10px 25px;
    border-radius: 30px; /* คงไว้ให้ดูต่างจากปุ่ม Form */
    font-weight: 600; cursor: pointer; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: flex; align-items: center; gap: 8px; transition: 0.3s;
    font-size: 0.95rem; font-family: 'Prompt', sans-serif;
}
.btn-action.add:hover { transform: translateY(-2px); background: #14532d; } /* เข้มขึ้น */

.btn-action.manage {
    background: white; color: var(--text-light); border: 1px solid #e2e8f0;
}
.btn-action.manage:hover { background: #d1fae5; color: var(--text-dark); }
.btn-action.manage.active {
    background: #d1fae5; color: #166534; border-color: #86efac;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.ann-list-box {
    background: white; border-radius: 8px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); /* เงาบางลง */
    border: 1px solid #d1fae5; overflow: hidden;
    margin-bottom: 30px;
}

.ann-table { width: 100%; border-collapse: collapse; }
.ann-table th { 
    background: #f1f5f9; padding: 15px; text-align: left; 
    font-weight: 600; color: var(--text-dark); 
    border-bottom: 2px solid #cbd5e1; 
}
.ann-table td { 
    padding: 15px; border-bottom: 1px solid #f1f5f9; 
    color: var(--text-dark); vertical-align: middle; 
}
.ann-table tr:hover { background-color: #ecfdf5; }

.ann-link { 
    color: var(--text-dark); text-decoration: none; font-weight: 500; display: block; line-height: 1.5;
    transition: 0.2s;
}
.ann-link:not(.btn-control):hover { color: var(--primary-color); }
.doc-meta {
    margin-top: 6px; color: #475569; font-size: 0.88rem; line-height: 1.4;
}
.doc-meta span { display: inline-block; vertical-align: middle; }
.meta-sep { margin: 0 8px; color: #94a3b8; }
.meta-time { color: #64748b; margin-left: 4px; font-size: 0.82rem; }

.date-col { width: 150px; text-align: right; color: var(--text-light); font-size: 0.9rem; white-space: nowrap; }
.icon-col { width: 50px; text-align: center; color: var(--primary-color); font-size: 1.2rem; }

/* Admin Controls in Table */
.admin-controls {
    display: none; position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    gap: 5px; z-index: 5;
}
.manage-mode-active .admin-controls { display: flex !important; }

.btn-control {
    width: 32px; height: 32px; border-radius: 4px; /* เหลี่ยมขึ้น */
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1); border: 1px solid #e2e8f0;
    cursor: pointer; font-size: 0.8rem; background: white; text-decoration: none;
}
.btn-control.edit { color: #d97706; }
.btn-control.edit:hover { background: #d97706; color: white; }
.btn-control.del { color: #ef4444; }
.btn-control.del:hover { background: #ef4444; color: white; }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 20px; }
.page-btn {
    padding: 8px 14px; border: 1px solid #e2e8f0; background: white; 
    border-radius: 6px; color: var(--text-dark); cursor: pointer; text-decoration: none;
    transition: 0.2s; font-size: 0.9rem;
}
.page-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.page-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }

/* Sidebar Menu */
.cat-menu { list-style: none; padding: 0; }
.cat-menu li { margin-bottom: 5px; border: 1px solid #e2e8f0; border-radius: 6px;}
.cat-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 15px; background: white; border-radius: 6px;
    border: 1px solid transparent; color: var(--text-dark);
    transition: 0.2s; text-decoration: none; font-size: 0.95rem;
}
.cat-link:hover { background-color: #bbf7d0; color: var(--primary-color); }
.cat-link.active { 
    background: var(--primary-color); color: white; 
    border-color: var(--primary-color); 
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2); 
}

.badge-new {
    background-color: var(--accent-color); /* สีทอง/ส้ม ตามธีม */
    color: white;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
    vertical-align: middle;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ปุ่มดาวน์โหลดไฟล์ */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--primary-color);
    background-color: #e0f2fe; /* ฟ้าอ่อนมาก */
    padding: 4px 10px;
    border-radius: 20px; /* มนๆ เหมือนแคปซูล */
    margin-left: 8px;
    text-decoration: none !important;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-download:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px); /* ลอยขึ้นนิดนึง */
    box-shadow: 0 2px 5px rgba(0,0,0,0.15); /* มีเงา */
}

.btn-download:active {
    transform: translateY(0);
}

/* Footer & Animation */
footer {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: rgba(255,255,255,0.95);
    padding: 30px 0;
    text-align: center;
    border-top: 4px solid var(--accent-color);
}
footer p { margin-bottom: 10px; }
footer p:last-child { margin-bottom: 0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* =========================================
   00. Responsive (Mobile)
   ========================================= */
@media (max-width: 1024px) {
    .container { padding: 0 20px; }
}

@media (max-width: 768px) {
    .hamburger { display: block; }
    .desktop-only-btn { display: none; }
    
    .mobile-only-btn {
        display: block; text-align: center; background: var(--primary-color);
        color: white; padding: 10px; border-radius: 6px; margin-top: 10px;
    }

    .nav-links {
        position: fixed; top: 70px; left: -100%; width: 100%; height: calc(100vh - 70px);
        background: #ffffff; flex-direction: column; padding: 20px 0 100px 0 !important;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        align-items: stretch; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.1);
        z-index: 999;
    }

    .nav-links.active { left: 0; }

    .nav-item {
        display: flex !important; align-items: center; padding: 15px 25px !important;
        font-size: 1rem; color: #334155; border-bottom: 1px solid #f1f5f9; width: 100%;
    }

    .nav-dropdown-menu {
        position: static; display: block; max-height: 0; overflow: hidden;
        transition: max-height 0.3s ease-out; background: #f8fafc !important;
        width: 100%; border: none; box-shadow: none; padding: 0 !important;
    }

    .nav-dropdown-menu a { padding: 12px 25px 12px 45px !important; border-bottom: 1px solid #f1f5f9; }
    .nav-dropdown.open .nav-dropdown-menu { max-height: 500px; }

    .dropdown-toggle i { float: right; transition: transform 0.3s; margin-left: auto; }
    .nav-dropdown.open .dropdown-toggle i { transform: rotate(180deg); }
    
    .mobile-auth-wrapper {
        display: block; margin: 20px 15px 30px 15px; background: #ffffff;
        border-radius: 8px; border: 1px solid #e2e8f0; overflow: hidden;
    }
    .mobile-user-info {
        display: flex; align-items: center; justify-content: space-between;
        padding: 15px 20px; cursor: pointer; transition: background-color 0.2s;
    }
    .mobile-user-info:hover { background-color: #f8fafc; }
    .mobile-user-info i.fa-user-circle { font-size: 2rem; color: var(--primary-color); }
    
    .mobile-auth-wrapper.open .mobile-user-info i.fa-chevron-down { transform: rotate(180deg); }

    .layout-grid { grid-template-columns: 1fr !important; }
    .date-col { display: block; text-align: left; width: auto; margin-top: 5px; font-size: 0.8rem; }
    .ann-table th { display: none; }
    .icon-col { display: none; }
    aside div { position: static !important; }
}