/* =====================
   Production Order Styles
   ===================== */

.filters-card {
    background: #1f2937;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #2d3748;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem;
    border: 1px solid #2d3748;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #e5e7eb;
    background-color: #111827;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.order-card {
    background: #1f2937;
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid #2d3748;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.order-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: #3b82f6;
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #2d3748;
}

.order-id {
    font-size: 1.3rem;
    font-weight: 700;
    color: #e5e7eb;
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.pending {
    background: #fee2e2;
    color: #7f1d1d;
}

.status-badge.in-progress {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

/* Compact status dot for table rows to save space */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.04) inset;
    vertical-align: middle;
}

.status-dot.pending {
    background: #b91c1c; /* red */
}

.status-dot.in-progress {
    background: #d97706; /* amber */
}

.status-dot.completed {
    background: #059669; /* green */
}

.status-dot.overdue {
    background: #7f1d1d; /* dark red */
}

.order-content {
    flex-grow: 1;
    margin-bottom: 1.5rem;
}

.order-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f0f0f0;
}

.detail-label {
    font-size: 0.9rem;
    color: #999;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.detail-value {
    font-size: 0.95rem;
    color: #333;
    font-weight: 600;
}

.progress-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 10px;
    margin: 1rem 0 0.5rem 0;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a26812, #a26812);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.progress-fill.in-progress {
    background: linear-gradient(90deg, #ffc107, #ff9800);
}

.progress-fill.completed {
    background: linear-gradient(90deg, #28a745, #20c997);
}

.progress-text {
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
    margin: 0;
}

.order-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* =====================
   Modal Large (for Order Form)
   ===================== */

.modal-large {
    max-width: 600px;
}

/* =====================
   Form Layout & Sections
   ===================== */

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.section-header label {
    margin-bottom: 0;
    flex: 1;
}

.btn-icon {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1.5rem;
}

.btn-icon:hover {
    color: #2563eb;
    transform: scale(1.1);
}

/* =====================
   Products List
   ===================== */

.products-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.product-item {
    background: #111827;
    border: 1px solid #2d3748;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    transition: all 0.3s ease;
}

.product-item:hover {
    border-color: #3b82f6;
    background: #1a1f35;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 600;
    color: #e5e7eb;
    margin-bottom: 0.25rem;
    font-size: 0.95rem;
}

.product-details {
    display: grid;
    grid-template-columns: auto auto;
    gap: 1rem 2rem;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.product-detail {
    display: flex;
    flex-direction: column;
}

.product-detail-label {
    color: #9ca3af;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.product-detail-value {
    color: #e5e7eb;
}

.product-description {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    font-style: italic;
}

.product-label-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    display: inline-block;
    margin-top: 0.5rem;
}

.custom-fields-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.btn-remove:hover {
    color: #dc2626;
    transform: scale(1.2);
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #9ca3af;
    font-size: 0.9rem;
    background: #111827;
    border: 1px dashed #2d3748;
    border-radius: 6px;
}

/* =====================
   Checkbox Group
   ===================== */

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    padding: 0;
    cursor: pointer;
    accent-color: #3b82f6;
}

.checkbox-label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: 500;
    display: inline;
}

/* =====================
   Custom Fields Styles
   ===================== */

.custom-fields-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.custom-field-item {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    background: #111827;
    padding: 0.75rem;
    border: 1px solid #2d3748;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.custom-field-item:hover {
    border-color: #3b82f6;
    background: #1a1f35;
}

.custom-field-input-group {
    display: flex;
    gap: 0.5rem;
    flex: 1;
}

.custom-field-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #2d3748;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #e5e7eb;
    background-color: #0f172a;
}

.custom-field-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.custom-field-input::placeholder {
    color: #6b7280;
}

.custom-field-label {
    flex: 0 0 35%;
    min-width: 100px;
}

.custom-field-value {
    flex: 0 0 50%;
    min-width: 120px;
}

/* =====================
   Order Details View Modal
   ===================== */

.order-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.details-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #2d3748;
}

.details-row:last-of-type {
    border-bottom: none;
}

.details-col {
    display: flex;
    flex-direction: column;
}

.details-col label {
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.details-col p {
    color: #e5e7eb;
    font-size: 1rem;
    margin: 0;
}

.details-section {
    padding-top: 1rem;
}

.details-section label {
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.product-item {
    background: #111827;
    border: 1px solid #2d3748;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 600;
    color: #3b82f6;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.product-details {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
}

.product-detail {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
}

.product-detail-label {
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.product-detail-value {
    color: #e5e7eb;
    font-weight: 500;
}

.product-description {
    color: #9ca3af;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    line-height: 1.4;
}

.custom-fields-display {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.product-label-badge {
    background: #2d3748;
    color: #e5e7eb;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

.product-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.btn-remove:hover {
    color: #dc2626;
}

.btn-icon-action {
    background: none;
    border: none;
    color: #3b82f6;
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.btn-icon-action:hover {
    color: #60a5fa;
    transform: scale(1.1);
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-remove-field {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    font-size: 1rem;
    flex-shrink: 0;
}

.btn-remove-field:hover {
    color: #dc2626;
    transform: scale(1.2);
}

/* Select element styling */
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 0.375rem;
    background-color: white;
    color: #333;
    font-size: 1rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* =====================
   Responsive Design
   ===================== */

@media (max-width: 768px) {
    .filter-group {
        flex-direction: column;
    }

    .search-input,
    .filter-select {
        min-width: auto;
    }

    .order-detail {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-actions {
        flex-direction: column;
    }

    .order-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .modal-large {
        max-width: 90%;
    }

    .product-details {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .product-item {
        flex-direction: column;
    }

    .product-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* keep action buttons inline in small screens too */
    .actions-cell {
        white-space: nowrap;
    }

    /* Table actions cell: force inline layout and compact buttons */
    .actions-cell {
        white-space: nowrap;
        text-align: right;
    }

    .actions-cell .btn-icon-action {
        margin-left: 0.25rem;
        padding: 0.2rem;
        font-size: 1.1rem;
    }
    .custom-field-input-group {
        flex-direction: column;
    }

    .custom-field-label,
    .custom-field-value {
        flex: 1;
        min-width: auto;
    }
}
