/* ============================================
   Shop Floor — Tablet Touch Interface
   ============================================ */

.shop-floor-page {
    --sf-bg: #f3f4f6;
    --sf-card-bg: #ffffff;
    --sf-text: #111827;
    --sf-text-muted: #6b7280;
    --sf-border: #e5e7eb;
    --sf-primary: #2563eb;
    --sf-success: #16a34a;
    --sf-warning: #ca8a04;
    --sf-danger: #dc2626;
    --sf-info: #0891b2;

    background: var(--sf-bg);
    min-height: 100vh;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* Touch-optimized tap targets */
.touch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    min-width: 48px;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    touch-action: manipulation;
}

.touch-btn:active {
    transform: scale(0.96);
}

.touch-btn-primary {
    background: var(--sf-primary);
    color: #fff;
}

.touch-btn-success {
    background: var(--sf-success);
    color: #fff;
}

.touch-btn-warning {
    background: var(--sf-warning);
    color: #fff;
}

.touch-btn-danger {
    background: var(--sf-danger);
    color: #fff;
}

.touch-btn-outline {
    background: transparent;
    border: 2px solid var(--sf-border);
    color: var(--sf-text);
}

.touch-btn-sm {
    min-height: 44px;
    padding: 8px 16px;
    font-size: 14px;
}

/* Work Order Card */
.wo-card {
    background: var(--sf-card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.wo-card:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wo-card-image {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    background: var(--sf-bg);
}

.wo-card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--sf-text);
    line-height: 1.3;
}

.wo-card-meta {
    font-size: 14px;
    color: var(--sf-text-muted);
}

.wo-card-qty {
    font-size: 24px;
    font-weight: 800;
    color: var(--sf-primary);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-badge-waiting {
    background: #f3f4f6;
    color: #6b7280;
}

.status-badge-ready {
    background: #dbeafe;
    color: #1d4ed8;
}

.status-badge-in_progress {
    background: #fef3c7;
    color: #b45309;
}

.status-badge-done {
    background: #dcfce7;
    color: #15803d;
}

.status-badge-cancelled {
    background: #fee2e2;
    color: #b91c1c;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.4s ease;
    background: var(--sf-primary);
}

.progress-bar-fill.done {
    background: var(--sf-success);
}

/* Detail Panel */
.detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 40;
}

.detail-panel {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--sf-bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
    .detail-panel {
        left: auto;
        right: 0;
        width: 640px;
        max-width: 100vw;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    }
}

.detail-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--sf-card-bg);
    border-bottom: 1px solid var(--sf-border);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.detail-section {
    background: var(--sf-card-bg);
    border-radius: 14px;
    padding: 20px;
    margin: 12px 16px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.detail-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--sf-text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Component Row */
.component-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--sf-border);
    gap: 12px;
}

.component-row:last-child {
    border-bottom: none;
}

.component-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--sf-text);
    flex: 1;
}

.component-qty {
    font-size: 15px;
    font-weight: 500;
    color: var(--sf-text-muted);
    white-space: nowrap;
}

.component-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.component-status.consumed {
    background: var(--sf-success);
    color: #fff;
}

.component-status.pending {
    background: var(--sf-border);
    color: var(--sf-text-muted);
}

/* Quality Check Row */
.qc-row {
    padding: 16px 0;
    border-bottom: 1px solid var(--sf-border);
}

.qc-row:last-child {
    border-bottom: none;
}

.qc-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--sf-text);
    margin-bottom: 4px;
}

.qc-target {
    font-size: 14px;
    color: var(--sf-text-muted);
    margin-bottom: 12px;
}

.qc-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 2px solid var(--sf-border);
    border-radius: 10px;
    font-size: 16px;
    background: var(--sf-card-bg);
    -webkit-appearance: none;
    appearance: none;
}

.qc-input:focus {
    outline: none;
    border-color: var(--sf-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Scrap Form */
.scrap-form {
    background: var(--sf-warning);
    border-radius: 14px;
    padding: 20px;
    margin: 12px 16px;
}

.scrap-form input,
.scrap-form textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 16px;
    border: 2px solid #fde68a;
    border-radius: 10px;
    font-size: 16px;
    background: #fff;
    -webkit-appearance: none;
    appearance: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wo-card {
    animation: fadeIn 0.3s ease both;
}

.wo-card:nth-child(1) { animation-delay: 0.02s; }
.wo-card:nth-child(2) { animation-delay: 0.04s; }
.wo-card:nth-child(3) { animation-delay: 0.06s; }
.wo-card:nth-child(4) { animation-delay: 0.08s; }
.wo-card:nth-child(5) { animation-delay: 0.10s; }
.wo-card:nth-child(6) { animation-delay: 0.12s; }
.wo-card:nth-child(7) { animation-delay: 0.14s; }
.wo-card:nth-child(8) { animation-delay: 0.16s; }
.wo-card:nth-child(9) { animation-delay: 0.18s; }
.wo-card:nth-child(10) { animation-delay: 0.20s; }

/* Work center selector */
.wc-select {
    width: 100%;
    min-height: 52px;
    padding: 12px 20px;
    border: 2px solid var(--sf-border);
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    background: var(--sf-card-bg);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
}

.wc-select:focus {
    outline: none;
    border-color: var(--sf-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Scrollbar for detail panel */
.detail-panel::-webkit-scrollbar {
    width: 4px;
}

.detail-panel::-webkit-scrollbar-track {
    background: transparent;
}

.detail-panel::-webkit-scrollbar-thumb {
    background: var(--sf-border);
    border-radius: 4px;
}

/* Print */
@media print {
    .shop-floor-page {
        background: #fff;
    }
    .touch-btn,
    .detail-overlay {
        display: none !important;
    }
}
