/**
 * Live Orders operations board.
 *
 * @since 3.3
 */

.rp-live-orders-wrap {
    margin-top: 12px;
}

.rp-live-orders {
    --rp-live-orange: #ff5a1f;
    --rp-live-orange-dark: #d7440f;
    --rp-live-navy: #111827;
    --rp-live-muted: #64748b;
    --rp-live-border: #e2e8f0;
    --rp-live-soft: #f8fafc;
    --rp-live-success: #15803d;
    --rp-live-danger: #b91c1c;
    margin-top: 16px;
}

/* Toolbar */

.rp-live-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid var(--rp-live-border);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    margin-bottom: 12px;
}

.rp-live-toolbar-left,
.rp-live-toolbar-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rp-live-toolbar-right .button {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 6px 13px;
    border-color: #cbd5e1;
    border-radius: 9px;
    background: #fff;
    color: var(--rp-live-navy);
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
    box-shadow: none;
}

.rp-live-toolbar-right .button:hover,
.rp-live-toolbar-right .button:focus {
    border-color: #94a3b8;
    background: #f8fafc;
    color: var(--rp-live-navy);
    box-shadow: none;
}

.rp-live-toolbar-right .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.rp-live-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    background: #f0fdf4;
    color: #166534;
    font-size: 12px;
    font-weight: 700;
}

.rp-live-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18);
    animation: rp-live-pulse 2s ease-in-out infinite;
}

@keyframes rp-live-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }
    50%      { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.05); }
}

.rp-live-status-text {
    color: var(--rp-live-muted);
    font-size: 12px;
    font-weight: 500;
}

.rp-live-status-text.is-stale {
    color: #92400e;
    font-weight: 700;
}

.rp-live-refresh.is-busy .dashicons,
.rp-live-refresh.is-busy::after {
    animation: rp-live-spin 0.8s linear infinite;
}

.rp-live-refresh.is-busy::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid #cbd5e1;
    border-top-color: #2271b1;
    border-radius: 50%;
}

@keyframes rp-live-spin {
    to { transform: rotate(360deg); }
}

.rp-live-sound-toggle.is-disabled {
    opacity: 0.75;
}

/* KPI strip */

.rp-live-kpis {
    margin-bottom: 22px;
}

.rp-live-kpi {
    display: grid;
    grid-template-columns: 50px 1fr;
    grid-template-areas: 'icon label' 'icon count';
    align-items: center;
    gap: 1px 14px;
    min-height: 88px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--rp-live-border);
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.035);
}

.rp-live-kpi .dashicons {
    grid-area: icon;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: #eff6ff;
    color: #2563eb;
    font-size: 24px;
    line-height: 48px;
}

.rp-live-kpi-label {
    grid-area: label;
    color: var(--rp-live-navy);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.25;
    text-transform: none;
}

.rp-live-kpi strong,
.rp-live-kpi-count {
    grid-area: count;
    color: var(--rp-live-navy);
    font-size: 27px;
    font-weight: 800;
    line-height: 1;
}

.rp-live-kpi-accepted .dashicons {
    background: #fff7ed;
    color: #f97316;
}

.rp-live-kpi-preparing .dashicons {
    background: #eff6ff;
    color: #2563eb;
}

.rp-live-kpi-ready .dashicons {
    background: #ecfdf5;
    color: #16a34a;
}

.rp-live-kpi-out .dashicons {
    background: #f5f3ff;
    color: #7c3aed;
}

.rp-live-kpi-late .dashicons {
    background: #fef2f2;
    color: var(--rp-live-danger);
}

/* Filters */

.rp-live-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
    padding: 14px;
    background: #fff;
    border: 1px solid var(--rp-live-border);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.rp-live-service-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rp-live-filter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 18px;
    border: 1px solid var(--rp-live-border);
    border-radius: 7px;
    background: #fff;
    color: var(--rp-live-navy);
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    line-height: 20px;
    box-shadow: none;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.rp-live-filter-chip .rp-type-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.rp-live-filter-chip .rp-type-icon-truck {
    width: 18px;
    height: 14px;
    flex-basis: 18px;
}

