/* กำหนดตัวแปรสีหลัก เพื่อให้ปรับแก้ได้ง่ายในอนาคต */
:root {
    --primary-color: #1a56db; 
    --primary-hover: #1e40af;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-muted: #4b5563;
    --border-color: #e5e7eb;
    --error-bg: #fee2e2;
    --error-border: #f87171;
    --error-text: #991b1b;
}

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

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 800px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

/* Header & Logo */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.logo {
    max-width: 120px;
    height: auto;
    margin-bottom: 15px;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

header h2 {
    font-size: 16px;
    font-weight: 400;
    color: var(--text-muted);
}

/* Form Styles */
.search-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 30px;
}

.search-form label {
    font-weight: 700;
    font-size: 15px;
}

.search-form input[type="text"] {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-family: 'Sarabun', sans-serif;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.search-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.2);
}

.search-form button {
    background-color: var(--primary-color);
    color: white;
    font-family: 'Sarabun', sans-serif;
    font-weight: 700;
    font-size: 16px;
    padding: 14px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.1s ease;
    margin-top: 5px;
}

.search-form button:hover {
    background-color: var(--primary-hover);
}

.search-form button:active {
    transform: translateY(2px);
}

/* Results & Layout */
.result-container {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    /* Animation styles */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.result-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-container h2 {
    font-size: 20px;
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.student-info {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    margin-bottom: 25px;
}

.student-info p {
    margin-bottom: 8px;
    font-size: 16px;
}

.student-info p:last-child {
    margin-bottom: 0;
}

/* Error Message */
.error {
    background-color: var(--error-bg);
    border-left: 4px solid var(--error-border);
    color: var(--error-text);
    padding: 15px 20px;
    text-align: center;
    font-weight: 700;
}

/* Table Styles */
h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: var(--text-main);
}

.score-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.score-table thead {
    background-color: var(--primary-color);
    color: white;
}

.score-table th, .score-table td {
    padding: 14px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.score-table th {
    font-weight: 700;
    font-size: 15px;
}

.score-table tbody tr:hover {
    background-color: #f1f5f9;
}

.score-table tfoot {
    background-color: #e2e8f0;
}

.score-table tfoot td {
    font-size: 16px;
    color: var(--text-main);
    border-bottom: none;
}

/* Footer */
footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-muted);
}

.admin-link a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.admin-link a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}



/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }
    
    footer {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}