/* ==========================================================================
   Smartworld ERP — Smooth Page, Card, Modal & Micro-Interaction Effects
   GPU-composited (transform + opacity) with prefers-reduced-motion support.
   ========================================================================== */

@view-transition {
    navigation: auto;
}

@keyframes swFadeSlideUp {
    from {
        opacity: 0;
        transform: translate3d(0, 10px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes swFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes swShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Main page content gentle entrance */
.content-wrapper > .content,
section.content {
    animation: swFadeIn 220ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* Never trap fixed Bootstrap modals on POS screens inside an opacity/animation stacking context */
body.lockscreen section.content {
    animation: none !important;
    transform: none !important;
}

/* Dashboard & system cards entrance + hover lift */
.ppe-kpi-card,
.ppe-chart-card,
.ppe-mlist-card,
.box,
.info-box,
.small-box {
    transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 200ms cubic-bezier(0.22, 1, 0.36, 1),
                border-color 200ms ease;
    animation: swFadeSlideUp 320ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

/* Staggered entrance for dashboard KPI cards */
.ppe-home-kpis > .ppe-kpi-card:nth-child(1)  { animation-delay: 20ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(2)  { animation-delay: 45ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(3)  { animation-delay: 70ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(4)  { animation-delay: 95ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(5)  { animation-delay: 120ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(6)  { animation-delay: 145ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(7)  { animation-delay: 170ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(8)  { animation-delay: 195ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(9)  { animation-delay: 220ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(10) { animation-delay: 245ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(11) { animation-delay: 270ms; }
.ppe-home-kpis > .ppe-kpi-card:nth-child(12) { animation-delay: 295ms; }

.ppe-kpi-card:hover,
.ppe-chart-card:hover,
.ppe-mlist-card:hover,
.info-box:hover,
.small-box:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 12px 26px -8px rgba(15, 23, 42, 0.12), 0 4px 10px -4px rgba(15, 23, 42, 0.06);
}

.box:hover {
    box-shadow: 0 8px 22px -6px rgba(15, 23, 42, 0.09);
}

/* Tactile button & pill micro-interactions */
.btn,
.tw-dw-btn,
.ppe-dash-pill-btn,
.ppe-period-btn,
.ppe-kpi-action-btn {
    transition: transform 140ms cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 160ms ease,
                background-color 160ms ease,
                border-color 160ms ease,
                color 160ms ease;
}

.btn:active,
.tw-dw-btn:active,
.ppe-dash-pill-btn:active,
.ppe-period-btn:active {
    transform: scale(0.98);
}

/* List items & DataTable rows smooth hover */
.ppe-mlist-item,
table.dataTable tbody tr,
.table-hover > tbody > tr {
    transition: background-color 150ms ease, transform 150ms ease;
}

.ppe-mlist-item:hover {
    transform: translate3d(2px, 0, 0);
}

/* Smooth modal & dropdown transitions */
.modal.fade .modal-dialog {
    transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 200ms ease;
    transform: translate3d(0, -12px, 0) scale(0.985);
}

.modal.in .modal-dialog {
    transform: translate3d(0, 0, 0) scale(1);
}

.open > .dropdown-menu {
    animation: swFadeSlideUp 160ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Subtle shimmer on updating KPI cards & DataTables processing indicator */
.ppe-kpi-updating .ppe-kpi-val {
    opacity: 0.65;
}

.dataTables_wrapper .dataTables_processing {
    background: linear-gradient(90deg, rgba(255,255,255,0.92) 25%, rgba(241,245,249,0.96) 50%, rgba(255,255,255,0.92) 75%);
    background-size: 200% 100%;
    animation: swShimmer 1.4s infinite linear;
    border-radius: 10px;
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.14);
}

/* ==========================================================================
   Table Column Polish: Compact Products Image/Action & Right-Aligned Totals
   ========================================================================== */

#product_table th:nth-child(2),
#product_table td:nth-child(2) {
    width: 60px !important;
    min-width: 60px;
    max-width: 72px;
    text-align: center !important;
    vertical-align: middle;
}

#product_table td:nth-child(2) img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    display: inline-block;
    border: 1px solid #e2e8f0;
}

#product_table th:nth-child(3),
#product_table td:nth-child(3) {
    width: 1% !important;
    white-space: nowrap !important;
    vertical-align: middle;
}

/* Right-align numeric/currency/totals columns across Sells, List POS & all Reports */
table.dataTable td:has(.display_currency),
table.dataTable td:has(.final-total),
table.dataTable td:has(.total-paid),
table.dataTable td:has(.payment_due),
table.dataTable td:has(.sell_return_due),
table.dataTable td:has(.total-tax),
table.dataTable td:has(.total_before_tax),
table.dataTable td:has(.total-discount),
table.dataTable td:has(.invoice-profit),
table.table td:has(.display_currency),
table.dataTable td.text-right,
table.dataTable th.text-right,
table.table td.text-right,
table.table th.text-right,
tr.footer-total td[class*="footer_"] {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* Keep footer status/method counts compact so scrollFoot aligns cleanly */
tr.footer-total td.footer_payment_status_count,
tr.footer-total td.payment_method_count,
tr.footer-total td.service_type_count {
    text-align: left !important;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.45;
}

/* Respect user reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
    .content-wrapper > .content,
    section.content,
    .ppe-kpi-card,
    .ppe-chart-card,
    .ppe-mlist-card,
    .box,
    .info-box,
    .small-box,
    .open > .dropdown-menu,
    .dataTables_wrapper .dataTables_processing {
        animation: none !important;
        transition: none !important;
        transform: none !important;
    }

    .ppe-kpi-card:hover,
    .ppe-chart-card:hover,
    .ppe-mlist-card:hover,
    .info-box:hover,
    .small-box:hover,
    .ppe-mlist-item:hover,
    .btn:active,
    .tw-dw-btn:active,
    .ppe-dash-pill-btn:active,
    .ppe-period-btn:active {
        transform: none !important;
    }
}