.rp-live-filter-chip:hover,
.rp-live-filter-chip:focus {
    color: var(--rp-live-orange-dark);
    border-color: #fed7aa;
    background: #fff7ed;
    box-shadow: none;
    outline: none;
}

.rp-live-filter-chip.is-active {
    color: var(--rp-live-orange);
    border-color: var(--rp-live-orange);
    background: #fff;
    box-shadow: 0 0 0 1px rgba(255, 90, 31, 0.08);
}

.rp-live-search {
    position: relative;
    display: block;
    flex: 0 1 520px;
    min-width: min(460px, 100%);
    margin-left: auto;
}

.rp-live-search .dashicons {
    position: absolute;
    top: 50%;
    right: 16px;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    color: #64748b;
    font-size: 18px;
    pointer-events: none;
}

.rp-live-search-input {
    width: 100%;
    min-height: 40px;
    padding: 8px 44px 8px 18px !important;
    border: 1px solid var(--rp-live-border) !important;
    border-radius: 7px !important;
    background: #fff !important;
    color: var(--rp-live-navy) !important;
    font-size: 13px !important;
    box-shadow: none !important;
}

.rp-live-search-input:focus {
    border-color: #fb923c !important;
    box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.18) !important;
}

/* Board */

.rp-live-kanban {
    gap: 14px;
    align-items: start;
    overflow-x: auto;
    padding-bottom: 6px;
}

