/* =====================================================
   띠용 ERP 공통 페이지 스타일
   ===================================================== */

/* 컨테이너 */
.erp-container {
    margin: 0 auto;
}

/* 개발 예정 안내 */
.wip-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 20px;
    color: #bbb;
}
.wip-notice i {
    font-size: 48px;
    color: #d9d9d9;
}
.wip-notice p {
    font-size: 15px;
    color: #aaa;
    margin: 0;
}

/* =====================================================
   페이지 헤더
   ===================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f0f0;
}

.page-title h1 {
    font-size: 22px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
    margin: 0 0 4px;
}

.page-title p {
    color: rgba(0, 0, 0, 0.45);
    font-size: 13px;
    margin: 0;
}

.page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* =====================================================
   버튼
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.btn-primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.btn-success {
    background: #52c41a;
    border-color: #52c41a;
    color: #fff;
}

.btn-success:hover {
    background: #73d13d;
    border-color: #73d13d;
    color: #fff;
}

.btn-danger {
    background: #ff4d4f;
    border-color: #ff4d4f;
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
    border-color: #ff7875;
    color: #fff;
}

.btn-warning {
    background: #faad14;
    border-color: #faad14;
    color: #fff;
}

.btn-warning:hover {
    background: #ffc53d;
    border-color: #ffc53d;
    color: #fff;
}

.btn-outline-primary {
    background: transparent;
    border-color: #1890ff;
    color: #1890ff;
}

.btn-outline-primary:hover {
    background: #1890ff;
    color: #fff;
}

.btn-outline-secondary {
    background: transparent;
    border-color: #d9d9d9;
    color: rgba(0, 0, 0, 0.65);
}

.btn-outline-secondary:hover {
    background: #f5f5f5;
    color: rgba(0, 0, 0, 0.85);
}

.btn-sm {
    padding: 3px 10px;
    font-size: 12px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
}

/* =====================================================
   카드
   ===================================================== */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    margin-bottom: 16px;
    overflow: hidden;
}

.card-head {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-head-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
}

.card-body {
    padding: 20px 24px;
}

.card-body-compact {
    padding: 12px 16px;
}

/* =====================================================
   검색/필터 영역
   ===================================================== */
.search-filter-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    margin-bottom: 16px;
    padding: 16px 24px;
}

.filter-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.filter-group label {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.65);
    font-weight: 500;
}

/* =====================================================
   폼 스타일
   ===================================================== */
.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 200px;
    margin-bottom: 16px;
}

.form-group.full-width {
    flex: 0 0 100%;
}

.form-group.w-half {
    flex: 0 0 calc(50% - 8px);
}

.form-group.w-third {
    flex: 0 0 calc(33.333% - 11px);
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
}

.form-label.required::after {
    content: ' *';
    color: #ff4d4f;
}

.form-control {
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    color: rgba(0, 0, 0, 0.85);
    background: #fff;
    transition: border-color 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #40a9ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.form-control:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

textarea.form-control {
    height: auto;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
}

.form-help {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
}

.form-error {
    font-size: 12px;
    color: #ff4d4f;
    min-height: 16px;
}

/* =====================================================
   테이블
   ===================================================== */
.table-wrapper {
    overflow-x: auto;
}

.erp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.erp-table thead th {
    background: #fafafa;
    border-bottom: 2px solid #f0f0f0;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
    white-space: nowrap;
}

.erp-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: rgba(0, 0, 0, 0.65);
    vertical-align: middle;
    white-space: nowrap;
}

.erp-table tbody tr.data-row {
    cursor: pointer;
}

.erp-table tbody tr:hover {
    background: #fafafa;
}

.erp-table tbody tr:last-child td {
    border-bottom: none;
}

.erp-table .text-center { text-align: center; }
.erp-table .text-right { text-align: right; }
.erp-table .text-nowrap { white-space: nowrap; }

.erp-table .col-check { width: 40px; text-align: center; }
.erp-table .col-no { width: 60px; text-align: center; }
.erp-table .col-actions { width: 120px; text-align: center; white-space: nowrap; }

/* 테이블 요약 행 */
.erp-table tfoot td {
    padding: 12px 16px;
    background: #fafafa;
    border-top: 2px solid #f0f0f0;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
}

