@charset "UTF-8";

:root {
    --primary-purple: #6a1b9a;
    --primary-light: #f0e6f6;
    --accent-purple: #8e24aa;
    --text-dark: #333333;
    --bg-light: #f4f6f9;
    --border-color: #e0e0e0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Sarabun', sans-serif;
}

body {
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Header & Banner */
.header-banner {
    background: linear-gradient(135deg, #4a148c, #6a1b9a);
    color: white;
    padding: 20px 15px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header-link {
    text-decoration: none;
    color: white;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
}

.header-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    margin-bottom: 8px;
    background: white;
}

.header-title {
    font-size: 1.6rem;
    font-weight: 700;
}

.header-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Admin Status Bar */
.admin-bar {
    background: #fff3cd;
    border-bottom: 1px solid #ffeeba;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #856404;
}

/* Container & Layout */
.container {
    max-width: 1000px;
    margin: 20px auto;
    padding: 0 15px;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    background: white;
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    gap: 4px;
}

.nav-item {
    flex: 1;
    text-align: center;
    padding: 10px 5px;
    text-decoration: none;
    color: #555;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--primary-light);
    color: var(--primary-purple);
}

.nav-item.active {
    background: var(--primary-purple);
    color: white;
}

/* Cards & Components */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-purple);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-group input, 
.form-group textarea, 
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.95rem;
}

button[type="submit"], .btn {
    background: var(--primary-purple);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    width: 100%;
    transition: background 0.2s;
}

button[type="submit"]:hover, .btn:hover {
    background: var(--accent-purple);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.gallery-grid img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-grid img:hover {
    transform: scale(1.03);
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.lightbox-img {
    max-width: 90%;
    max-height: 85vh;
    border-radius: 6px;
    object-fit: contain;
}

.lightbox-btn {
    position: absolute;
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    font-size: 2rem;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev { left: 15px; }
.lightbox-next { right: 15px; }
.lightbox-close { top: 15px; right: 15px; }

/* Responsive Table & Horizontal Scroll Hint */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.scroll-hint-text {
    display: none;
    font-size: 0.8rem;
    color: #888;
    text-align: right;
    margin-bottom: 6px;
    font-weight: 600;
}

table {
    width: 100%;
    min-width: 600px; /* บังคับความกว้างขั้นต่ำเพื่อป้องกันตารางบีบตัว */
    border-collapse: collapse;
    background: white;
}

th, td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

th {
    background: var(--primary-light);
    color: var(--primary-purple);
    font-weight: 700;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .scroll-hint-text {
        display: block; /* แสดงข้อความบอกเลื่อนขวาเฉพาะบนมือถือ */
    }

    th, td {
        padding: 8px 10px;
    }
}