.rp-live-column {
    min-width: 220px;
    min-height: 300px;
    padding: 10px;
    background: #f8fafc;
    border: 1px solid var(--rp-live-border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
}

.rp-live-column-tone-warning { border-top: 4px solid #f97316; }
.rp-live-column-tone-brand   { border-top: 4px solid var(--rp-live-orange); }
.rp-live-column-tone-info    { border-top: 4px solid #2271b1; }
.rp-live-column-tone-success { border-top: 4px solid #16a34a; }
.rp-live-column-tone-muted   { border-top: 4px solid #64748b; }

.rp-live-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
}

.rp-live-column-title {
    margin: 0;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.rp-live-column-count {
    min-width: 24px;
    height: 22px;
    padding: 0 7px;
    background: #fff;
    border: 1px solid var(--rp-live-border);
    border-radius: 999px;
    color: #475569;
    font-size: 11px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

.rp-live-column-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
    min-height: 120px;
}

.rp-live-column-empty {
    padding: 28px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: rgba(255,255,255,0.7);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.rp-live-column-empty[hidden] { display: none; }

/* Cards */

.rp-live-card {
    padding: 12px;
    background: #fff;
    border: 1px solid var(--rp-live-border);
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease, background-color 0.6s ease;
}

.rp-live-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
    transform: translateY(-1px);
}

.rp-live-card.is-filtered-out {
    display: none;
}

.rp-live-card.ui-sortable-helper {
    cursor: grabbing;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
    transform: rotate(1deg);
}

.rp-live-card.is-new {
    border-color: #16a34a;
    background-color: #f0fdf4;
    animation: rp-live-card-slide-in 0.4s ease-out;
}

@keyframes rp-live-card-slide-in {
    0%   { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.rp-live-card.is-leaving {
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.rp-live-card.is-saving { opacity: 0.58; }
.rp-live-card.is-saved { background-color: #f0fdf4; }
.rp-live-card.is-error { background-color: #fef2f2; border-color: #fecaca; }

.rp-live-card-placeholder {
    min-height: 110px;
    border: 2px dashed #fb923c;
    border-radius: 14px;
    background: rgba(255, 90, 31, 0.08);
}

.rp-live-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.rp-live-card-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
}

.rp-live-card-number {
    color: var(--rp-live-navy);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.rp-live-card-number:hover {
    color: var(--rp-live-orange-dark);
}

.rp-live-card-time {
    flex-shrink: 0;
    color: #94a3b8;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rp-live-card-customer {
    margin-bottom: 2px;
    color: var(--rp-live-navy);
    font-size: 14px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rp-live-card-phone {
    margin-bottom: 8px;
    color: var(--rp-live-muted);
    font-size: 12px;
    font-weight: 600;
}

.rp-live-card-service-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    margin: 0 0 10px;
    color: #475569;
    font-size: 12px;
}

.rp-live-card-service-time .dashicons {
    width: 14px;
    height: 14px;
    color: #94a3b8;
    font-size: 14px;
}

.rp-live-card-service-label,
.rp-live-card-service-meta {
    font-weight: 800;
}

.rp-live-card-service-time--urgent .rp-live-card-service-meta,
.rp-live-card-service-time--urgent .rp-live-card-service-label { color: #c2410c; }
.rp-live-card-service-time--late .rp-live-card-service-meta,
.rp-live-card-service-time--late .rp-live-card-service-label { color: var(--rp-live-danger); }
.rp-live-card-service-time--success .rp-live-card-service-meta,
.rp-live-card-service-time--success .rp-live-card-service-label { color: var(--rp-live-success); }
.rp-live-card-service-time--info .rp-live-card-service-meta,
.rp-live-card-service-time--info .rp-live-card-service-label { color: #0369a1; }

.rp-live-card-meta {
    display: grid;
    gap: 3px;
    margin-bottom: 10px;
    color: #475569;
    font-size: 12px;
    line-height: 1.35;
}

.rp-live-card-meta strong {
    color: var(--rp-live-navy);
    font-size: 13px;
}

.rp-live-card-payment {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
    color: var(--rp-live-muted);
    font-size: 12px;
    font-weight: 700;
}

.rp-live-card-payment strong {
    color: var(--rp-live-navy);
    font-size: 14px;
    white-space: nowrap;
}

.rp-live-card-footer {
    display: flex;
    align-items: center;
    justify-content: stretch;
}

.rp-live-card-action.button {
    width: 100%;
    min-height: 34px;
    border-radius: 9px;
    box-shadow: none;
    font-size: 12px;
    font-weight: 800;
    text-align: center;
}

.rp-live-card-action.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: var(--rp-live-orange);
    background: var(--rp-live-orange);
    color: #fff;
}

.rp-live-card-action.button:hover,
.rp-live-card-action.button:focus {
    border-color: var(--rp-live-orange-dark);
    background: var(--rp-live-orange-dark);
    color: #fff;
}

.rp-live-card-action-success.button {
    border-color: #16a34a;
    background: #16a34a;
}

.rp-live-card-action-success.button:hover,
.rp-live-card-action-success.button:focus {
    border-color: #15803d;
    background: #15803d;
}

.rp-live-card-quickview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 7px;
    color: #64748b;
    text-decoration: none;
}

.rp-live-card-quickview:hover,
.rp-live-card-quickview:focus {
    background: #f1f5f9;
    color: #2271b1;
    box-shadow: none;
    outline: none;
}

.rp-live-card-quickview .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.rp-live-card .rp-type-cell {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 22px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
}

.rp-live-card .rp-type-cell .rp-type-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.rp-live-card .rp-type-cell .rp-type-icon-truck {
    width: 17px;
    height: 13px;
    flex-basis: 17px;
}

.rp-live-card .rp-type-cell.badge-delivery { background: #ecf7ee; color: #1d3a1f; }
.rp-live-card .rp-type-cell.badge-pickup { background: #fff4e0; color: #7a4a00; }
.rp-live-card .rp-type-cell.badge-dinein,
.rp-live-card .rp-type-cell.badge-dine-in { background: #f1ebfa; color: #4a2b76; }

/* Sound unlock overlay */

.rp-live-sound-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    cursor: pointer;
}

.rp-live-sound-overlay[hidden] { display: none; }

.rp-live-sound-overlay-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
    color: var(--rp-live-navy);
    font-size: 14px;
    font-weight: 700;
}

.rp-live-sound-overlay-inner .dashicons {
    width: 20px;
    height: 20px;
    color: var(--rp-live-orange);
    font-size: 20px;
}

@media (max-width: 960px) {
    .rp-live-filters {
        align-items: stretch;
        flex-direction: column;
    }

    .rp-live-service-filter {
        overflow-x: auto;
        border-radius: 12px;
    }

    .rp-live-search {
        min-width: 100%;
    }
}