/* 인라인 편집 테이블 (주문등록 등) */
.erp-table-edit {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.erp-table-edit th {
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.erp-table-edit td {
    padding: 6px 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.erp-table-edit td .form-control {
    height: 30px;
    padding: 4px 8px;
    font-size: 13px;
}

/* =====================================================
   뱃지 / 태그
   ===================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 10px;
    white-space: nowrap;
}

.badge-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-warning { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.badge-danger  { background: #fff1f0; color: #ff4d4f; border: 1px solid #ffa39e; }
.badge-info    { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.badge-default { background: #f5f5f5; color: rgba(0,0,0,.65); border: 1px solid #d9d9d9; }
.badge-purple  { background: #f9f0ff; color: #722ed1; border: 1px solid #d3adf7; }

/* =====================================================
   페이지네이션
   ===================================================== */
.pagination-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 16px;
    gap: 4px;
}

.pagination-wrap .page-item {
    list-style: none;
}

.pagination-wrap .page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    color: rgba(0, 0, 0, 0.65);
    font-size: 13px;
    cursor: pointer;
    background: #fff;
    text-decoration: none;
    transition: all 0.2s;
}

.pagination-wrap .page-link:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.pagination-wrap .page-item.active .page-link {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

.pagination-wrap .page-item.disabled .page-link {
    color: rgba(0, 0, 0, 0.25);
    cursor: not-allowed;
    background: #f5f5f5;
}

/* page-btn (button 태그 직접 사용 방식) */
.pagination-wrap .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    color: rgba(0, 0, 0, 0.65);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.pagination-wrap .page-btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}
.pagination-wrap .page-btn.active {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}
.pagination-wrap .page-btn:disabled,
.pagination-wrap .page-btn.disabled {
    color: rgba(0, 0, 0, 0.25);
    cursor: not-allowed;
    background: #f5f5f5;
}

/* 좌우 이동 버튼 (2/3 크기 축소) */
.pagination-wrap .page-btn.page-nav {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 4px;
    font-size: 9px;
}

/* =====================================================
   얇은 스크롤바
   ===================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #e8eef7;
    border-radius: 2px;
}
::-webkit-scrollbar-thumb {
    background: #4a7fc1;
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: #1a3a6b;
}
::-webkit-scrollbar-corner {
    background: #e8eef7;
}

.pagination-info {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
    margin-right: auto;
    padding-top: 16px;
}

/* =====================================================
   빈 상태 / 로딩
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: rgba(0, 0, 0, 0.25);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.empty-state p {
    font-size: 14px;
    margin: 0;
}

.loading-state {
    text-align: center;
    padding: 48px 24px;
    color: rgba(0, 0, 0, 0.45);
}

.loading-state i {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

/* =====================================================
   모달
   ===================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);
    width: 520px;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-box.modal-lg {
    width: 800px;
}

.modal-box.modal-xl {
    width: 1100px;
}

.modal-head {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.85);
}

.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: rgba(0, 0, 0, 0.45);
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: rgba(0, 0, 0, 0.85);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* =====================================================
   통계 카드 (정산/재고 요약)
   ===================================================== */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 21, 41, 0.08);
    padding: 20px 24px;
}

.stat-card-title {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.45);
    margin-bottom: 8px;
}

.stat-card-value {
    font-size: 24px;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.85);
    line-height: 1.2;
}

.stat-card-sub {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.45);
    margin-top: 4px;
}

.stat-card-icon {
    float: right;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    margin-top: -4px;
}

