/* ================================================================
   Operations Module — Premium UI Design System
   Applied to: Dashboard, Runs, Bags, Manifest, Dispatch, Discrepancies
   ================================================================ */

/* ─── Premium Table Wrapper ─── */
.ops-table-wrap {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.03);
    overflow: hidden;
    margin-bottom: 20px;
}

.ops-table-wrap .table {
    margin-bottom: 0;
    border: none;
}

.ops-table-wrap thead {
    background: linear-gradient(180deg, #F9FAFB 0%, #F3F4F6 100%) !important;
}

.ops-table-wrap thead th {
    color: #6B7280 !important;
    font-size: 11px !important;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 700 !important;
    border-bottom: 2px solid #E5E7EB !important;
    padding: 14px 18px !important;
    white-space: nowrap;
    background: transparent !important;
}

.ops-table-wrap tbody td {
    padding: 14px 18px !important;
    vertical-align: middle !important;
    color: #374151;
    font-size: 13.5px;
    border-bottom: 1px solid #F3F4F6 !important;
    border-top: none !important;
}

.ops-table-wrap tbody tr:last-child td {
    border-bottom: none !important;
}

.ops-table-wrap tbody tr {
    transition: background-color 0.15s ease;
}

.ops-table-wrap tbody tr:hover {
    background-color: #F9FAFB !important;
}

/* Numeric columns right-aligned */
.ops-table-wrap .text-end {
    text-align: right !important;
}

/* ─── Status Badges — Pill Style ─── */
.ops-table-wrap .badge,
.disc-table-wrap .badge {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

/* ─── Action Buttons in Tables ─── */
.ops-table-wrap .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.ops-table-wrap .btn-group .btn-sm {
    padding: 5px 10px;
}

/* ─── KPI Cards (Dashboard) ─── */
.ops-kpi-card {
    display: block;
    text-decoration: none !important;
    border-radius: 14px;
    background: #fff;
    padding: 20px 20px 18px;
    margin-bottom: 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    min-height: 116px;
}

.ops-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    text-decoration: none !important;
}

.ops-kpi-card .kpi-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ops-kpi-card .kpi-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}

.ops-kpi-card .kpi-label {
    font-size: 12px;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 6px;
}

.ops-kpi-card .kpi-count {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.1;
    color: #111827;
    margin-bottom: 4px;
}

.ops-kpi-card .kpi-count.text-danger {
    color: #DC2626 !important;
}

.ops-kpi-card .kpi-meta {
    font-size: 12px;
    color: #9CA3AF;
}

.ops-kpi-card .kpi-view {
    font-size: 12px;
    font-weight: 600;
    color: #F36621;
    margin-top: 10px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.15s;
}

.ops-kpi-card:hover .kpi-view {
    color: #E05A18;
}

/* KPI Color Variants */
.ops-kpi-card.color-warning .kpi-icon {
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    color: #EA580C;
}

.ops-kpi-card.color-blue .kpi-icon {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    color: #4338CA;
}

.ops-kpi-card.color-danger .kpi-icon {
    background: linear-gradient(135deg, #FEF2F2 0%, #FEE2E2 100%);
    color: #DC2626;
}

.ops-kpi-card.color-success .kpi-icon {
    background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
    color: #059669;
}

/* ─── Quick Action Buttons ─── */
.ops-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ops-quick-actions .btn {
    min-height: 44px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
}

/* ─── Section Cards ─── */
.ops-section-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #E5E7EB;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.ops-section-card .ops-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.ops-section-card .ops-section-head h5 {
    margin: 0;
    font-weight: 700;
    color: #111827;
    font-size: 16px;
}

.ops-section-card .ops-section-head .ops-view-all {
    font-size: 13px;
    font-weight: 600;
    color: #F36621;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 8px;
    transition: background 0.15s;
}

.ops-section-card .ops-view-all:hover {
    background: #FFF7ED;
    text-decoration: none;
}

/* ─── Empty States ─── */
.ops-empty {
    text-align: center;
    padding: 40px 16px;
    color: #9CA3AF;
}

.ops-empty i {
    font-size: 48px;
    color: #D1D5DB;
    display: block;
    margin-bottom: 12px;
}

.ops-empty.success i {
    color: #059669;
}

.ops-empty .ops-empty-title {
    font-weight: 600;
    color: #6B7280;
    margin-bottom: 4px;
    font-size: 15px;
}

/* ─── Mobile Card Rows ─── */
.ops-row-card {
    display: block;
    padding: 14px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    margin-bottom: 10px;
    text-decoration: none !important;
    color: inherit !important;
    background: #fff;
    transition: box-shadow 0.15s;
}

.ops-row-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.ops-row-card .rc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.ops-row-card .rc-title {
    font-weight: 700;
    color: #111827;
    font-size: 14px;
}

.ops-row-card .rc-sub {
    font-size: 12px;
    color: #6B7280;
}

.ops-row-card .rc-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    font-size: 12px;
    color: #6B7280;
    margin-top: 8px;
}

.ops-row-card .rc-meta strong {
    color: #111827;
}

/* ─── Responsive Breakpoints ─── */
.ops-table-wrap-show { display: block; }
.ops-card-list { display: none; }

@media (max-width: 767.98px) {
    .ops-table-wrap-show { display: none; }
    .ops-card-list { display: block; }
    .ops-kpi-card { min-height: auto; padding: 14px; }
    .ops-kpi-card .kpi-count { font-size: 24px; }
    .ops-kpi-card .kpi-icon { width: 44px; height: 44px; font-size: 22px; border-radius: 12px; }
    .ops-section-card { padding: 16px; }
    .ops-section-card .ops-section-head h5 { font-size: 15px; }
    .ops-quick-actions .btn-text { display: none; }
    .ops-quick-actions .btn { padding: 8px 10px; }
}

