/* style.css */

@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb; /* Blue-600 */
    --primary-dark-color: #1d4ed8; /* Blue-700 */
    --secondary-color: #f59e0b; /* Amber-500 */
    --text-color: #1f2937; /* Gray-800 */
    --light-text-color: #4b5563; /* Gray-600 */
    --bg-color: #f9fafb; /* Gray-50 */
    --card-bg: #ffffff;
    --border-color: #e5e7eb; /* Gray-200 */
    --success-color: #10b981; /* Green-500 */
    --error-color: #ef4444; /* Red-500 */
}

body {
    font-family: 'Kanit', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    padding: 1rem 0;
    position: relative; /* สำคัญสำหรับตำแหน่งของเมนูแฮมเบอร์เกอร์ */
}

header .container {
    display: flex;
    flex-wrap: wrap; /* ให้เนื้อหาภายใน Header สามารถขึ้นบรรทัดใหม่ได้ */
    justify-content: space-between;
    align-items: center;
}

header .logo {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

header .logo img {
    height: 3.5rem; /* ปรับค่านี้ให้เป็นขนาดที่ต้องการ เช่น 3.5rem, 4rem หรือ 5rem */
    margin-right: 0.5rem;
}

header .logo span { /* เพิ่มส่วนนี้เพื่อปรับขนาดข้อความ "SDGs LAMS.KU" */
    font-size: 2.5rem; /* ปรับค่านี้ให้ใหญ่ขึ้นตามความเหมาะสม */
}


/* Hamburger Menu Button */
.hamburger-menu {
    display: none; /* ซ่อนปุ่มแฮมเบอร์เกอร์บนหน้าจอขนาดใหญ่ */
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1000; /* ให้ปุ่มอยู่เหนือเนื้อหาอื่น */
}

header nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

header nav a {
    color: var(--light-text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

header nav a:hover {
    color: var(--primary-color);
}

header nav .btn {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem; /* rounded-md */
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: 600;
}

header nav .btn-primary {
    background-color: var(--primary-color);
    color: white;
}

header nav .btn-primary:hover {
    background-color: var(--primary-dark-color);
    transform: translateY(-2px);
}

header nav .btn-secondary {
    background-color: #10b981; /* Green-500 */
    color: white;
}

header nav .btn-secondary:hover {
    background-color: #059669; /* Green-600 */
    transform: translateY(-2px);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(to right, #e0f2fe, #e0e7ff); /* Blue-100 to Indigo-100 */
    border-radius: 0.75rem; /* rounded-xl */
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 2.5rem;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    color: #1e3a8a; /* Blue-800 */
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.hero p {
    font-size: 1.25rem;
    color: var(--light-text-color);
    max-width: 48rem;
    margin: 0 auto 2rem;
}

.hero .btn {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
    padding: 0.75rem 2rem;
    border-radius: 9999px; /* rounded-full */
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.hero .btn:hover {
    background-color: var(--primary-dark-color);
    transform: translateY(-3px);
}

/* Section Headings */
.section-heading {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2.5rem;
    border-bottom: 4px solid var(--primary-color);
    padding-bottom: 0.5rem;
    display: inline-block; /* To make border-bottom fit content */
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* Card Styles */
.card {
    background-color: var(--card-bg);
    border-radius: 0.5rem; /* rounded-lg */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.15);
}

.card-img {
    width: 100%;
    height: 14rem; /* h-56 */
    object-fit: cover;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

.card-text {
    color: var(--light-text-color);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px; /* rounded-full */
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

.card-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.card-link:hover {
    color: var(--primary-dark-color);
}

/* SDG Goal specific styles on cards */
.sdg-goal-item {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.sdg-goal-item img {
    width: 4rem; /* w-16 */
    height: 4rem; /* h-16 */
    margin-bottom: 0.75rem;
}

.sdg-goal-item h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sdg-goal-item p {
    font-size: 0.875rem;
    color: var(--light-text-color);
}

/* Project Detail Page */
.project-detail {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
}

.project-detail .back-link {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.project-detail .back-link svg {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

.project-detail h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-color);
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.project-detail-image {
    width: 100%;
    height: 24rem; /* h-96 */
    object-fit: cover;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.project-detail h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--light-text-color);
    margin-bottom: 0.75rem;
}

.project-detail p {
    font-size: 1.125rem;
    color: var(--light-text-color);
    margin-bottom: 1rem;
}

.project-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    color: var(--light-text-color);
    font-size: 1.125rem;
}

.project-info-grid strong {
    font-weight: 600;
    color: var(--text-color);
}

.project-detail .sdg-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.project-detail .sdg-item-full {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: white;
    font-weight: 600;
    font-size: 1.125rem;
}

.project-detail .sdg-item-full img {
    width: 2rem;
    height: 2rem;
    margin-right: 0.5rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.gallery-grid img {
    width: 100%;
    height: 12rem; /* h-48 */
    object-fit: cover;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.gallery-grid img:hover {
    transform: scale(1.03);
}

/* Forms (Login, Admin) */
.form-container {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
    max-width: 600px;
    margin: 2.5rem auto;
}

.form-container h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--light-text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="date"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 1rem;
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="file"] {
    padding: 0.5rem 0;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5); /* blue-500 with 0.5 opacity */
    outline: none;
}

.form-group textarea {
    min-height: 8rem;
    resize: vertical;
}

.button-group {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
    gap: 1rem;
}

.btn-submit {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-submit:hover {
    background-color: var(--primary-dark-color);
    transform: translateY(-2px);
}

.btn-cancel {
    background-color: #d1d5db; /* Gray-300 */
    color: var(--text-color);
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-cancel:hover {
    background-color: #9ca3af; /* Gray-400 */
    transform: translateY(-2px);
}

.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert.success {
    background-color: #d1fae5; /* Green-100 */
    color: #065f46; /* Green-800 */
    border: 1px solid #34d399; /* Green-400 */
}

.alert.error {
    background-color: #fee2e2; /* Red-100 */
    color: #991b1b; /* Red-800 */
    border: 1px solid #f87171; /* Red-400 */
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Admin Table Styles */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
}

.admin-table th, .admin-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: #f9fafb; /* Gray-50 */
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--light-text-color);
}

.admin-table td {
    font-size: 0.875rem;
    color: var(--text-color);
}

.admin-table tbody tr:hover {
    background-color: #f3f4f6; /* Gray-100 */
}

.admin-table img {
    width: 4rem;
    height: 4rem;
    object-fit: cover;
    border-radius: 0.25rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}
.status-badge.published { background-color: #10b981; } /* Green */
.status-badge.draft { background-color: #f59e0b; } /* Amber */
.status-badge.archived { background-color: #6b7280; } /* Gray */

.action-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.action-buttons a, .action-buttons button {
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    transition: background-color 0.3s ease;
    cursor: pointer;
    border: none;
}

.action-buttons .edit-btn {
    color: white;
    background-color: var(--primary-color);
}
.action-buttons .edit-btn:hover { background-color: var(--primary-dark-color); }

.action-buttons .delete-btn {
    color: white;
    background-color: var(--error-color);
}
.action-buttons .delete-btn:hover { background-color: #b91c1c; } /* Red-700 */

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    gap: 0.5rem;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--light-text-color);
    transition: background-color 0.3s ease;
}

.pagination a:hover {
    background-color: #f3f4f6; /* Gray-100 */
}

.pagination .current {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    font-weight: 600;
}

.pagination .disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header .container {
        flex-direction: row; /* คงให้โลโก้และปุ่มแฮมเบอร์เกอร์อยู่แถวเดียวกัน */
        align-items: center;
    }

    .hamburger-menu {
        display: block; /* แสดงปุ่มแฮมเบอร์เกอร์บนหน้าจอขนาดเล็ก */
    }

    header nav {
        position: absolute;
        top: 100%; /* วางเมนูไว้ใต้ Header */
        left: 0;
        width: 100%;
        background-color: var(--card-bg);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
        flex-direction: column; /* จัดเรียงเมนูเป็นคอลัมน์ */
        align-items: flex-start;
        padding: 1rem 1.5rem;
        gap: 0.75rem; /* ระยะห่างระหว่างรายการเมนูบนมือถือ */
        display: none; /* ซ่อนเมนูเริ่มต้น */
        opacity: 0;
        transition: opacity 0.3s ease-in-out;
        z-index: 999;
    }

    header nav.nav-open {
        display: flex; /* แสดงเมนูเมื่อถูกเปิด */
        opacity: 1;
    }

    header nav a, header nav .btn {
        width: auto; /* ปรับความกว้างของลิงก์เมนูบนมือถือ */
        text-align: left;
        padding: 0.75rem 0; /* เพิ่ม padding แนวตั้งสำหรับลิงก์ */
        border-bottom: 1px solid var(--border-color); /* เส้นแบ่งระหว่างรายการ */
    }

    header nav .btn {
        width: 100%; /* ให้ปุ่มเต็มความกว้างในเมนูมือถือ */
        text-align: center;
        margin-top: 0.5rem; /* ระยะห่างระหว่างลิงก์และปุ่ม */
    }

    header nav a:last-child {
        border-bottom: none; /* ไม่มีเส้นแบ่งสำหรับรายการสุดท้าย */
    }

    header .logo img { /* ปรับขนาดโลโก้สำหรับมือถือ */
        height: 2.5rem;
    }

    header .logo span { /* ปรับขนาดข้อความโลโก้สำหรับมือถือ */
        font-size: 1.8rem;
    }

    .hero h1 {
        font-size: 2.5rem;
    }
    .hero p {
        font-size: 1rem;
    }

    .section-heading {
        font-size: 1.75rem;
    }

    .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* สำหรับ SDG goals บนหน้าจอขนาดเล็ก */

    .project-detail h1 {
        font-size: 2rem;
    }

    .project-detail-image {
        height: 16rem;
    }

    .project-info-grid {
        grid-template-columns: 1fr;
    }
}