/* ========================================
   셀러K — 매입상품 리스트 전용 스타일
   ======================================== */

/* ── Compact Table ── */
.sk-table {
    font-size: 11.5px !important;
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
}

.sk-table tbody td {
    border-bottom: 1px solid var(--gray-100);
}

.sk-table th,
.sk-table td {
    text-align: center !important;
    padding: 6px 5px !important;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Column widths ── */
.sk-table th { text-align: center !important; position: relative; }
.sk-table .col-check { width: 30px; text-align: center; }
.sk-table .col-date { width: 64px; white-space: nowrap; font-size: 10.5px; color: var(--gray-500); text-align: center; }
.sk-table .col-supplier { width: 84px; text-align: center; }
.sk-table .col-brand { width: 120px; text-align: center; }
.sk-table .col-name { width: auto; }
.sk-table td.col-name { text-align: left !important; font-size: 11px; line-height: 1.4; word-break: keep-all; }
.sk-table .col-color { width: 72px; text-align: center; }
.sk-table .col-num { width: 80px; }
.sk-table th.col-num, .sk-table td.col-num { text-align: center !important; padding-left: 2px !important; padding-right: 2px !important; }

/* ── Table Header Groups ── */
.th-group-purchase {
    background: rgba(79, 110, 247, 0.08) !important;
    color: var(--primary) !important;
}

.th-group-sales {
    background: rgba(34, 197, 94, 0.08) !important;
    color: var(--success) !important;
}

.th-group-settle {
    background: rgba(245, 158, 11, 0.08) !important;
    color: var(--warning) !important;
}

.th-group-label {
    text-align: center !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px;
}

/* ── Data Cell Tints (행 데이터에도 컬러 적용) ── */
td.buy-col {
    background: rgba(79, 110, 247, 0.035);
}
td.sell-col {
    background: rgba(34, 197, 94, 0.035);
}
td.profit-col {
    background: rgba(245, 158, 11, 0.035);
}

/* hover 시 색상 강조 — sk-table even 행도 확실히 덮어씀 */
.sk-table tbody tr:hover td.buy-col { background: rgba(79, 110, 247, 0.07) !important; }
.sk-table tbody tr:hover td.sell-col { background: rgba(34, 197, 94, 0.07) !important; }
.sk-table tbody tr:hover td.profit-col { background: rgba(245, 158, 11, 0.07) !important; }

/* 운임기준 태그 */
.col-basis {
    width: 52px;
    text-align: center !important;
    padding: 4px 2px !important;
}
.shipping-basis-tag {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    color: var(--primary);
    background: rgba(79, 110, 247, 0.1);
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
    cursor: default;
}

/* 정렬 아이콘 디자인 (기본 숨김, 텍스트 우측에 절대 배치) */
.sk-table th.sortable {
    padding-right: 16px !important; /* 아이콘 공간 확보 */
}
.sk-table th.sortable i {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    pointer-events: none;
}
.sk-table th.sortable:hover i {
    opacity: 0.3; /* 마우스 올릴 때 옅게 표시 */
}
.sk-table th.sortable.sort-active i {
    opacity: 1; /* 활성화 시 진하게 표시 */
    color: var(--primary);
}

/* Sub-header row */
.sk-table thead tr:nth-child(2) th {
    font-size: 10px;
    padding: 4px 5px !important;
    background: var(--gray-50);
}

/* ── Sortable Headers ── */
.sortable {
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast);
}

.sortable:hover {
    background: rgba(79, 110, 247, 0.06) !important;
}

.sortable i {
    font-size: 12px;
    opacity: 0.4;
    margin-left: 2px;
    vertical-align: middle;
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.sortable:hover i {
    opacity: 0.7;
}

.sortable.sort-active {
    background: rgba(79, 110, 247, 0.08) !important;
}

.sortable.sort-active i {
    opacity: 1;
    color: var(--primary);
    font-weight: 700;
}

/* ── Product Count Text ── */
.product-count-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-400);
    margin-left: 6px;
    letter-spacing: -0.2px;
}

