/* ── 컴포넌트 ── */

/* ── 카드 ── */
.card {
    background: var(--white); border-radius: var(--card-radius);
    border: 0.0625rem solid var(--border-color); padding: 0.75rem;
    margin-bottom: 0.1rem; box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.05);
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 0.75rem; border-bottom: 1px solid var(--card-header-border);
    padding-bottom: 0.625rem;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--primary); margin: 0; display: flex; align-items: center; gap: 0.65rem; }
.card-no-border { border: none; margin-bottom: 0.5rem; padding-bottom: 0; }

/* ── 버튼 & 폼 ── */
.btn {
    padding: 0.5rem 1.25rem; border-radius: 0.35rem; border: 1px solid transparent;
    cursor: pointer; font-size: 0.875rem; transition: 0.2s;
    display: inline-flex; align-items: center; gap: 0.6rem; color: #fff; font-weight: 500;
}
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-warning { background: var(--warning); border-color: var(--warning); color: var(--dark); }
.btn-outline { background: transparent; color: var(--text-muted); border-color: var(--border-color); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; text-decoration: none; }

.btn-teal {
    background-color: var(--teal);
    color: #fff;
    border: 1px solid var(--teal);
    min-width: 5rem;
    white-space: nowrap;
}
.btn-teal:hover {
    background-color: var(--teal-dark);
    border-color: var(--teal-dark);
}

.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-main); }
.input {
    width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border-color);
    border-radius: 0.35rem; outline: none; font-size: 0.875rem;
    background: var(--input-bg); color: var(--text-main);
}

/* ── 탭 ── */
.tab-menu { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 1.5rem; overflow-x: auto; gap: 0.5rem; }
.tab-item {
    padding: 0.75rem 1.25rem; cursor: pointer; border-bottom: 2px solid transparent;
    font-size: 0.875rem; color: var(--text-muted); white-space: nowrap;
    display: flex; align-items: center; gap: 0.6rem;
}
.tab-item.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 700; }
.tab-pane { display: none; animation: fadeIn 0.3s; }
.tab-pane.active { display: block; }

/* ── 테이블 & 뱃지 ── */
.table-responsive { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-bottom: 0.75rem; }
.table th { background: var(--table-head-bg); font-weight: 700; color: var(--primary); padding: 0.625rem 0.875rem; border-bottom: 2px solid var(--border-color); text-align: center; }
.table td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--border-color); vertical-align: middle; color: var(--text-main); }

.badge { display: inline-block; padding: 0.25rem 0.75rem; border-radius: 0.25rem; font-size: 0.7rem; color: #fff; font-weight: 700; text-transform: uppercase; text-align: center; }
.bg-success { background: var(--success); }
.bg-info { background: var(--info); }
.bg-warning { background: var(--warning); }
.bg-danger { background: var(--danger); }

/* ── 프로그레스 & 로그 ── */
.progress-wrapper { margin-bottom: 1rem; }
.progress-info { display: flex; justify-content: space-between; font-size: 0.75rem; margin-bottom: 0.35rem; font-weight: 700; }
.progress-bg { height: 0.5rem; background: var(--border-color); border-radius: 1rem; overflow: hidden; }
.progress-bar { height: 100%; transition: width 0.6s ease; }

.log-row { display: flex; align-items: center; margin-bottom: 0.75rem; font-size: 0.875rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.log-row .badge { min-width: 5.5rem; margin-right: 1.25rem; flex-shrink: 0; }
.log-time { color: var(--text-muted); margin-right: 0.75rem; font-family: 'Courier New', monospace; font-size: 0.8125rem; }
.scroll-box { height: 12rem; overflow-y: auto; background: var(--scroll-box-bg); padding: 1.25rem; border-radius: 0.5rem; font-size: 0.8125rem; border: 1px solid var(--border-color); color: var(--text-main); }
.filter-box { background: var(--table-head-bg); padding: 0.875rem; border-radius: 0.5rem; margin-bottom: 1rem; border: 1px dashed var(--border-color); }

/* ── 모달 & 스피너 ── */
.spinner-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; z-index: 9999; visibility: visible; opacity: 1; transition: opacity 0.4s ease, visibility 0.4s; }
.spinner-overlay.hidden { visibility: hidden; opacity: 0; }
.spinner { width: 3.5rem; height: 3.5rem; border: 5px solid rgba(255, 255, 255, 0.2); border-top: 5px solid #fff; border-radius: 50%; animation: spin 1s linear infinite; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); display: none; align-items: center; justify-content: center; z-index: 2000; }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--white); border-radius: 0.5rem; width: 90%; max-width: 26rem; overflow: hidden; box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.15); color: var(--text-main); }
.modal-box.modal-lg { max-width: 46rem; }
.modal-header { padding: 1rem 1.5rem; background: var(--table-head-bg); border-bottom: 1px solid var(--border-color); font-weight: 700; }
.modal-body { padding: 1.5rem; font-size: 0.9375rem; }
.modal-footer { padding: 1rem 1.5rem; display: flex; justify-content: flex-end; gap: 0.5rem; border-top: 1px solid var(--border-color); }

.notice-container { position: fixed; top: 1.5rem; right: 1.5rem; z-index: 3000; display: flex; flex-direction: column; gap: 0.75rem; }
.notice-item { background: var(--sidebar-surface); color: #fff; padding: 1rem 1.5rem; border-radius: 0.375rem; font-size: 0.875rem; animation: slideIn 0.3s forwards; display: flex; align-items: center; gap: 0.85rem; }

/* ── 로그인 페이지 ── */
.login-wrapper { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - var(--header-height) - var(--footer-height) - (var(--main-padding) * 2)); }
.login-card { width: 100%; max-width: 400px; padding: 2.5rem !important; box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.1) !important; border-radius: 1rem !important; animation: fadeInUp 0.5s ease-out; }
.login-logo { width: 4rem; height: 4rem; background: var(--primary); color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.75rem; margin-bottom: 1rem; box-shadow: 0 4px 12px rgba(78, 115, 223, 0.3); }
.login-card .input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(78, 115, 223, 0.1); background: var(--white); }

