/* Shopify Orders page refinements based on the reference workflow. */

/* Keep the Shopify table panel free of a persistent transform so the fixed
   bulk action bar is truly positioned against the browser viewport. */
.content > .shopify-orders-panel {
    animation: none !important;
    transform: none !important;
}

.content > .tracking-orders-panel {
    animation: none !important;
    transform: none !important;
}

.shopify-summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: stretch;
    gap: 14px;
}

.shopify-stat-card {
    display: grid !important;
    grid-template-columns: 52px minmax(0, 1fr);
    align-items: center;
    min-width: 0;
    min-height: 96px;
    padding: 16px 14px;
    gap: 12px;
    border-radius: 12px;
    overflow: hidden;
}

.shopify-stat-card::before {
    display: none;
}

.shopify-stat-card > div {
    display: grid;
    align-content: center;
    min-width: 0;
    max-width: 100%;
    gap: 4px;
    overflow: hidden;
}

.shopify-stat-card strong {
    min-width: 0;
    margin: 0;
    font-size: clamp(24px, 2vw, 28px);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.shopify-stat-card > div > span {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    line-height: 1.2;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: normal;
}

.shopify-stat-icon {
    display: grid;
    place-items: center;
    flex: 0 0 52px;
    width: 52px;
    height: 52px;
    border-radius: 12px;
}

/* nav-icon normally draws its own small background box. Inside a Shopify stat
   icon it should inherit the outer colored tile and sit exactly in its center. */
.shopify-stat-icon .nav-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0;
    color: inherit;
    background: transparent !important;
}

.shopify-stat-icon .nav-icon svg {
    display: block;
    width: 24px;
    height: 24px;
}

/* Use the Dreams Courier brand red for the count badge on the selected status tab. */
.shopify-orders-panel .status-tab.active > span {
    color: #fff !important;
    background: var(--dream-red) !important;
}

/* Generic form controls are full-width; table selection controls stay compact. */
.shopify-orders-table th:first-child,
.shopify-orders-table td:first-child {
    width: 48px;
    min-width: 48px;
    text-align: center;
}

.shopify-orders-table input[type="checkbox"] {
    appearance: auto;
    display: inline-block;
    width: 18px;
    min-width: 18px;
    max-width: 18px;
    height: 18px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-radius: 4px;
    box-shadow: none;
    vertical-align: middle;
    accent-color: var(--dream-red);
    cursor: pointer;
}

.shopify-orders-table input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

/* Reference-style viewport-fixed selection action. */
#shopify-bulk-bar,
#tracking-loadsheet-bar {
    position: fixed !important;
    z-index: 100;
    left: calc(50% + 114px) !important;
    right: auto !important;
    bottom: 24px !important;
    display: flex;
    align-items: center;
    gap: 14px;
    width: max-content;
    max-width: calc(100vw - 276px);
    margin: 0 !important;
    padding: 10px 12px 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    color: #fff;
    background: #111827;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28);
    transform: translateX(-50%) !important;
    transition: left 180ms ease;
}

#shopify-bulk-bar[hidden],
#tracking-loadsheet-bar[hidden] {
    display: none !important;
}

.app-shell.sidebar-collapsed #shopify-bulk-bar,
.app-shell.sidebar-collapsed #tracking-loadsheet-bar {
    left: calc(50% + 34px) !important;
}

#shopify-bulk-bar .bulk-selection-summary,
#tracking-loadsheet-bar .bulk-selection-summary {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding-right: 14px;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
}

#shopify-bulk-bar #selected-shopify-count,
#tracking-loadsheet-bar #selected-tracking-count {
    font-size: 20px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

#shopify-bulk-bar .btn,
#tracking-loadsheet-bar .btn {
    min-height: 40px;
    padding-inline: 18px;
    border-radius: 9px;
    background: var(--dream-red);
    box-shadow: none;
}

#shopify-bulk-bar .btn:hover,
#tracking-loadsheet-bar .btn:hover {
    background: var(--dream-red-dark);
}

#shopify-bulk-bar .btn.secondary,
#tracking-loadsheet-bar .btn.secondary {
    color: #fff;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.28);
}

#shopify-bulk-bar .btn.secondary:hover,
#tracking-loadsheet-bar .btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 1180px) {
    .shopify-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .shopify-stat-card {
        min-height: 88px;
    }
}

@media (max-width: 980px) {
    #shopify-bulk-bar,
    #tracking-loadsheet-bar,
    .app-shell.sidebar-collapsed #shopify-bulk-bar,
    .app-shell.sidebar-collapsed #tracking-loadsheet-bar {
        right: 12px !important;
        left: 12px !important;
        bottom: 12px !important;
        width: auto;
        max-width: none;
        justify-content: center;
        flex-wrap: wrap;
        transform: none !important;
    }
}

@media (max-width: 680px) {
    .shopify-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .shopify-stat-card {
        grid-template-columns: 46px minmax(0, 1fr);
        min-height: 82px;
        padding: 12px;
        gap: 10px;
    }

    .shopify-stat-icon {
        flex-basis: 46px;
        width: 46px;
        height: 46px;
    }

    .shopify-stat-card strong {
        font-size: 24px;
    }

    .shopify-stat-card > div > span {
        font-size: 10px;
    }

    #shopify-bulk-bar .bulk-selection-summary,
    #tracking-loadsheet-bar .bulk-selection-summary {
        width: 100%;
        justify-content: center;
        padding-right: 0;
        padding-bottom: 8px;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    }
}

@media (max-width: 420px) {
    .shopify-summary-grid {
        grid-template-columns: 1fr;
    }

    .shopify-stat-card {
        grid-template-columns: 52px minmax(0, 1fr);
    }

    .shopify-stat-card > div > span {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #shopify-bulk-bar,
    #tracking-loadsheet-bar {
        transition: none;
    }
}
