/* 
 * KNG Logistics Modern Theme 
 */

@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.8/dist/web/static/pretendard.css");

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    background-color: #f4f6f9 !important;
    color: #2c3e50;
    letter-spacing: -0.02em;
}

/* Card Styling */
.card {
    border: none !important;
    border-radius: 16px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03), 0 1px 4px rgba(0,0,0,0.02) !important;
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05), 0 2px 10px rgba(0,0,0,0.03) !important;
}

.card-body {
    padding: 1.75rem !important;
}

/* Headings & Typography */
h4 {
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.03em;
}

.form-label {
    font-weight: 600;
    font-size: 12px;
    color: #4a5568;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Inputs & Controls */
.form-control, .form-select {
    border-radius: 8px !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 13px !important;
    color: #2d3748 !important;
    background-color: #f8fafc !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    height: 42px !important;
    line-height: 1.5 !important;
}

.form-control {
    padding: 0.4rem 1rem !important;
}

.form-select {
    padding: 0.4rem 2.25rem 0.4rem 1rem !important;
}

.form-control:focus, .form-select:focus {
    background-color: #ffffff !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15) !important;
}

/* Buttons */
.btn {
    border-radius: 8px !important;
    padding: 0.5rem 1.25rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    border: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2) !important;
    color: white !important;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3) !important;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2) !important;
    color: white !important;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3) !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2) !important;
    color: white !important;
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3) !important;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2) !important;
    color: white !important;
}

.btn-warning:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.3) !important;
}

.btn-outline-primary {
    background: transparent !important;
    border: 2px solid #3b82f6 !important;
    color: #3b82f6 !important;
}
.btn-outline-primary:hover {
    background: #eff6ff !important;
    color: #2563eb !important;
}