.stat-card-icon.blue  { background: #e6f7ff; color: #1890ff; }
.stat-card-icon.green { background: #f6ffed; color: #52c41a; }
.stat-card-icon.red   { background: #fff1f0; color: #ff4d4f; }
.stat-card-icon.orange{ background: #fff7e6; color: #fa8c16; }

/* =====================================================
   탭
   ===================================================== */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 20px;
    gap: 0;
}

.tab-nav-item {
    padding: 10px 20px;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.65);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s;
}

.tab-nav-item:hover {
    color: #1890ff;
}

.tab-nav-item.active {
    color: #1890ff;
    border-bottom-color: #1890ff;
    font-weight: 600;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* =====================================================
   인라인 입력 그룹
   ===================================================== */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 6px 0 0 6px;
    border-right: none;
    flex: 1;
}

.input-group .btn {
    border-radius: 0 6px 6px 0;
    border: 1px solid #d9d9d9;
}

.input-group .btn-outline-primary {
    border-color: #1890ff;
}

/* =====================================================
   파일 업로드
   ===================================================== */
.upload-area {
    border: 2px dashed #d9d9d9;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
    background: #fafafa;
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: #1890ff;
    background: #e6f7ff;
}

.upload-area i {
    font-size: 40px;
    color: rgba(0, 0, 0, 0.25);
    display: block;
    margin-bottom: 12px;
}

.upload-area p {
    color: rgba(0, 0, 0, 0.45);
    font-size: 14px;
    margin: 4px 0;
}

.upload-area .upload-hint {
    font-size: 12px;
    color: rgba(0, 0, 0, 0.25);
}

/* =====================================================
   체크박스
   ===================================================== */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #1890ff;
}

.form-check-label {
    font-size: 14px;
    color: rgba(0, 0, 0, 0.65);
    cursor: pointer;
}

/* =====================================================
   아코디언 (FAQ)
   ===================================================== */
.accordion-item {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.accordion-header {
    padding: 16px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: rgba(0, 0, 0, 0.85);
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #fafafa;
}

.accordion-header i.arrow {
    transition: transform 0.2s;
    color: rgba(0, 0, 0, 0.45);
}

.accordion-item.open .accordion-header i.arrow {
    transform: rotate(90deg);
}

.accordion-body {
    display: none;
    padding: 16px 20px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    font-size: 14px;
    color: rgba(0, 0, 0, 0.65);
    line-height: 1.8;
}

.accordion-item.open .accordion-body {
    display: block;
}

/* =====================================================
   유틸리티
   ===================================================== */
.text-right   { text-align: right; }
.text-center  { text-align: center; }
.text-primary { color: #1890ff; }
.text-success { color: #52c41a; }
.text-danger  { color: #ff4d4f; }
.text-warning { color: #fa8c16; }
.text-muted   { color: rgba(0, 0, 0, 0.45); }

.fw-bold { font-weight: 700; }
.fw-medium { font-weight: 500; }

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.divider {
    height: 1px;
    background: #f0f0f0;
    margin: 16px 0;
}

.detail-value {
    display: block;
    padding: 5px 10px;
    font-size: 13px;
    color: #262626;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    min-height: 32px;
    line-height: 1.6;
    word-break: break-word;
}

/* =====================================================
   반응형
   ===================================================== */
@media (max-width: 768px) {
    .filter-row { flex-direction: column; }
    .filter-group { min-width: 100%; }
    .page-header { flex-direction: column; gap: 12px; }
    .page-actions { width: 100%; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .form-group.w-half,
    .form-group.w-third { flex: 0 0 100%; }
    .modal-box { width: 95vw; }
}

/* =====================================================
   검색 영역 – 한 줄 표시 / 날짜범위
   ===================================================== */
/* 날짜 범위 그룹 (시작일 ~ 종료일) */
.field-group-date-range {
    flex-direction: row !important;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
.field-group-date-range .form-control {
    width: 128px;
    min-width: 0;
    flex-shrink: 0;
}
.date-range-sep {
    color: rgba(0, 0, 0, 0.45);
    font-size: 13px;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
}
/* 검색 행 한 줄 강제 */
.search-row {
    flex-wrap: nowrap !important;
    align-items: center !important;
}
.search-row .field-group {
    flex: 0 0 auto;
}
.search-row .field-group-wide {
    flex: 0 0 auto;
    width: 200px;
}
/* 검색 행 끝의 초기화/조회 버튼 */
.search-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}
/* 패널 헤더 우측 버튼 그룹 */
.panel-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.panel-header-actions .detail-actions,
.panel-header-actions .form-actions,
.panel-header-actions .discount-actions,
.panel-header-actions .permission-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* 검색어 입력 + 돋보기 아이콘 (input 안쪽에 표시) */
.search-row .input-with-btn {
    position: relative !important;
    display: block !important;
}
.search-row .input-with-btn .form-control {
    border-radius: 6px !important;
    padding-right: 32px !important;
    width: 100% !important;
    flex: none !important;
}
.search-row .input-with-btn .btn-icon {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 32px !important;
    border: none !important;
    border-left: 1px solid #d9d9d9 !important;
    background: transparent !important;
    border-radius: 0 6px 6px 0 !important;
    padding: 0 !important;
    color: rgba(0, 0, 0, 0.45);
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.search-row .input-with-btn .btn-icon:hover {
    color: #1890ff !important;
    background: rgba(24, 144, 255, 0.06) !important;
}
