/* ========================================
 * 대시보드 페이지 전용 스타일
 * 계층: pages (단일 JSP 전용)
 * JSP: /WEB-INF/jsp/vasanta/mber/sfntask/sfnhome/sfndashboard.jsp
 * 네임스페이스: .page-sfndashboard
 * ======================================== */

/* 태블릿에서 카드 헤더 크기 조정 */
@media (max-width: 991.98px) {
    .card-header {
        padding: 0.75rem 1rem;
    }

    .card-header .card-title {
        font-size: 1rem !important; /* 0.9rem → 1rem, 태블릿에서도 폰트사이즈 유지 */
    }

    .card-header .btn {
        font-size: 1rem !important; /* 0.75rem → 1rem, 태블릿에서도 폰트사이즈 유지 */
        padding: 0.25rem 0.5rem;
    }
}

/* 사업장 현황 테이블 모바일 최적화 */
@media (max-width: 768px) {
    .card-header {
        padding: 0.5rem 0.75rem;
        flex-direction: row;
        align-items: center !important;
        flex-wrap: nowrap;
    }

    .card-header .card-title {
        font-size: 1rem !important; /* 0.85rem → 1rem, 모바일에서도 폰트사이즈 유지 */
    }

    .card-header .btn {
        font-size: 0.8rem !important; /* 모바일에서 버튼 폰트 축소 */
        padding: 0.2rem 0.4rem;
        white-space: nowrap;
    }

    #workplaceTableBody tr td {
        padding: 6px 8px !important;
        font-size: 15px !important; /* 11px → 15px */
    }

    #workplaceTableBody tr th {
        padding: 6px 8px !important;
        font-size: 15px !important; /* 11px → 15px */
    }
}

@media (max-width: 576px) {
    #workplaceTableBody tr td {
        padding: 4px 6px !important;
        font-size: 15px !important; /* 10px → 15px */
    }

    #workplaceTableBody tr th {
        padding: 4px 6px !important;
        font-size: 15px !important; /* 10px → 15px */
    }
}

/* 대시보드 인라인 스타일 대체 클래스 */
.dashboard-task-summary {
    font-size: 1rem; /* 0.875rem → 1rem */
}

.dashboard-info-icon {
    font-size: 1rem; /* 0.7rem → 1rem */
}

/* ========================================
   업무 상태 배지 (tasks.css 표준 스타일과 동일)
   ======================================== */
.sfn-badge-pending,
.sfn-badge-created,
.sfn-badge-working,
.sfn-badge-signing,
.sfn-badge-done {
    color: var(--sfn-neutral-800) !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 999px !important;
    font-size: var(--sfn-text-md);
    padding: 0.35em 0.65em;
    font-weight: 500;
    cursor: help;
}

