/* ===== QR CODES PAGE STYLES ===== */

/* --- Alert (shared component) --- */
.alloc-alert {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--dash-radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.838rem;
    font-weight: 500;
    animation: dash-fadeUp 0.3s ease-out;
    position: relative;
}

.alloc-alert.show {
    display: flex;
}

.alloc-alert-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.alloc-alert-icon svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.alloc-alert-text {
    flex: 1;
}

.alloc-alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
}

.alloc-alert-close:hover {
    opacity: 1;
}

.alloc-alert-success {
    background: var(--dash-success-light);
    color: var(--dash-success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alloc-alert-error {
    background: var(--dash-danger-light);
    color: var(--dash-danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alloc-alert-warning {
    background: var(--dash-warning-light);
    color: var(--dash-warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.alloc-alert-info {
    background: var(--dash-info-light);
    color: var(--dash-info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* --- Filter Bar --- */
.qr-filter-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: flex-end;
}

.qr-filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.qr-filter-label {
    font-size: 0.688rem;
    font-weight: 700;
    color: var(--dash-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.qr-filter-label svg {
    width: 13px;
    height: 13px;
    color: var(--dash-primary);
    opacity: 0.7;
}

.qr-filter-select,
.qr-filter-input {
    background: var(--dash-surface-2);
    border: 1.5px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    color: var(--dash-text);
    font-size: 0.813rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.625rem 0.875rem;
    outline: none;
    transition: var(--dash-transition);
    width: 100%;
}

.qr-filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
}

.qr-filter-select:focus,
.qr-filter-input:focus {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
}

.qr-filter-select option {
    background: var(--dash-surface);
    color: var(--dash-text);
}

[data-theme="light"] .qr-filter-select option {
    background: #fff;
    color: #0f172a;
}

/* Load Button */
.qr-load-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.5rem;
    background: linear-gradient(135deg, var(--dash-primary), var(--dash-violet));
    color: white;
    border: none;
    border-radius: var(--dash-radius-sm);
    font-size: 0.813rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--dash-transition);
    box-shadow: 0 4px 16px var(--dash-primary-glow);
    white-space: nowrap;
    min-height: 42px;
}

.qr-load-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--dash-primary-glow);
}

.qr-load-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.qr-load-btn svg {
    width: 16px;
    height: 16px;
}

.qr-load-btn.spinning svg {
    animation: sto-spin 0.8s linear infinite;
}

@keyframes sto-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --- Table Toolbar --- */
.qr-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.qr-toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.qr-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Stats pills */
.qr-stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.qr-stat-total {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.qr-stat-selected {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.qr-stat-pill svg {
    width: 13px;
    height: 13px;
}

/* Search field in toolbar */
.qr-search-wrap {
    position: relative;
}

.qr-search-wrap svg {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--dash-text-muted);
    pointer-events: none;
}

.qr-search-input {
    background: var(--dash-surface-2);
    border: 1.5px solid var(--dash-border);
    border-radius: var(--dash-radius-sm);
    color: var(--dash-text);
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.5rem 0.75rem 0.5rem 2rem;
    outline: none;
    width: 220px;
    transition: var(--dash-transition);
}

.qr-search-input:focus {
    border-color: var(--dash-primary);
    box-shadow: 0 0 0 3px var(--dash-primary-light);
    width: 280px;
}

/* Print Button */
.qr-print-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: linear-gradient(135deg, var(--dash-success), #16a34a);
    color: white;
    border: none;
    border-radius: var(--dash-radius-sm);
    font-size: 0.813rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--dash-transition);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.25);
}

.qr-print-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(34, 197, 94, 0.35);
}

.qr-print-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.qr-print-btn svg {
    width: 16px;
    height: 16px;
}

/* --- Table Styles --- */
.qr-table-wrap {
    overflow-x: auto;
    border-radius: var(--dash-radius);
    border: 1px solid var(--dash-border);
}

.qr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.813rem;
}

.qr-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.qr-table th {
    background: var(--dash-surface-3);
    color: var(--dash-text-muted);
    font-size: 0.688rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.875rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--dash-border);
    white-space: nowrap;
}

