/* ===== Department Section (กลุ่มงานกองกลาง) ===== */
.dept-section {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(255, 107, 107, 0.15);
    box-shadow: 0 4px 24px rgba(255, 107, 107, 0.08), 0 1px 4px rgba(0,0,0,0.04);
    overflow: hidden;
    animation: deptFadeIn 0.6s ease-out forwards;
}

@keyframes deptFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.dept-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.08) 0%, rgba(255, 142, 142, 0.06) 100%);
    border-bottom: 2px solid rgba(255, 107, 107, 0.12);
    position: relative;
}

.dept-section-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, #ff6b6b, #ff8e8e);
    border-radius: 2px;
}

.dept-header-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(255, 107, 107, 0.3);
}

.dept-header-title {
    font-family: 'Kanit', sans-serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: #2c3e50;
    margin: 0;
    letter-spacing: -0.01em;
}

.dept-header-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,107,107,0.2), transparent);
}

.dept-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 20px;
}

.dept-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 18px 10px 14px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid rgba(255, 107, 107, 0.1);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.dept-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,107,107,0.04) 0%, rgba(255,142,142,0.02) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dept-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 107, 107, 0.35);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.15), 0 2px 8px rgba(0,0,0,0.04);
}

.dept-card:hover::before {
    opacity: 1;
}

.dept-card:active {
    transform: translateY(-1px);
}

.dept-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--icon-gradient, linear-gradient(135deg, #ff6b6b, #ee5a24));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(255, 107, 107, 0.25);
    position: relative;
    z-index: 1;
}

.dept-card:hover .dept-card-icon {
    transform: scale(1.1) rotate(-5deg);
    box-shadow: 0 5px 18px rgba(255, 107, 107, 0.35);
}

.dept-card-label {
    font-family: 'Kanit', sans-serif;
    font-weight: 500;
    font-size: 0.82rem;
    color: #2c3e50;
    line-height: 1.4;
    transition: color 0.3s ease;
    position: relative;
    z-index: 1;
}

.dept-card:hover .dept-card-label {
    color: #c0392b;
}

.dept-card-arrow {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 10px;
    color: rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
    z-index: 1;
}

.dept-card:hover .dept-card-arrow {
    color: #ff6b6b;
    transform: translateX(3px);
}

/* Staggered entrance animation */
.dept-card:nth-child(1)  { animation: deptCardIn 0.4s 0.05s ease-out both; }
.dept-card:nth-child(2)  { animation: deptCardIn 0.4s 0.10s ease-out both; }
.dept-card:nth-child(3)  { animation: deptCardIn 0.4s 0.15s ease-out both; }
.dept-card:nth-child(4)  { animation: deptCardIn 0.4s 0.20s ease-out both; }
.dept-card:nth-child(5)  { animation: deptCardIn 0.4s 0.25s ease-out both; }
.dept-card:nth-child(6)  { animation: deptCardIn 0.4s 0.30s ease-out both; }
.dept-card:nth-child(7)  { animation: deptCardIn 0.4s 0.35s ease-out both; }
.dept-card:nth-child(8)  { animation: deptCardIn 0.4s 0.40s ease-out both; }
.dept-card:nth-child(9)  { animation: deptCardIn 0.4s 0.45s ease-out both; }
.dept-card:nth-child(10) { animation: deptCardIn 0.4s 0.50s ease-out both; }
.dept-card:nth-child(11) { animation: deptCardIn 0.4s 0.55s ease-out both; }

@keyframes deptCardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Responsive: Tablet */
@media screen and (max-width: 992px) {
    .dept-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
        padding: 16px;
    }

    .dept-section-header {
        padding: 16px 20px;
    }

    .dept-header-title {
        font-size: 1.05rem;
    }
}

/* Responsive: Small tablet / Large phone */
@media screen and (max-width: 768px) {
    .dept-section {
        margin-bottom: 16px;
        border-radius: 12px;
    }

    .dept-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 14px;
    }

    .dept-card {
        padding: 14px 8px 12px;
        border-radius: 10px;
    }

    .dept-card-icon {
        width: 44px;
        height: 44px;
        font-size: 17px;
        margin-bottom: 8px;
    }

    .dept-card-label {
        font-size: 0.75rem;
    }

    .dept-section-header {
        padding: 14px 16px;
        gap: 10px;
    }

    .dept-header-icon {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }

    .dept-header-title {
        font-size: 0.95rem;
    }
}

/* Responsive: Mobile */
@media screen and (max-width: 480px) {
    .dept-section {
        margin-bottom: 12px;
        border-radius: 10px;
    }

    .dept-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .dept-card {
        padding: 12px 6px 10px;
        border-radius: 8px;
    }

    .dept-card-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
        margin-bottom: 6px;
    }

    .dept-card-label {
        font-size: 0.72rem;
    }

    .dept-card-arrow {
        font-size: 8px;
        top: 6px;
        right: 6px;
    }

    .dept-section-header {
        padding: 12px 14px;
        gap: 8px;
    }

    .dept-header-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 8px;
    }

    .dept-header-title {
        font-size: 0.9rem;
    }
}
