/* --- START: Sticky Footer Styles --- */
html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Sarabun', sans-serif;
    background-color: #f8f9fa;
    color: #212529;
}

main {
    flex: 1 0 auto;
    padding-top: 80px;
}

.footer {
    flex-shrink: 0;
    background-color: #343a40 !important;
    color: #e9ecef;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.15);
    font-size: 0.9rem;
    padding: 20px 0;
    margin-top: 2rem;
}
/* --- END: Sticky Footer Styles --- */


/* --- Navbar Styles --- */
.navbar {
    background: linear-gradient(90deg, #343a40 0%, #212529 100%) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 0.3rem 0.3rem;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
    color: #ffffff !important;
    display: flex;
    align-items: center;
}

.navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    padding: 0.5rem 1rem;
    margin: 0 2px;
    border-radius: 8px;
    transition: background-color 0.25s ease, color 0.25s ease;
}

.navbar .navbar-nav .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar .navbar-nav .nav-link.active {
    background-color: #dc3545;
    color: #ffffff;
    font-weight: 600;
}


/* --- Dashboard Header --- */
.dashboard-header {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1rem;
}
.dashboard-header .h2 {
    font-weight: 600;
    color: #343a40;
}


/* --- General Card Styles --- */
.card {
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
    background-color: #ffffff;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: #343a40;
    border-top-left-radius: 0.75rem !important;
    border-top-right-radius: 0.75rem !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-header .text-dark {
    color: #343a40 !important;
}


/* --- Dashboard Card Specific Styles --- */
.dashboard-cards-row .dashboard-card-item .card {
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    cursor: pointer;
    color: white !important;
    border: none;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    will-change: transform, box-shadow;
    position: relative;
    overflow: hidden;
}

.dashboard-cards-row .dashboard-card-item .card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2),
                0 0 20px var(--glow-color, rgba(255, 255, 255, 0.2));
}

.dashboard-cards-row .card .card-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.dashboard-cards-row .card .card-content .card-title {
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.dashboard-cards-row .card .card-content .card-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-cards-row .card .card-icon {
    font-size: 5rem;
    position: absolute;
    top: -10px;
    right: -10px;
    opacity: 0.15;
    z-index: 1;
    transition: transform 0.4s ease;
}

.dashboard-cards-row .card:hover .card-icon {
    transform: scale(1.1) rotate(-5deg);
    opacity: 0.2;
}

.dashboard-cards-row .card .stretched-link-custom {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.9rem;
    margin-top: 1rem;
    align-self: flex-start;
    z-index: 3;
    position: relative;
}

.dashboard-cards-row .card .stretched-link-custom:hover {
    color: #ffffff;
    text-decoration: underline;
}
.dashboard-cards-row .card .stretched-link-custom::after {
    position: absolute;
    top: -50px;
    right: -20px;
    bottom: -20px;
    left: -20px;
    z-index: 2;
    content: "";
}

.card.bg-danger {
    --glow-color: rgba(220, 20, 60, 0.5);
    background: linear-gradient(135deg, #DC143C, #8B0000) !important;
}
.card.bg-primary {
    --glow-color: rgba(30, 144, 255, 0.5);
    background: linear-gradient(135deg, #1E90FF, #4169E1) !important;
}
.card.bg-info {
    --glow-color: rgba(0, 206, 209, 0.5);
    background: linear-gradient(135deg, #00CED1, #20B2AA) !important;
}
.card.bg-warning {
    --glow-color: rgba(255, 140, 0, 0.5);
    background: linear-gradient(135deg, #FF8C00, #FF4500) !important;
}
.card.bg-success {
    --glow-color: rgba(46, 139, 87, 0.5);
    background: linear-gradient(135deg, #2E8B57, #006400) !important;
}
.card.bg-secondary {
    --glow-color: rgba(105, 105, 105, 0.5);
    background: linear-gradient(135deg, #696969, #2F4F4F) !important;
}
.card.bg-purple {
    --glow-color: rgba(123, 104, 238, 0.5);
    background: linear-gradient(135deg, #7B68EE, #6A5ACD) !important;
}


/* --- Table Styles --- */
.table-responsive {
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    overflow: hidden;
}

.table {
    margin-bottom: 0;
    font-size: 0.95rem;
}

.table th, .table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    /* แก้ไข: ลบ white-space: nowrap; เพื่อให้ข้อความสามารถขึ้นบรรทัดใหม่ได้ */
}

.table thead th {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

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


/* --- Form Styles --- */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 8px !important;
    border: 1px solid #ced4da;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.2);
}

.form-control.rounded-pill,
.form-select.rounded-pill {
    border-radius: 50rem !important;
}


/* --- Button Styles --- */
.btn {
    border-radius: 8px !important;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    transition: all 0.25s ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-group-sm > .btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.875rem;
}

.btn .bi {
    vertical-align: text-bottom;
}

.btn.rounded-pill {
    border-radius: 50rem !important;
}


/* --- Pagination styles --- */
.pagination .page-link {
    border-radius: 8px !important;
    margin: 0 3px;
    color: #dc3545;
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: #ffffff !important;
}

/* --- Media Queries for Responsiveness --- */
@media (max-width: 992px) {
    main {
        padding-top: 70px;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}