.sfn-badge-pending  { background-color: #f0f0f0 !important; }
.sfn-badge-created  { background-color: #E0F2F6 !important; }
.sfn-badge-working  { background-color: #E2F7E0 !important; }
.sfn-badge-signing  { background-color: #FFF0D9 !important; }
.sfn-badge-done     { background-color: #E0EDFA !important; }

.sfn-badge-pending::before,
.sfn-badge-created::before,
.sfn-badge-working::before,
.sfn-badge-signing::before,
.sfn-badge-done::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sfn-badge-pending::before  { background-color: #999; }
.sfn-badge-created::before  { background-color: #3A9BB5; }
.sfn-badge-working::before  { background-color: #2DB84B; }
.sfn-badge-signing::before  { background-color: #FF8C00; }
.sfn-badge-done::before     { background-color: #2577D1; }

/* ========================================
   업무 상태 박스
   ======================================== */
.dashboard-status-box {
    width: 255px;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}
.dashboard-status-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--sfn-text);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.dashboard-status-name::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dashboard-status-pending .dashboard-status-name::before { background-color: var(--sfn-status-pending); }
.dashboard-status-created .dashboard-status-name::before { background-color: var(--sfn-status-rejected); }
.dashboard-status-working .dashboard-status-name::before { background-color: var(--sfn-status-progress); }
.dashboard-status-signing .dashboard-status-name::before { background-color: var(--sfn-status-signing); }
.dashboard-status-done    .dashboard-status-name::before { background-color: var(--sfn-status-completed); }
.dashboard-status-pending .dashboard-status-count { color: var(--sfn-status-pending); }
.dashboard-status-created .dashboard-status-count { color: var(--sfn-status-rejected); }
.dashboard-status-working .dashboard-status-count { color: var(--sfn-status-progress); }
.dashboard-status-signing .dashboard-status-count { color: var(--sfn-status-signing); }
.dashboard-status-done    .dashboard-status-count { color: var(--sfn-status-completed); }
.dashboard-status-desc {
    font-size: 14px;
    color: var(--sfn-text-muted);
    line-height: 1.4;
    margin-bottom: 10px;
}
.dashboard-status-count {
    font-size: 20px;
    font-weight: 700;
    color: var(--sfn-text);
}
.dashboard-status-pending { background-color: var(--sfn-status-pending-subtle); }
.dashboard-status-created { background-color: var(--sfn-status-rejected-subtle); }
.dashboard-status-working { background-color: var(--sfn-status-progress-subtle); }
.dashboard-status-signing { background-color: var(--sfn-status-signing-subtle); }
.dashboard-status-done    { background-color: var(--sfn-status-completed-subtle); }

.dashboard-table-small {
    font-size: 15px; /* 13px → 15px */
}

/* ========================================
   결재 현황 차트 범례 가운데 정렬
   ======================================== */
#signChart .apexcharts-legend {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
}

/* ========================================
   빠른 메뉴 타이틀 & 버튼
   ======================================== */
.page-sfndashboard .sfn-quick-menu-title {
    font-size: 18px;
}
.page-sfndashboard .sfn-quick-menu-title {
    padding-right: 20px;
    border-right: 1px solid var(--sfn-border-light);
}
.page-sfndashboard .sfn-quick-menu-title ~ div {
    flex: 1;
    justify-content: flex-start;
}
.page-sfndashboard .sfn-quick-menu-title ~ div .btn {
    font-size: 16px;
    width: 180px;
    justify-content: center;
}
.page-sfndashboard .sfn-quick-menu-title ~ div .btn i {
    font-size: 18px;
}

/* ========================================
   사업장 현황 테이블 (인라인 스타일 대체)
   ======================================== */
.page-sfndashboard .sfn-workplace-card-body {
    max-height: 280px;
    overflow-y: auto;
    padding: 20px;
}

.page-sfndashboard .sfn-workplace-thead-row {
    border-bottom: 1px solid var(--sfn-border-light);
}

.page-sfndashboard .sfn-workplace-th {
    width: 30%;
    padding: 12px 16px;
    font-weight: 600;
    color: #6c757d;
    border: none;
}

.page-sfndashboard .sfn-workplace-th-narrow {
    padding: 12px 8px;
    font-weight: 600;
    color: #6c757d;
    border: none;
    white-space: nowrap;
}

.page-sfndashboard .sfn-workplace-td-loading {
    padding: 20px;
    border: none;
}

/* JS 동적 생성 테이블 행/셀 */
.page-sfndashboard .sfn-workplace-row {
    border-bottom: 1px solid var(--sfn-border-table);
}

.page-sfndashboard .sfn-workplace-td {
    padding: 12px 16px;
}

.page-sfndashboard .sfn-workplace-td-narrow {
    padding: 12px 8px;
}

/* 빈 차트 컨테이너 */
.page-sfndashboard .sfn-empty-chart {
    height: 280px;
}

/* ========================================
   모바일 모달 표준 스타일 (390px 이하)
   문서: /docs/hr/03_MOBILE_MODAL.md
   ======================================== */

/* PC (390px 초과): 상단 X버튼 숨김 */
#noWorkplaceModal .modal-header .modal-close-btn-mobile,
#taskDetailModal .modal-header .modal-close-btn-mobile {
    display: none !important;
}

/* 모바일 (390px 이하): 모달 표준 스타일 */
@media (max-width: 430px) {
    /* 모달 정중앙 배치 */
    #noWorkplaceModal.modal.show,
    #taskDetailModal.modal.show {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    #noWorkplaceModal .modal-dialog,
    #taskDetailModal .modal-dialog {
        margin: 0;
    }

    /* 모달 컨텐츠 스타일 */
    #noWorkplaceModal .modal-content,
    #taskDetailModal .modal-content {
        border-radius: 11px;
        height: 55vh !important;
    }

    /* 모달 헤더 스타일 */
    #noWorkplaceModal .modal-header,
    #taskDetailModal .modal-header {
        border-bottom: 1px solid var(--sfn-border-light);
        padding: 14px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* 상단 X버튼 표시 */
    #noWorkplaceModal .modal-header .modal-close-btn-mobile,
    #taskDetailModal .modal-header .modal-close-btn-mobile {
        display: block !important;
        background: none;
        border: none;
        font-size: 24px;
        color: #6c757d;
        cursor: pointer;
        padding: 0;
        line-height: 1;
    }

    #noWorkplaceModal .modal-header .modal-close-btn-mobile:hover,
    #taskDetailModal .modal-header .modal-close-btn-mobile:hover {
        color: var(--sfn-text);
    }

    /* 하단 닫기버튼 숨김 */
    #noWorkplaceModal .modal-footer .modal-close-btn-pc,
    #taskDetailModal .modal-footer .modal-close-btn-pc {
        display: none !important;
    }

    /* 모달 타이틀 스타일 */
    #noWorkplaceModal .modal-title,
    #taskDetailModal .modal-title {
        font-weight: 600;
        font-size: 1.1rem;
    }

    /* 모달 푸터 스타일 */
    #noWorkplaceModal .modal-footer,
    #taskDetailModal .modal-footer {
        display: flex;
        flex-direction: row-reverse;
        gap: 8px;
        padding: 1rem;
        border-top: none !important;
    }

    #noWorkplaceModal .modal-footer .btn,
    #taskDetailModal .modal-footer .btn {
        flex: 1;
        margin: 0;
    }

    /* 딤 영역 드래그 방지 */
    #noWorkplaceModal.modal,
    #taskDetailModal.modal {
        overflow: hidden;
        touch-action: none;
    }

    /* ========================================
       customAlert 모달 (동적 생성) 스타일
       ======================================== */

    /* customAlert 모달 - 모바일 */
    .modal-type-alert.modal.show {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .modal-type-alert .modal-dialog {
        margin: 0;
        width: 90%;
        max-width: 320px;
    }

    .modal-type-alert .modal-content {
        border-radius: 11px;
        height: auto !important;
    }

    /* 모바일에서도 헤더 숨김 */
    .modal-type-alert .modal-header {
        display: none !important;
    }

    .modal-type-alert .modal-body {
        text-align: center;
        padding: 24px 20px 12px;
    }

    .modal-type-alert .modal-body p {
        margin: 0;
        font-size: 15px;
        line-height: 1.6;
        color: var(--sfn-text);
    }

    /* 버튼 순서: 회색(왼쪽) - 파랑(오른쪽) */
    .modal-type-alert .modal-footer {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 12px 20px 20px;
        border-top: none !important;
        margin-top: 0 !important;
    }

    .modal-type-alert .modal-footer .btn {
        flex: 1;
        margin: 0;
        max-width: 120px;
    }

    .modal-type-alert.modal {
        overflow: hidden;
        touch-action: none;
    }
}
