/* ฟอนต์และการตั้งค่าพื้นฐาน */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

body {
    font-family: 'Kanit', sans-serif;
    background-color: #f8f9fa;
    line-height: 1.6;
}

/* การ์ด */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.card-header {
    border-radius: 12px 12px 0 0;
    border: none;
    font-weight: 500;
}

/* ตาราง */
.table {
    border-radius: 8px;
    overflow: hidden;
}

.table thead th {
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(0,123,255,0.05);
}

/* สถานะสี */
.status-not-started {
    background-color: #dc3545;
    color: white;
}

.status-in-progress {
    background-color: #ffc107;
    color: #212529;
}

.status-completed {
    background-color: #28a745;
    color: white;
}

/* กิจกรรมที่ผ่านมาแล้ว */
.table-secondary {
    background-color: rgba(108, 117, 125, 0.1);
}

.table-secondary td {
    opacity: 0.7;
}

/* ปุ่มกลุ่ม */
.btn-group .btn {
    border-radius: 6px;
    margin: 0 1px;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* แบดจ์ */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ฟอร์ม */
.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* นำทาง */
.navbar-brand {
    font-weight: 600;
    font-size: 1.1rem;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
    color: #6c757d;
}

/* วงกลมความคืบหน้า */
.progress-circle {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto;
    border-radius: 50%;
    background: conic-gradient(#28a745 0deg, #28a745 calc(var(--percentage) * 3.6deg), #e9ecef calc(var(--percentage) * 3.6deg), #e9ecef 360deg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-circle::before {
    content: '';
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
}

.progress-text {
    position: relative;
    text-align: center;
    z-index: 1;
}

.progress-text .percentage {
    font-size: 1.5rem;
    font-weight: bold;
    color: #28a745;
    display: block;
}

.progress-text small {
    font-size: 0.8rem;
    color: #6c757d;
}

/* สถิติ */
.stat-item {
    text-align: center;
    padding: 0.5rem;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* การแจ้งเตือน */
.alert {
    border: none;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
    color: #155724;
}

.alert-danger {
    border-left-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    color: #721c24;
}

.alert-warning {
    border-left-color: #ffc107;
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

.alert-info {
    border-left-color: #17a2b8;
    background-color: rgba(23, 162, 184, 0.1);
    color: #0c5460;
}

/* Modal */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    border-bottom: 2px solid #f8f9fa;
    border-radius: 12px 12px 0 0;
}

.modal-footer {
    border-top: 2px solid #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* ปุ่ม */
.btn {
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-width: 2px;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary {
    background: linear-gradient(135deg, #0d6efd, #0056b3);
    border-color: #0d6efd;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    border-color: #28a745;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    border-color: #ffc107;
    color: #000;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border-color: #dc3545;
}

.btn-info {
    background: linear-gradient(135deg, #17a2b8, #138496);
    border-color: #17a2b8;
}

/* DataTables การปรับแต่ง */
.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 6px;
    margin: 0 2px;
    padding: 0.5rem 0.75rem;
}

.dataTables_wrapper .dataTables_filter input {
    border-radius: 6px;
    border: 2px solid #e9ecef;
    padding: 0.375rem 0.75rem;
}

.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 2px solid #e9ecef;
    padding: 0.375rem 0.75rem;
}

/* การตอบสนองบนมือถือ */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0 15px;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 6px;
        margin: 1px 0;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .progress-circle {
        width: 100px;
        height: 100px;
    }
    
    .progress-circle::before {
        width: 70px;
        height: 70px;
    }
    
    .progress-text .percentage {
        font-size: 1.2rem;
    }
}

/* แอนิเมชันพิเศษ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease forwards;
}

/* สีธีมสำหรับหน่วยงาน */
.dept-color-1 { background-color: #FF6B6B; }
.dept-color-2 { background-color: #4ECDC4; }
.dept-color-3 { background-color: #45B7D1; }
.dept-color-4 { background-color: #96CEB4; }
.dept-color-5 { background-color: #FFEAA7; }
.dept-color-6 { background-color: #DDA0DD; }

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Tooltip ปรับแต่ง */
.tooltip {
    font-family: 'Kanit', sans-serif;
}

/* ไอคอนสถานะ */
.status-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.status-icon.not-started {
    background-color: #dc3545;
}

.status-icon.in-progress {
    background-color: #ffc107;
}

.status-icon.completed {
    background-color: #28a745;
}

/* การจัดระเบียบเนื้อหา */
.content-section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

/* ปุ่มลอย */
.floating-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.floating-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0,0,0,0.4);
}

/* การปรับแต่งฟอร์มค้นหา */
.search-box {
    position: relative;
}

.search-box .form-control {
    padding-left: 2.5rem;
}

.search-box .search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    z-index: 5;
}