@media (max-width: 480px) { .login-card { padding: 1.5rem !important; border: none; box-shadow: none !important; background: transparent; } }


/* ── 페이지 공통 확장 컴포넌트 ── */

/* ── 필터박스 내부 input/select 배경 흰색 강제 ── */
.filter-box .input {
    background: var(--white) !important;
}

/* ── 필터 행 레이아웃 ── */
.filter-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.filter-row + .filter-row {
    margin-top: 0.5rem;
}

/* ── 필터 select/input 고정 크기 ── */
.filter-select-sm  { height: 2.5rem; flex: 0 0 9rem; }
.filter-select-xs  { height: 2.5rem; flex: 0 0 6rem; }
.filter-input-grow { height: 2.5rem; flex: 1; }

/* ── 날짜 범위 묶음 (데스크탑 기본) ── */
.filter-date-range {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex: 0 0 auto;
}
.filter-date-input {
    height: 2.5rem;
    flex: 0 0 8.5rem;
}
.filter-date-sep {
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── user_id 입력 (데스크탑 기본) ── */
.filter-user-input {
    height: 2.5rem;
    flex: 0 0 8rem;
}

/* ── 태그 바로가기 ── */
.tag-shortcuts {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    flex-wrap: wrap;
}
.tag-btn {
    display: inline-flex;
    align-items: center;
    height: 1.75rem;
    padding: 0 0.75rem;
    border-radius: 2rem;
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--text-muted);
    font-size: 0.75rem;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}
.tag-btn:hover,
.tag-btn.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

/* ── 검색 버튼 (필터 2행 우측) ── */
.btn-search {
    height: 2.5rem;
    flex: 0 0 6rem;
    justify-content: center;
    gap: 0.5rem;
}