/* ── Add Button ── */
.btn-add-product {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition-fast);
    white-space: nowrap;
}

.btn-add-product:hover {
    background: var(--primary-hover);
}

.btn-add-product i {
    font-size: 16px;
}

/* ── Modal Form Layout ── */
.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-form-grid .fg-full {
    grid-column: 1 / -1;
}

.modal-form-grid .fg {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.modal-form-grid .fg > label:first-child {
    font-size: 10.5px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    line-height: 1.2;
}

.modal-form-grid .fg input,
.modal-form-grid .fg select {
    height: 34px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font-size: 12.5px;
    font-weight: 500;
    outline: none;
    transition: all var(--transition-fast);
    background: var(--surface);
    color: var(--gray-800);
    width: 100%;
}

.modal-form-grid .fg input:focus,
.modal-form-grid .fg select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2.5px var(--primary-muted);
}

/* ── Modal Section Dividers ── */
.modal-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 8px 0 4px;
    margin: 4px 0 0;
    border-bottom: 1px solid var(--gray-100);
    grid-column: 1 / -1;
}

.modal-section-title.section-purchase {
    color: var(--primary);
}

.modal-section-title.section-sales {
    color: var(--success);
}

.modal-section-title.section-settle {
    color: var(--warning);
}

/* ── Preview / Auto-calc fields ── */
.calc-preview {
    background: var(--gray-50) !important;
    font-weight: 600 !important;
    color: var(--gray-600) !important;
    cursor: default;
}

.calc-preview.positive {
    color: var(--success) !important;
}

.calc-preview.negative {
    color: var(--danger) !important;
}

/* ── VAT Inline Chip (modal) ── */
.vat-inline {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    background: var(--primary-muted);
    border: 1px solid var(--primary);
    border-radius: 12px;
    font-size: 9px;
    font-weight: 700;
    color: var(--primary);
    margin-left: 4px;
    white-space: nowrap;
    vertical-align: middle;
}

.vat-inline.vat-included {
    background: rgba(239, 68, 68, 0.08);
    border-color: var(--danger);
    color: var(--danger);
}

/* ── Shipping basis auxiliary input ── */
.shipping-aux {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.shipping-aux input {
    width: 70px !important;
    flex-shrink: 0;
}

.shipping-aux span {
    font-size: 11px;
    color: var(--gray-500);
    white-space: nowrap;
}

/* ── Table compact number cells ── */
.data-table .col-num-sm {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 11.5px;
    white-space: nowrap;
}

/* ── Action column for seller-k ── */
.col-action-sk {
    width: 90px;
    text-align: center;
}

/* ── Empty state ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

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

.empty-state p {
    font-size: 14px;
    font-weight: 500;
}

.empty-state .hint {
    font-size: 12px;
    margin-top: 6px;
}

/* ── Modal footer ── */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-100);
}

/* ── Pagination Bar ── */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px 4px 6px;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.page-size-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-size-wrap label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    white-space: nowrap;
}

.page-size-select {
    height: 30px;
    padding: 0 24px 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-700);
    background: var(--surface);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.page-size-select:hover {
    border-color: var(--primary);
}

.page-size-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2.5px var(--primary-muted);
}

.pagination-summary {
    font-size: 12px;
    color: var(--gray-500);
    white-space: nowrap;
}

.pagination-summary strong {
    color: var(--gray-800);
    font-weight: 700;
}

.filtered-note {
    color: var(--primary);
    font-weight: 500;
    font-size: 11px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-muted);
}

.page-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(79, 110, 247, 0.3);
}

.page-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-btn i {
    font-size: 16px;
    line-height: 1;
}

.page-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 32px;
    font-size: 14px;
    color: var(--gray-400);
    letter-spacing: 2px;
    user-select: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .pagination-bar {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .pagination-info {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    .pagination-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
}