/* ═══════════════════════════════════════════════════════
 * Pending-Order Tracker — Bottom Bar Widget (v7.0)
 * Global Search Loading Styles
 * ═══════════════════════════════════════════════════════ */

#wc-tracker-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 99990;
    display: none;
    flex-direction: column;
    width: 300px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: none;
    border-left: none;
    border-radius: 0 12px 0 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    user-select: none;
    overflow: hidden;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
}

#wc-tracker-bar.visible {
    display: flex;
    animation: wc-slide-up 0.35s ease-out;
}

@keyframes wc-slide-up {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#wc-tracker-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
}

#wc-tracker-header .wc-header-title {
    flex: 1;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Header Dashboard (Real-time Processing Counts) ── */
.wc-header-dashboard {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wc-hdr-group {
    display: flex;
    align-items: center;
    gap: 3px;
}

.wc-hdr-sticker {
    width: 14px;
    height: 14px;
    background: #ef4444;
    color: #fff;
    font-size: 7px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    clip-path: polygon(50% 0%, 58% 12%, 75% 6%, 78% 22%, 94% 25%, 88% 41%, 100% 50%, 88% 59%, 94% 75%, 78% 78%, 75% 94%, 58% 88%, 50% 100%, 42% 88%, 25% 94%, 22% 78%, 6% 75%, 12% 59%, 0% 50%, 12% 41%, 6% 25%, 22% 22%, 25% 6%, 42% 12%);
}

.wc-hdr-pos-count,
.wc-hdr-web-count {
    font-size: 12px;
    font-weight: 700;
    color: #fff;
}

.wc-hdr-total {
    margin-left: 4px;
    padding-left: 8px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.wc-hdr-total-label {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wc-hdr-total-count {
    font-size: 13px;
    font-weight: 800;
    color: #22c55e;
    /* Green for paid orders */
}

#wc-tracker-header .wc-header-badge {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #22c55e;
    /* Green for paid orders */
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

#wc-tracker-header .wc-header-badge.all-paid {
    background: #22c55e;
}

#wc-tracker-header .wc-header-chevron {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.3);
    transition: transform 0.3s ease;
}

#wc-tracker-bar.collapsed .wc-header-chevron {
    transform: rotate(180deg);
}

#wc-tracker-body {
    max-height: 480px;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

#wc-tracker-bar.collapsed #wc-tracker-body {
    max-height: 0;
}

/* ── Search Bar ───────────────────────────────────────── */
#wc-tracker-search-container {
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
}

#wc-tracker-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 10px;
    color: #fff;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#wc-tracker-search:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ── Filter Tabs ──────────────────────────────────────── */
#wc-tracker-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.wc-tab {
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.wc-tab:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.04);
}

.wc-tab.active {
    color: #fff;
    border-bottom-color: #3b82f6;
    background: rgba(59, 130, 246, 0.08);
}

/* Global Search Indicator */
#wc-tracker-search-container.is-searching::after {
    content: "";
    position: absolute;
    right: 22px;
    top: 19px;
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wc-spin 0.6s linear infinite;
}

/* ── Scrollable list area ────────────────────────────── */
#wc-tracker-visible {
    max-height: 380px;
    overflow-y: auto;
}

#wc-tracker-visible::-webkit-scrollbar {
    width: 8px;
}

#wc-tracker-visible::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
}