.btn-outline-secondary {
    background: transparent !important;
    border: 2px solid #cbd5e1 !important;
    color: #64748b !important;
}
.btn-outline-secondary:hover {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

/* Custom Tabs */
.nav-tabs {
    border-bottom: none !important;
    gap: 0.5rem;
    background: #e2e8f0;
    padding: 0.3rem;
    border-radius: 10px;
    display: inline-flex;
}

.nav-tabs .nav-item {
    margin-bottom: 0;
}

.nav-tabs .nav-link {
    border: none !important;
    border-radius: 8px !important;
    padding: 0.6rem 1.5rem !important;
    color: #64748b !important;
    font-weight: 600 !important;
    background: transparent;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: #334155 !important;
}

.nav-tabs .nav-link.active {
    background: #ffffff !important;
    color: #0f172a !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Tables */
.table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    width: 100%;
}

.table thead th {
    background-color: #f8fafc !important;
    color: #475569 !important;
    font-weight: 600 !important;
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem !important;
    border-bottom: 2px solid #e2e8f0 !important;
    border-top: none !important;
}

.table tbody td {
    padding: 1rem !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #f1f5f9 !important;
    color: #334155 !important;
    font-size: 13px !important;
}

.table tbody tr:hover td {
    background-color: #f8fafc !important;
}

/* Compact Table Overrides */
.table.table-compact tbody td,
.table.table-compact tbody th,
.table.table-compact thead th {
    padding: 0.25rem 0.5rem !important;
}

/* Accordion */
.accordion-button {
    font-weight: 600;
    color: #1e293b;
    background-color: #f8fafc;
    border-radius: 8px !important;
    box-shadow: none !important;
}
.accordion-button:not(.collapsed) {
    color: #2563eb;
    background-color: #eff6ff;
    box-shadow: none !important;
}
.accordion-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px !important;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

/* Badges */
.badge {
    padding: 0.4em 0.8em;
    font-weight: 600;
    border-radius: 6px;
}
.bg-primary {
    background-color: #eff6ff !important;
    color: #2563eb !important;
}

/* Lot Deduction Callout */
.lot-callout {
    background-color: #f0fdfa;
    border-left: 4px solid #14b8a6;
    border-radius: 0 8px 8px 0;
    padding: 1.25rem;
    margin-top: 1.5rem;
}

.lot-callout h6 {
    color: #0f766e;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Autocomplete Customization */
.autocomplete-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1060;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    margin-top: 4px;
    padding: 4px;
}
.autocomplete-suggestion {
    border-radius: 4px;
    padding: 10px 12px;
    font-weight: 500;
}
.autocomplete-suggestion:hover, .autocomplete-suggestion.active-suggestion {
    background-color: #eff6ff;
    color: #2563eb;
}

/* Fix Bootstrap Modal conflict with styles.css custom modal */
.modal {
    z-index: 1055 !important;
}
.modal-backdrop {
    z-index: 1050 !important;
}
.modal-dialog .modal-content {
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
}

/* Drawer Detail Optimizations */
.drawer-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.drawer-meta-bar.inbound {
    background-color: #f0fdf4;
    border: 1px solid #dcfce7;
}
.drawer-meta-bar.outbound {
    background-color: #fef2f2;
    border: 1px solid #fee2e2;
}
.drawer-meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.drawer-meta-label {
    font-weight: 600;
    color: #64748b;
    font-size: 0.8rem;
}
.drawer-meta-value {
    font-weight: 700;
    color: #1e293b;
}

.drawer-items-table {
    font-size: 0.8rem;
}
.drawer-items-table thead th {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.75rem !important;
    background-color: #f8fafc !important;
    color: #64748b !important;
    border-bottom: 2px solid #e2e8f0 !important;
}
.drawer-items-table tbody td {
    padding: 0.4rem 0.5rem !important;
    vertical-align: middle;
    word-break: keep-all;
}
.drawer-items-table .sub-row td {
    padding: 0.25rem 0.5rem 0.5rem 0.5rem !important;
    font-size: 0.75rem;
    border-top: none !important;
    color: #64748b;
}
.drawer-items-table .total-row td {
    background-color: #f8fafc !important;
    font-weight: 700;
    font-size: 0.85rem;
    border-top: 2px solid #e2e8f0 !important;
}


/* Fix for small inputs and buttons inside tight grids (overriding universal !important) */
.form-control-sm, 
.form-select-sm,
.input-group-sm > .form-control, 
.input-group-sm > .form-select, 
.input-group-sm > .btn {
    height: 32px !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 12px !important;
}

.btn-sm {
    height: 32px !important;
    padding: 0.25rem 0.5rem !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
}

/* Segmented Control (Pill Tabs) */
.segmented-control {
    display: inline-flex;
    background-color: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    align-items: center;
}
.segmented-control .btn-check + label {
    padding: 6px 16px !important;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 600;
    color: #64748b;
    border-radius: 6px;
    border: none !important;
    background: transparent;
    transition: all 0.2s ease;
    margin: 0;
    height: auto !important;
    line-height: normal !important;
}
.segmented-control .btn-check:checked + label {
    background-color: #ffffff;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.segmented-control .btn-check + label:hover:not(.active) {
    color: #334155;
}

/* ========================================================
   ERP Filter Toolbar & Active Button Enhancements
   ======================================================== */
.btn-group-sm .btn,
.erp-preset-btn {
    font-size: 0.82rem !important;
    padding: 0.28rem 0.65rem !important;
    border-color: #cbd5e1 !important;
    color: #475569 !important;
    background-color: #ffffff !important;
    font-weight: 500 !important;
    transition: all 0.15s ease-in-out !important;
}

.btn-group-sm .btn:hover,
.erp-preset-btn:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border-color: #94a3b8 !important;
}

/* 활성화된 버튼 강조 스타일 (날짜 프리셋, 활성 탭 등) */
.btn-group-sm .btn.active,
.btn-group-sm .btn.btn-primary,
.erp-preset-btn.active,
.btn-group-sm .btn-check:checked + label {
    background-color: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3) !important;
    z-index: 2;
}

/* 매출/출고 전용 붉은색 선택 하이라이트 */
.btn-group-sm .btn-check#typeOut:checked + label,
.btn-group-sm .btn-check#btnFilterOut:checked + label {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.3) !important;
}

