/* ==========================================
   Custom CSS for Dashboard
   ========================================== */

/* Global Styles */
body {
    background: #f5f7fa;
    min-height: 100vh;
    font-family: 'Sarabun', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* การ์ดสรุป */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
}

/* Icon Box */
.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.icon-box-large {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

/* Subtle background colors */
.bg-primary-subtle {
    background-color: rgba(13, 110, 253, 0.1) !important;
}

.bg-success-subtle {
    background-color: rgba(25, 135, 84, 0.1) !important;
}

.bg-info-subtle {
    background-color: rgba(13, 202, 240, 0.1) !important;
}

.bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

/* Card Colors */
.card-primary {
    border-left: 5px solid #5DADE2;
}

.card-success {
    border-left: 5px solid #48C9B0;
}

.card-info {
    border-left: 5px solid #A3E4D7;
}

.card-warning {
    border-left: 5px solid #85C1E2;
}

.card-body {
    padding: 1.5rem;
}

/* Table Styles */
.table thead th {
    background: linear-gradient(135deg, #48C9B0 0%, #5DADE2 100%);
    color: white;
    font-weight: 600;
    border: none;
    vertical-align: middle;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
}

.table thead th.sortable {
    cursor: pointer;
    user-select: none;
}

.table thead th.sortable:hover {
    background: linear-gradient(135deg, #3FAEA3 0%, #4A9FD8 100%);
}

.table tbody tr {
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table tbody td {
    vertical-align: middle;
    padding: 1rem 0.75rem;
    font-size: 0.95rem;
}

/* Badge Styles */
.badge {
    padding: 0.5em 0.8em;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.badge.bg-light {
    border: 1px solid #dee2e6;
    font-weight: 400;
}

.badge.bg-light:hover {
    background-color: #e9ecef !important;
    border-color: #adb5bd;
}

/* Department Badge in Table */
td .badge.bg-light {
    display: inline-block;
    margin: 2px;
    font-size: 0.8rem;
    padding: 0.4em 0.6em;
}

/* Larger badges for status */
.badge.fs-6 {
    font-size: 0.875rem !important;
    font-weight: 500;
}

.badge.fs-5 {
    font-size: 1rem !important;
}

/* Search Input */
#searchInput {
    border-radius: 8px;
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

#searchInput:focus {
    box-shadow: 0 0 0 0.25rem rgba(72, 201, 176, 0.25);
}

.input-group-lg .input-group-text {
    font-size: 1.1rem;
    padding: 0.75rem 1rem;
}

/* Chart Canvas */
canvas {
    max-height: 350px;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #48C9B0 0%, #5DADE2 100%) !important;
}

/* Footer */
footer {
    background: white;
    border-top: 3px solid #48C9B0;
}

/* Responsive */
@media (max-width: 768px) {
    .icon-box {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }

    .icon-box-large {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    .card-body h1 {
        font-size: 2rem;
    }
    
    .card-body h4 {
        font-size: 1.1rem;
    }

    .table {
        font-size: 0.85rem;
    }
    
    .table tbody td {
        padding: 0.75rem 0.5rem;
    }
    
    .badge {
        font-size: 0.75rem !important;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card, .row {
    animation: fadeIn 0.5s ease-out;
}

/* Loading State */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #48C9B0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Card Header */
.card-header {
    border-bottom: 2px solid #f0f0f0;
}

/* Table Scroll */
.table-responsive {
    max-height: 600px;
    overflow-y: auto;
}

.table-responsive::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #48C9B0;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #3FAEA3;
}

/* Sorted Column Indicator */
.table thead th.sorted-asc::after {
    content: " ▲";
    font-size: 0.8em;
}

.table thead th.sorted-desc::after {
    content: " ▼";
    font-size: 0.8em;
}

/* No Data Message */
.no-data {
    padding: 3rem;
    text-align: center;
    color: #6c757d;
}

.no-data i {
    font-size: 4rem;
    opacity: 0.3;
}

/* Department Expand Button */
.dept-expand-btn {
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #48C9B0 0%, #5DADE2 100%);
    border: none;
    color: white;
    font-size: 0.85rem;
    padding: 0.4em 0.7em;
    border-radius: 4px;
}

.dept-expand-btn:hover {
    background: linear-gradient(135deg, #3FAEA3 0%, #4A9FD8 100%);
    transform: scale(1.05);
}

.dept-hidden {
    display: none !important;
}

.dept-visible {
    display: inline-block !important;
    animation: fadeIn 0.3s ease-out;
}
