/* WorkPilot 공통 스타일 */

/*
 * 모듈 판별 전 [data-module] 카드 깜빡임(FOUC) 방지.
 * 대시보드·나의 업무 등은 로드 직후 전체 카드를 렌더한 뒤 AJAX 로 비활성 모듈 카드를 숨긴다.
 * 판별이 끝나기 전까지(body 에 .modules-ready 부여 전) [data-module] 카드를 미리 숨겨
 * "전체 → 사용 모듈만" 으로 사라지는 깜빡임을 제거한다. JS 가 판별 완료 시 body 에 .modules-ready 부여.
 */
body:not(.modules-ready) [data-module] { display: none !important; }

/* Pretendard Variable — 단일 woff2 파일로 모든 weight 지원 (45~920) */
@font-face {
    font-family: 'Pretendard';
    font-weight: 45 920;          /* variable axis 범위 */
    font-style: normal;
    font-display: swap;
    src: local('Pretendard Variable'),                                  /* OS 설치 폰트 우선 사용 */
         url('/font/web/PretendardVariable-302ec55f5b4320354ec6b35a53dead87.woff2') format('woff2-variations'),
         url('/font/web/PretendardVariable-302ec55f5b4320354ec6b35a53dead87.woff2') format('woff2');     /* 폴백 — 구 브라우저 */
}

/* 전체 폰트 적용 — Tailwind 기본 system-ui 체인 앞에 Pretendard 추가 */
html, body, button, input, select, textarea {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    font-weight: 450;                 /* Variable axis — 기본 400보다 살짝 굵게 */
    -webkit-font-smoothing: auto;     /* subpixel — 글자 획이 또렷해지고 굵기감 살아남 */
    -moz-osx-font-smoothing: auto;
    text-rendering: optimizeLegibility;
    letter-spacing: -0.01em;          /* Pretendard 권장 자간 — 한글 가독성↑ */
    font-feature-settings: 'ss10';    /* 한글 자형 미세 조정 (작은따옴표 등) */
}

/* 숫자 컬럼 정렬용 — 테이블의 금액/날짜/시간 등에 .tabular 부여 */
.tabular { font-variant-numeric: tabular-nums; }

* { box-sizing: border-box; }

/* 폼 컨트롤 라이트 모드 강제 — OS 다크모드에서 select 옵션·input 자동완성·time/color picker 어둡게 표시되는 문제 방지 */
html, body { color-scheme: light; }
select, input, textarea { color-scheme: light; }
select option { background-color: #ffffff; color: #1f2937; }  /* gray-800 */
select option:checked, select option:hover {
    background-color: #eef2ff;  /* indigo-50 */
    color: #4f46e5;             /* indigo-600 */
}

.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 2px; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.15s ease-out; }

/* ── Flowbite Datepicker: 오늘 날짜 + 주말 + 당월/전달/다음달 구분 ── */
/* weekStart=0(일요일 시작) 고정이므로 grid 의 열 위치로 주말 식별 가능 */
/* 규칙 우선순위: 당월 기본 < 전달/다음달 < 주말(당월) < 오늘 (순서·specificity 로 보장) */

/* 당월 기본 — 진한 회색 */
.datepicker-grid .datepicker-cell.day {
    color: #1f2937;  /* gray-800 */
}
/* 전달/다음달 — 흐린 회색 (주말 색·당월 색보다 우선) */
.datepicker-grid .datepicker-cell.day.prev:not(.selected),
.datepicker-grid .datepicker-cell.day.next:not(.selected) {
    color: #cbd5e1 !important;  /* slate-300 */
}
/* 당월 일요일 — 빨강 */
.datepicker-grid .datepicker-cell.day:not(.prev):not(.next):not(.selected):nth-child(7n+1) {
    color: #dc2626;  /* red-600 */
}
/* 당월 토요일 — 파랑 */
.datepicker-grid .datepicker-cell.day:not(.prev):not(.next):not(.selected):nth-child(7n) {
    color: #2563eb;  /* blue-600 */
}
/* 날짜 셀 공통 — 작은 정사각형 원을 각 열 가운데 배치 (헤더와 정렬 유지) */
.datepicker-grid .datepicker-cell.day {
    width: 1.9rem;
    height: 1.9rem;
    justify-self: center;   /* grid 열 가운데 정렬 */
    margin: 0.1rem auto;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    line-height: 1;
}
/* 오늘 — 빨강 채움 원형으로 항상 표시 (주말·인접월 위에) */
/* .today = flowbite todayHighlight 옵션 / .wp-today = datepicker-init.js 직접 부여 */
.datepicker .datepicker-grid .datepicker-cell.day.today:not(.selected),
.datepicker .datepicker-grid .datepicker-cell.day.wp-today:not(.selected) {
    background-color: #ef4444 !important;  /* red-500 */
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 9999px;
}
/* 선택된 날짜 — 인디고 채움 원형 */
.datepicker .datepicker-grid .datepicker-cell.day.selected,
.datepicker .datepicker-grid .datepicker-cell.day.selected:hover,
.datepicker .datepicker-grid .datepicker-cell.day.focused.selected {
    background-color: #4f46e5 !important;  /* indigo-600 */
    color: #ffffff !important;
    border-radius: 9999px !important;
    font-weight: 600;
}
/* 요일 헤더 — 일/토 색상 */
.datepicker .days-of-week .dow:first-child { color: #dc2626; }
.datepicker .days-of-week .dow:last-child  { color: #2563eb; }

/* ── WorkPilot 워드마크 (로고 B안, 2026-10-29) — <span class="wp-wordmark">Work<b>Pilot</b></span> ── */
.wp-wordmark { font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.wp-wordmark b { font-weight: 800; }

/* ── 휴대폰 사이드바 (2026-10-29) ─────────────────────────────
   767px 이하에서는 사이드바를 왼쪽 슬라이드 메뉴로 바꾸고,
   각 화면 헤더 왼쪽에 메뉴(≡) 버튼을 붙인다 (sidebar.js 가 자동 삽입). */
.wp-menu-btn { display: none; }
@media (max-width: 767px) {
    #sidebar {
        position: fixed;
        top: 0; bottom: 0; left: 0;
        z-index: 65;
        width: 16rem;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform .22s ease, box-shadow .22s ease;
    }
    body.wp-sidebar-open #sidebar {
        transform: translateX(0);
        box-shadow: 0 10px 40px rgba(15, 23, 42, .25);
    }
    #wp-sidebar-overlay {
        display: none;
        position: fixed; inset: 0;
        z-index: 64;
        background: rgba(15, 23, 42, .35);
    }
    body.wp-sidebar-open #wp-sidebar-overlay { display: block; }

    .wp-menu-btn {
        display: inline-flex; align-items: center; justify-content: center;
        width: 40px; height: 40px;
        margin: 0 4px 0 -8px;
        flex-shrink: 0;
        border: 0; border-radius: 8px;
        background: none;
        color: #4b5563;
        cursor: pointer;
    }
    .wp-menu-btn:hover, .wp-menu-btn:focus-visible { background: #f3f4f6; }
    .wp-menu-btn.is-floating {
        position: fixed; top: 10px; left: 10px; z-index: 45;
        margin: 0;
        background: #fff;
        box-shadow: 0 1px 4px rgba(15, 23, 42, .15);
    }
}