/* ── 검색+등록 버튼 묶음 ── */
.filter-action-group {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* ── 테이블 상단 옵션 바 ── */
.table-option-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.table-total {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.table-total strong {
    color: var(--text-main);
}
.table-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.select-sm {
    width: auto;
    height: 2rem;
    font-size: 0.8rem;
    padding: 0 0.5rem;
}

/* ── 상태 뱃지 고정 너비 ── */
.badge-status {
    display: inline-block;
    width: 5.5rem;
    text-align: center;
    padding: 0.3rem 0;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

/* ── 테이블 td 헬퍼 ── */
.td-center { text-align: center; }
.td-muted  { font-size: 0.75rem; color: var(--text-muted); }
.td-date   { font-size: 0.8rem;  color: var(--text-muted); }
.td-link   { color: var(--text-main); text-decoration: none; font-weight: 500; }
.td-link:hover { color: var(--primary); }

/* ── 아이콘 전용 정사각 버튼 ── */
.btn-icon {
    width: 2.5rem;
    padding: 0.35rem 0.25rem;
    justify-content: center;
}
/* ── 텍스트 라벨이 있는 링크 버튼 (btn-icon 오버라이드) ── */
.btn-icon-label {
    width: auto;
    padding: 0.5rem 1.25rem;
    text-decoration: none;
}

/* ── 테이블 줄무늬 ── */
.table-striped tbody tr:nth-child(even) {
    background: var(--table-head-bg);
}
.table-striped tbody tr:hover {
    background: var(--primary-bg);
}

/* ── 페이징 컨테이너 ── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    padding-top: 0.5rem;
}

/* ── 필드 래퍼 (label + input 세트) ── */
.field-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.field-label {
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    line-height: 1;
    padding-left: 0.1rem;
}

/* ── 썸네일 미리보기 ── */
.file-thumb-preview {
    width: 9rem;
    height: 6rem;
    border: 1px dashed var(--border-color);
    border-radius: 0.35rem;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* ── 첨부파일 목록 ── */
.file-attach-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}
.file-attach-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    background: var(--table-head-bg);
    border: 1px solid var(--border-color);
    border-radius: 0.35rem;
    font-size: 0.8125rem;
}
.file-attach-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-main);
}
.file-attach-size {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.file-attach-del {
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
}


/* ── 반응형 — 768px 이하 ── */
/* 대상: list.php (필터박스, 모바일 카드, 옵션바) */

@media (max-width: 768px) {

    /* ── 필터 1행: 상태/유형 → 2열, 검색타입+검색어 → 한 줄 ── */
    .filter-row {
        flex-wrap: wrap;
    }
    .filter-select-sm {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 0;
    }
    .filter-select-xs {
        flex: 0 0 5.5rem;
        height: 2.5rem;
    }
    .filter-input-grow {
        flex: 1 1 0;
        min-width: 0;
        height: 2.5rem;
    }

    /* ── 필터 2행 ── */
    .filter-row-wrap {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .filter-row-wrap .filter-select-sm {
        flex: 1 1 calc(50% - 0.25rem);
        height: 2.5rem;
    }
    .filter-date-range {
        flex: 1 1 100%;
    }
    .filter-date-input {
        flex: 1;
        height: 2.5rem;
        min-width: 0;
    }
    .filter-user-input {
        flex: 1 1 100%;
        height: 2.5rem;
    }
    .tag-shortcuts {
        flex: 1 1 100%;
    }

    /* ── 검색+등록 버튼 묶음 — 모바일 50:50 ── */
    .filter-action-group {
        flex: 1 1 100%;
        width: 100%;
    }
    .filter-action-group .btn-search {
        flex: 1 1 0;
        height: 2.5rem;
        justify-content: center;
    }
    .filter-action-group .btn-teal {
        flex: 1 1 0;
        height: 2.5rem;
        justify-content: center;
        min-width: 0;
    }

    /* ── 테이블 옵션바 ── */
    .table-option-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .table-controls {
        width: 100%;
    }
    .table-controls .select-sm {
        flex: 1;
        width: auto;
    }

    /* ── 테이블 thead 숨기기 (모바일에선 카드로 대체) ── */
    .table-card-mobile thead {
        display: none;
    }

    /* mobile-card-row: td 패딩/보더 제거 */
    .table-card-mobile tbody tr.mobile-card-row > td {
        padding: 0;
        border: none;
    }

    /* ── 모바일 카드 리스트 컨테이너 ── */
    .mobile-card-list {
        display: flex;
        flex-direction: column;
        gap: 0.625rem;
        padding: 0.25rem 0;
    }

    /* ── 모바일 카드 한 장 ── */
    .mobile-card {
        background: var(--white);
        border: 1px solid var(--border-color);
        border-left: 4px solid var(--border-color);
        border-radius: var(--card-radius);
        padding: 0.75rem 0.875rem;
        box-shadow: 0 0.1rem 0.5rem rgba(0,0,0,0.04);
        display: flex;
        flex-direction: column;
        gap: 0.375rem;
    }

    /* 상태별 left border */
    .mobile-card[data-status="Y"] { border-left-color: var(--success); }
    .mobile-card[data-status="N"] { border-left-color: var(--warning); }
    .mobile-card[data-status="D"] { border-left-color: var(--info); }
    .mobile-card[data-status="H"] { border-left-color: var(--danger); }

    /* ── 모바일 카드 헤더: 제목 + 편집버튼 한 줄 ── */
    .mobile-card-header {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.5rem;
        padding-bottom: 0.375rem;
        border-bottom: 1px solid var(--border-color);
    }

    /* 제목 */
    .mobile-card-title {
        flex: 1;
        min-width: 0;
        font-size: 0.9375rem;
        font-weight: 700;
        color: var(--text-main);
        text-decoration: none;
        line-height: 1.4;
    }
    .mobile-card-title:hover { color: var(--primary); }

    /* 메타 행: 타입 / 카드 / 카드순서 / 킥커 */
    .mobile-card-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0 1rem;
        padding: 0.2rem 0;
        border-bottom: 1px dashed var(--border-color);
    }
    .mobile-meta-item {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
        font-size: 0.75rem;
        color: var(--text-main);
        white-space: nowrap;
    }
    .mobile-meta-label {
        font-size: 0.6875rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
    }

    /* 작성자 / 작성일 행 */
    .mobile-card-info {
        display: flex;
        align-items: center;
        gap: 1rem;
        font-size: 0.8rem;
        color: var(--text-main);
    }
    .mobile-info-item {
        display: inline-flex;
        align-items: center;
        gap: 0.25rem;
    }
    .mobile-info-sep {
        color: var(--border-color);
        font-size: 0.75rem;
    }

}