/* ── Row Wrapper ────────────────────────────────────── */
.wc-tracker-row-wrapper {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.wc-tracker-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.wc-tracker-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.wc-row-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Origin Stickers (Jagged Red Shape) ─────────────── */
.wc-origin-sticker {
    width: 17px;
    height: 17px;
    background: #ef4444;
    /* Pure Red */
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    clip-path: polygon(50% 0%, 58% 12%, 75% 6%, 78% 22%, 94% 25%, 88% 41%, 100% 50%, 88% 59%, 94% 75%, 78% 78%, 75% 94%, 58% 88%, 50% 100%, 42% 88%, 25% 94%, 22% 78%, 6% 75%, 12% 59%, 0% 50%, 12% 41%, 6% 25%, 22% 22%, 25% 6%, 42% 12%);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.wc-row-dot.pending {
    background: #f59e0b;
    box-shadow: 0 0 6px #f59e0b44;
    animation: wc-pulse 2s infinite;
}

.wc-row-dot.processing {
    background: #0ea5e9;
    /* Sky Blue */
    box-shadow: 0 0 6px #0ea5e944;
}

.wc-row-dot.completed {
    background: #6d28d9;
    /* Deep Purple */
    box-shadow: 0 0 6px #6d28d944;
}

.wc-row-dot.on-hold {
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e44;
}

.wc-row-dot.cancelled {
    background: #ef4444;
}

@keyframes wc-pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

.wc-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.wc-row-num {
    font-size: 13px;
    font-weight: 700;
    color: #fff;
}

.wc-row-meta {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
}

.wc-row-label {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
}

.wc-row-label.pending {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.wc-row-label.processing {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
}

.wc-row-label.completed {
    background: rgba(109, 40, 217, 0.1);
    color: #6d28d9;
}

.wc-row-label.cancelled {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.wc-row-label.on-hold {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.wc-row-chevron-icon {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.15);
    transition: transform 0.25s ease;
}

.expanded .wc-row-chevron-icon {
    transform: rotate(180deg);
}

/* ── Details Area ───────────────────────────────────── */
.wc-row-details {
    max-height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.15);
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.expanded .wc-row-details {
    max-height: 140px;
}

.wc-details-content {
    padding: 10px 14px 14px 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wc-detail-item {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

.wc-detail-item strong {
    color: rgba(255, 255, 255, 0.8);
}

.wc-action-btn {
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.wc-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.wc-action-btn:active {
    transform: translateY(0);
}

.wc-action-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.wc-recu-btn {
    background: #3b82f6;
}

.wc-recu-btn:hover {
    background: #2563eb;
}

.wc-pret-btn {
    background: #6d28d9;
}

.wc-pret-btn:hover {
    background: #5b21b6;
}

.wc-row-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.wc-print-btn {
    background: #fff;
    color: #22c55e;
    border: 1px solid #22c55e;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.wc-print-btn:hover {
    background: #f0fff4;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.15);
}

.wc-print-btn:active {
    transform: translateY(0);
}

.wc-print-btn svg {
    stroke: #22c55e;
}

.wc-spinner {
    display: inline-block;
    width: 8px;
    height: 8px;
    border: 2px solid rgba(245, 158, 11, 0.2);
    border-top-color: #f59e0b;
    border-radius: 50%;
    margin-right: 5px;
    animation: wc-spin 1s linear infinite;
}

@keyframes wc-spin {
    to {
        transform: rotate(360deg);
    }
}

.wc-empty-state {
    padding: 20px 14px;
    text-align: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 12px;
}

/* ═══════════════════════════════════════════════════════
 * Barcode Scanner — Toggle Button & Modal Overlay
 * ═══════════════════════════════════════════════════════ */

.wc-scan-toggle-btn {
    flex-shrink: 0;
    width: 42px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.wc-scan-toggle-btn:hover {
    background: rgba(34, 197, 94, 0.25);
    border-color: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
    transform: scale(1.05);
}

.wc-scan-toggle-btn:active {
    transform: scale(0.95);
}

/* Overlay */
#wc-scan-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

#wc-scan-overlay.active {
    display: flex;
    animation: wc-scan-fade-in 0.2s ease;
}

@keyframes wc-scan-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scan Card */
.wc-scan-card {
    background: #1a1a2e;
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 16px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(34, 197, 94, 0.1);
    overflow: hidden;
    animation: wc-scan-card-pop 0.25s ease;
}

@keyframes wc-scan-card-pop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.wc-scan-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: rgba(34, 197, 94, 0.06);
    border-bottom: 1px solid rgba(34, 197, 94, 0.1);
}

.wc-scan-header span {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
    color: #22c55e;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wc-scan-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wc-scan-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.wc-scan-body {
    padding: 20px;
}

#wc-scan-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    padding: 14px 16px;
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-family: 'Roboto Mono', 'Consolas', monospace;
}

#wc-scan-input:focus {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.06);
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.15);
}

#wc-scan-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.wc-scan-hint {
    margin-top: 10px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.wc-scan-hint strong {
    color: #22c55e;
}

/* Scan Log */
.wc-scan-log {
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.wc-scan-entry {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    animation: wc-scan-entry-in 0.2s ease;
}

@keyframes wc-scan-entry-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.wc-scan-entry.success { color: #22c55e; }
.wc-scan-entry.error   { color: #ef4444; }
.wc-scan-entry.pending  { color: #f59e0b; }