:root {
    --primary-color: #87ad16;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --card-background: #ffffff;
    --text-color: #343a40;
    --orange-color: #e5981d;
    --danger-color: #dc3545;

}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: "Prompt", sans-serif;
    font-weight: 400;
    overflow-x: hidden;
}
.superscript {
    font-size: 0.8em; /* กำหนดขนาดตัวอักษรให้เล็กลง */
    color: var(--orange-color);
    vertical-align: super; /* จัดตำแหน่งให้สูงขึ้น */
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-color);
}

footer {
    background-color: var(--card-background);
    padding: 10px 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary-color);
    border-top: 1px solid #dee2e6;
}

/* ========== Layout หลัก ========== */
.dashboard-container {
    display: flex;
    max-width: 100%;
    min-height: 100vh;
}

/* ========== Sidebar - เดสก์ท็อป ========== */
.sidebar {
    width: 250px;
    background-color: var(--card-background);
    padding: 20px 0;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.logo {
    text-align: center;
    margin-bottom: 30px;
    padding: 0 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li a {
    display: block;
    padding: 12px 20px;
    color: var(--text-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.sidebar-nav li a:hover,
.sidebar-nav li.active a {
    background-color: #e9ecef;
    color: var(--primary-color);
}

.sidebar-nav li a i {
    margin-right: 10px;
}

/* ========== Main Content ========== */
.main-content {
    flex-grow: 1;
    padding: 30px;
    width: 80%;
}

/* ========== Top Bar - เดสก์ท็อป ========== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}

.user-info {
    display: flex;
    align-items: center;
}

.notification-icon {
    font-size: 1.2rem;
    margin-right: 20px;
    color: var(--secondary-color);
    cursor: pointer;
}

.user-profile {
    font-weight: 500;
}

/* ========== Mobile Top Bar ========== */
.mobile-top-bar {
    display: none;
    background: var(--card-background);
    padding: 10px 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 900;
    align-items: center;
    justify-content: space-between;
}

.logo-mobile {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
    white-space: nowrap;
}

.logo-mobile img {
    height: 40px;
    width: auto;
}

.menu-toggle {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
}

/* ========== Component อื่นๆ ========== */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.kpi-card h3 {
    font-size: 1rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
}

.metric {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 5px;
}

.trend {
    font-size: 0.85rem;
    font-weight: 600;
}

.trend.up {
    color: var(--primary-color);
}

.trend.down {
    color: var(--orange-color);
}

.data-charts {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-box {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-box h3 {
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.placeholder {
    height: 250px;
    background-color: #e9ecef;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--secondary-color);
    border-radius: 4px;
}

.action-items {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.order-list {
    margin-top: 15px;
}

.order-item {
    padding: 10px 0;
    border-bottom: 1px solid #f8f9fa;
    display: flex;
    justify-content: space-between;
}

.status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status.pending {
    background-color: #ffc107;
    color: #343a40;
}

.status.shipping {
    background-color: #17a2b8;
    color: white;
}


/* หน้าห้องเรียนและนักเรียน */

.btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-family: "Prompt", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn.btn-remove {
    background-color: var(--danger-color);
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn.btn-back {
    background-color: var(--orange-color);
    cursor: pointer;
    transition: background-color 0.2s;
}


.btn:hover {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-family: "Prompt", sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn:active {
    transform: translateY(1px);
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    padding: 8px;
    width: 300px;
    font-family: Prompt, sans-serif;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th,
td {
    padding: 12px;
    text-align: left;
    border: 1px solid #ddd;
}

th {
    background-color: #f4f4f4;
}

.action-btns a {
    margin-right: 8px;
    text-decoration: none;
    color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin-top: 10px;
    margin-left: auto;
    margin-right: auto;
    width: 600px;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
}

.close {
    float: right;
    font-size: 24px;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-family: Prompt, sans-serif;
}

.pagination {
    margin-top: 20px;
    text-align: center;
    overflow-x: auto;
    /* ← สำคัญ! */
    padding-bottom: 10px;
    white-space: nowrap;
    /* ป้องกันขึ้นบรรทัดใหม่ */
}

.pagination a {
    display: inline-block;
    margin: 0 4px;
    padding: 8px 12px;
    text-decoration: none;
    border: 1px solid #ddd;
    color: var(--primary-color);
    min-width: 36px;
    /* ขนาดขั้นต่ำ */
    text-align: center;
}

.pagination a.active {
    background: var(--primary-color);
    color: white;
}

/* สิ้นสุดหนเาห้องเรียนและนักเรียน */



/* ========== Responsive Design ========== */

/* มือถือ: ≤768px */
@media (max-width: 768px) {
    table {
        width: 100%;
        border-collapse: collapse;
        margin-top: 20px;
        font-size: small;
    }

    .top-bar {
        display: flex;
        /* ซ่อน top bar เดสก์ท็อป */
    }

    .mobile-top-bar {
        display: flex;
        background: var(--card-background);
        padding: 10px 15px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        position: fixed;
        /* ← เปลี่ยนจาก sticky เป็น fixed */
        top: 0;
        left: 0;
        width: 100%;
        z-index: 900;
        align-items: center;
        justify-content: space-between;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        transform: translateX(-100%);
        z-index: 1000;
        transition: transform 0.3s ease;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-top: 60px;
        /* เพิ่ม margin-top เพื่อห่างจาก top bar */
        margin-left: 0;
        padding: 20px;
        width: 100%;
    }

    .data-charts,
    .kpi-cards {
        grid-template-columns: 1fr;
    }

    .logo-mobile span {
        font-size: 14px;
    }

    .logo-mobile img {
        height: 32px;
    }
}