.qr-table th:first-child {
    width: 48px;
    text-align: center;
}

.qr-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--dash-border);
    vertical-align: middle;
}

.qr-table tbody tr {
    transition: background 0.15s ease;
}

.qr-table tbody tr:hover {
    background: var(--dash-primary-light);
}

.qr-table tbody tr:last-child td {
    border-bottom: none;
}

/* --- Custom Checkbox --- */
.qr-checkbox-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.qr-checkbox-wrap input[type="checkbox"] {
    display: none;
}

.qr-checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--dash-border-hover);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--dash-transition);
    flex-shrink: 0;
}

.qr-checkbox-wrap input:checked+.qr-checkbox-custom {
    background: var(--dash-primary);
    border-color: var(--dash-primary);
}

.qr-checkbox-wrap input:checked+.qr-checkbox-custom::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) translateY(-1px);
}

.qr-checkbox-wrap input:indeterminate+.qr-checkbox-custom {
    background: var(--dash-primary);
    border-color: var(--dash-primary);
}

.qr-checkbox-wrap input:indeterminate+.qr-checkbox-custom::after {
    content: '';
    width: 8px;
    height: 2px;
    background: white;
    border-radius: 1px;
}

/* --- Cell Badges --- */
.qr-id-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 24px;
    padding: 0 8px;
    background: var(--dash-surface-3);
    color: var(--dash-text-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
}

.qr-vehicle-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--dash-cyan-light);
    color: var(--dash-cyan);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.qr-material-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.qr-mat-code {
    font-size: 0.813rem;
    font-weight: 700;
    color: var(--dash-text);
}

.qr-mat-desc {
    font-size: 0.688rem;
    color: var(--dash-text-muted);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-driver-cell {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.qr-driver-id {
    font-size: 0.813rem;
    font-weight: 700;
    color: var(--dash-text);
}

.qr-driver-name {
    font-size: 0.688rem;
    color: var(--dash-text-muted);
}

/* QR code value */
.qr-code-value {
    display: inline-block;
    font-family: 'Courier New', monospace;
    font-size: 0.688rem;
    font-weight: 600;
    background: var(--dash-primary-light);
    color: var(--dash-primary);
    padding: 4px 8px;
    border-radius: 6px;
    word-break: break-all;
    max-width: 200px;
}

/* --- Loading Overlay --- */
.qr-loading-overlay {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
}

.qr-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--dash-primary-light);
    border-top-color: var(--dash-primary);
    border-radius: 50%;
    animation: sto-spin 0.8s linear infinite;
}

.qr-loading-text {
    font-size: 0.813rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

/* --- Empty State --- */
.qr-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.qr-empty-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--dash-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.qr-empty-icon svg {
    width: 28px;
    height: 28px;
    color: var(--dash-text-muted);
}

.qr-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dash-text);
    margin-bottom: 0.375rem;
}

.qr-empty-desc {
    font-size: 0.813rem;
    color: var(--dash-text-muted);
    max-width: 400px;
    line-height: 1.6;
}

/* --- Section header --- */
.qr-section-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--dash-border);
}

.qr-section-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qr-section-icon svg {
    width: 18px;
    height: 18px;
}

.qr-section-icon.primary {
    background: var(--dash-primary-light);
    color: var(--dash-primary);
}

.qr-section-icon.success {
    background: var(--dash-success-light);
    color: var(--dash-success);
}

.qr-section-icon.info {
    background: var(--dash-info-light);
    color: var(--dash-info);
}

.qr-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dash-text);
}

.qr-section-subtitle {
    font-size: 0.75rem;
    color: var(--dash-text-muted);
    font-weight: 500;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .qr-filter-bar {
        grid-template-columns: 1fr;
    }

    .qr-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .qr-toolbar-left,
    .qr-toolbar-right {
        width: 100%;
        flex-wrap: wrap;
    }

    .qr-search-input {
        width: 100%;
    }

    .qr-search-input:focus {
        width: 100%;
    }

    .qr-table {
        font-size: 0.75rem;
    }

    .qr-table th,
    .qr-table td {
        padding: 0.625rem 0.5rem;
    }
}