/* --- Global Styles --- */
body {
    font-family: 'K2D', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7f6; /* สีพื้นหลังอ่อนๆ */
}

a {
    color: #0d47a1; /* สีน้ำเงินเข้ม */
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* --- Header --- */
.app-header {
    background-color: #1976d2; /* สีน้ำเงินเข้ม */
    color: #fff;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.app-header img {
    height: 60px; /* ปรับขนาดโลโก้ตามความเหมาะสม */
    width: auto;
}

.top-nav a {
    color: #fff;
    margin-left: 15px;
    font-weight: 400;
}

.top-nav a:hover {
    text-decoration: underline;
}

/* --- Main Container --- */
.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

/* --- Introduction Section --- */
.thesis-intro {
    padding: 30px 0;
    text-align: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.thesis-intro h1 {
    color: #0d47a1; /* สีน้ำเงินเข้ม */
    font-weight: 600;
    margin-bottom: 10px;
}

.thesis-intro p {
    font-size: 1.1em;
    color: #555;
}

/* --- Thesis List Section (Placeholder for now) --- */
.thesis-list {
    padding-bottom: 30px;
}

/* --- Table Styling (จะใช้เมื่อเราใส่ข้อมูล Asp เข้าไป) --- */
.thesis-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.thesis-table th,
.thesis-table td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
    vertical-align: top;
}

.thesis-table th {
    background-color: #e0f2f7; /* โทนน้ำเงินอ่อน */
    color: #0d47a1; /* สีน้ำเงินเข้ม */
    font-weight: 600;
    font-size: 0.95em;
}

.thesis-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.thesis-table tr:hover {
    background-color: #e3f2fd; /* สีน้ำเงินอ่อนเพิ่มความน่าสนใจ */
}

.thesis-table td.student-name {
    font-weight: 600;
    color: #333;
}

.thesis-table td .thesis-title-th {
    font-weight: 500;
    color: #333;
}

.thesis-table td .thesis-title-en {
    font-style: italic;
    color: #555;
    font-size: 0.95em;
    margin-top: 5px;
    display: block;
}

.thesis-table .download-links a {
    display: inline-block;
    padding: 5px 10px;
    margin: 2px;
    background-color: #42a5f5; /* สีน้ำเงินปานกลาง */
    color: white;
    border-radius: 4px;
    font-size: 0.85em;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.thesis-table .download-links a:hover {
    background-color: #1976d2; /* สีน้ำเงินเข้มขึ้นเมื่อ Hover */
    text-decoration: none;
}

.thesis-table .download-links a.disabled {
    background-color: #bdbdbd; /* สีเทาสำหรับลิงก์ที่ไม่มีไฟล์ */
    cursor: not-allowed;
}

/* --- Footer --- */
.app-footer {
    text-align: center;
    padding: 20px;
    margin-top: 30px;
    background-color: #1976d2; /* สีน้ำเงินเข้ม */
    color: #fff;
    font-size: 0.9em;
    border-top: 1px solid #cfd8dc;
}

.app-footer img {
    margin-bottom: 10px;
}

.app-footer p {
    margin: 5px 0;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .top-nav {
        margin-top: 10px;
    }

    .top-nav a {
        margin: 0 10px 0 0;
    }

    .thesis-table, .thesis-table tbody, .thesis-table tr, .thesis-table td, .thesis-table th {
        display: block;
    }

    .thesis-table thead {
        display: none; /* ซ่อน header ของตารางบนจอเล็กเพื่อเปลี่ยนเป็น Card-like */
    }

    .thesis-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    }

    .thesis-table td {
        border: none;
        position: relative;
        padding-left: 50%; /* พื้นที่สำหรับ Label */
        text-align: right;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .thesis-table td::before { /* สร้าง Label สำหรับแต่ละ Cell */
        content: attr(data-label);
        position: absolute;
        left: 10px;
        width: calc(50% - 20px);
        padding-right: 10px;
        white-space: nowrap;
        text-align: left;
        font-weight: 600;
        color: #0d47a1;
    }

    /* ปรับ label ให้เหมาะสม */
    .thesis-table td[data-label="ชื่อปริญญานิพนธ์ (ไทย)"]::before,
    .thesis-table td[data-label="ชื่อปริญญานิพนธ์ (อังกฤษ)"]::before {
        line-height: normal; /* เพื่อรองรับชื่อเรื่องยาวๆ */
    }
    .thesis-table td.thesis-title-en::before { content: "Eng. Title"; }
    .thesis-table td.thesis-title-th::before { content: "Thai Title"; }
    .thesis-table td.student-name::before { content: "นิสิต"; }
    .thesis-table td.degree-level::before { content: "ระดับ"; }
    .thesis-table td.thesis-year::before { content: "ปีจบ/สอบ"; }
    .thesis-table td.download-links::before { content: "ดาวน์โหลด"; }

    .thesis-table td.download-links {
        text-align: left;
        padding-left: 10px;
    }
    .thesis-table td.download-links::before {
        display: none; /* ซ่อน label ดาวน์โหลด ถ้ามันซ้ำกับลิงก์เอง */
    }
}