/* ─── Discrepancy-specific (shared with disc pages) ─── */
.disc-row-card {
    display: block;
    padding: 14px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    margin-bottom: 10px;
    text-decoration: none !important;
    color: inherit !important;
    background: #fff;
    transition: box-shadow 0.15s;
}

.disc-row-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* ─── Bag Detail Page ─── */
.bag-show .bag-stat-strip .stat-card {
    text-align: center;
    padding: 16px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    border: 1px solid #FED7AA;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.bag-show .bag-stat-strip .stat-card .stat-label {
    font-size: 11px;
    color: #92400E;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
}

.bag-show .bag-stat-strip .stat-card .stat-value {
    font-size: 22px;
    font-weight: 800;
    margin-top: 6px;
    color: #C2410C;
}

/* ─── Filter Section Enhancement ─── */
.bg-white.redious-border {
    border-radius: 14px !important;
    border: 1px solid #E5E7EB !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
}

/* ─── Pagination Enhancement ─── */
.ops-table-wrap + .mt-3 .pagination,
.bg-white.redious-border .mt-3 .pagination {
    gap: 4px;
}

.ops-table-wrap + .mt-3 .page-link,
.bg-white.redious-border .mt-3 .page-link {
    border-radius: 8px !important;
    font-size: 13px;
    padding: 6px 12px;
    border: 1px solid #E5E7EB;
    color: #374151;
}

.ops-table-wrap + .mt-3 .page-item.active .page-link,
.bg-white.redious-border .mt-3 .page-item.active .page-link {
    background: #F36621;
    border-color: #F36621;
    color: #fff;
}

/* ─── Link styling inside tables ─── */
.ops-table-wrap a.text-info {
    color: #2563EB !important;
    font-weight: 600;
    text-decoration: none;
}

.ops-table-wrap a.text-info:hover {
    color: #1D4ED8 !important;
    text-decoration: underline;
}

/* ─── Section Title ─── */
.section-title {
    color: #111827 !important;
    font-weight: 700 !important;
}

/* ─── Run Status Pills ─── */
.run-status-pills {
    gap: 6px;
}

.run-status-pills .status-pill {
    border-radius: 20px !important;
    font-size: 12px !important;
    padding: 6px 16px !important;
    font-weight: 600;
    transition: all 0.15s;
}

/* ================================================================
   Button Consistency — standardize all action buttons across ops
   ================================================================ */

/* Header action buttons (Create run, Create bag, Filter, Back) */
.header-top .sg-btn-primary,
.header-top .btn-sm.sg-btn-primary,
.oftions-content-right .sg-btn-primary,
.oftions-content-right .btn-sm.sg-btn-primary {
    min-height: 38px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* Form submit buttons */
.form-validate .sg-btn-primary,
.is-alter .sg-btn-primary,
.bg-white.redious-border .sg-btn-primary {
    min-height: 40px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

/* Outline secondary buttons (Cancel, Reset) */
.btn-outline-secondary {
    min-height: 38px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
}

/* Action dropdown toggle in tables */
.ops-table-wrap .btn-icon,
.ops-table-wrap .dropdown .btn-sm {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 16px;
}

/* ================================================================
   Table Full Width — force all operations tables to use full width
   ================================================================ */
.ops-table-wrap .table {
    width: 100% !important;
    table-layout: auto;
}

/* Runs table: prevent squished columns when table is wide */
.ops-table-wrap.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
}

/* ================================================================
   Filter Pills Enhancement — clear visual active/inactive states
   ================================================================ */

/* Bag index filter pills */
.bag-index .status-pill-row {
    padding: 12px 16px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.bag-index .status-pill {
    padding: 7px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 50px;
    background: #fff;
    color: #6B7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}

.bag-index .status-pill:hover {
    border-color: #F36621;
    color: #F36621;
    background: #FFF7ED;
}

.bag-index .status-pill.active {
    background: #F36621;
    border-color: #F36621;
    color: #fff;
    font-weight: 600;
}

/* Run index status pills */
.run-status-pills {
    border-radius: 12px;
}

.run-status-pills .status-pill.btn-outline-secondary {
    border: 1px solid #E5E7EB;
    color: #6B7280;
    background: #fff;
}

.run-status-pills .status-pill.btn-outline-secondary:hover {
    border-color: #F36621;
    color: #F36621;
    background: #FFF7ED;
}

.run-status-pills .status-pill.sg-btn-primary {
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(243, 102, 33, 0.2);
}

/* ================================================================
   Select2 styling for branch dropdowns
   ================================================================ */
.select2-container--default .select2-selection--single {
    min-height: 42px !important;
    border-radius: 8px !important;
    border: 1px solid #E5E7EB !important;
    display: flex;
    align-items: center;
    padding: 4px 8px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 42px;
    padding-left: 8px;
    color: #374151;
    font-size: 14px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border-radius: 6px;
    border: 1px solid #E5E7EB;
    padding: 8px 12px;
    font-size: 14px;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background: #F36621;
    color: #fff !important;
}

.select2-dropdown {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* ================================================================
   Run Detail / Bag Detail Page Consistency
   ================================================================ */

/* Run progress stepper */
.run-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9CA3AF;
}

.run-progress-step.active {
    color: #F36621;
    font-weight: 600;
}

/* Bag detail info rows */
.bag-show .bg-white.redious-border {
    border-radius: 14px !important;
}

/* Run summary card */
.run-summary-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.run-summary-card .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #F3F4F6;
    font-size: 14px;
}

.run-summary-card .summary-row:last-child {
    border-bottom: none;
}

.run-summary-card .summary-row .label {
    color: #6B7280;
}

.run-summary-card .summary-row .value {
    font-weight: 600;
    color: #111827;
}

