/*
 * Shared styles for NCR workflow step child components.
 * These were previously scoped to NcrDetailWorkflowTab.razor.css
 * but child components don't inherit the parent's scoped styles.
 *
 * Referenced from: wwwroot/css/workflow-shared.css
 */

/* ========== Section/Form styles ========== */
.section-content {
    padding: 0.75rem 0.5rem 1.25rem;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field.full-width {
    grid-column: 1 / -1;
 margin-bottom: 1rem;
}

.field-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #4a4a4a;
    margin-bottom: 0.35rem;
}

.field-value {
    font-size: 0.875rem;
    color: #333;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #d5dce6;
    border-radius: 4px;
    min-height: 38px;
    display: flex;
    align-items: center;
}

.field-value-multiline {
    white-space: pre-wrap;
    word-wrap: break-word;
    align-items: flex-start;
    min-height: 80px;
    padding: 0.6rem 0.75rem;
    line-height: 1.5;
}

.field-input {
    font-size: 0.875rem;
    color: #333;
  padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #d5dce6;
    border-radius: 4px;
    min-height: 38px;
    width: 100%;
    font-family: inherit;
    box-sizing: border-box;
}

.field-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.field-input-multiline {
  min-height: 80px;
    resize: vertical;
line-height: 1.5;
}

.field-value-select {
    justify-content: space-between;
    cursor: default;
}

.select-arrow {
    color: #999;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

/* Select Dropdown Styling */
select.field-input {
    appearance: none;
    -webkit-appearance: none;
    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='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    cursor: pointer;
}

select.field-input:focus {
    cursor: pointer;
}

/* ========== Destination Toggle (Internal / Supplier) ========== */
.destination-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.destination-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.875rem 1.25rem;
    background: #fff;
    border: 2px solid #d5dce6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: #64748b;
}

.destination-option:hover {
    border-color: #94a3b8;
    background: #f8fafc;
}

.destination-option.selected {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1e40af;
    box-shadow: 0 0 0 1px #2563eb;
}

.destination-radio {
    width: 18px;
    height: 18px;
  border-radius: 50%;
    border: 2px solid #cbd5e1;
    flex-shrink: 0;
  position: relative;
    transition: all 0.2s ease;
}

.destination-radio.checked {
    border-color: #2563eb;
}

.destination-radio.checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 9px;
    height: 9px;
    background: #2563eb;
    border-radius: 50%;
}

.destination-label {
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ========== Quantity Stepper Controls ========== */
.qty-stepper-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
gap: 1rem;
    margin-bottom: 1rem;
}

.qty-stepper-field {
    display: flex;
    flex-direction: column;
}

.qty-stepper {
    display: flex;
    align-items: stretch;
    border: 2px solid #d5dce6;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    height: 64px;
}

.qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    border: none;
 background: #f8fafc;
  cursor: pointer;
    color: #475569;
    transition: all 0.15s ease;
    flex-shrink: 0;
    font-family: inherit;
    padding: 0;
}

.qty-btn:hover:not(:disabled) {
    background: #e2e8f0;
    color: #1e293b;
}

.qty-btn:active:not(:disabled) {
    background: #cbd5e1;
}

.qty-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.qty-btn-minus {
  border-right: 1px solid #e2e8f0;
}

.qty-btn-plus {
    border-left: 1px solid #e2e8f0;
}

.qty-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    min-width: 0;
    user-select: none;
    letter-spacing: -0.02em;
}

/* Editable quantity input inside stepper */
.qty-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
    min-width: 0;
    padding: 0;
    font-family: inherit;
    -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.qty-input:focus {
    background: #f0f4ff;
}

/* Quantity stepper error state */
.qty-stepper.qty-stepper-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px #ef4444;
}

/* Quantity validation warning */
.qty-validation-warning {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
  background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
  color: #b91c1c;
    font-size: 0.825rem;
    font-weight: 500;
    animation: slideDown 0.2s ease-out;
}

.qty-validation-warning svg {
    flex-shrink: 0;
    color: #ef4444;
}

/* ========== Assignment Accordion (inside Initial Containment) ========== */
.assignment-accordion {
    margin-top: 1.25rem;
    border-top: 1px solid #eef0f4;
    padding-top: 0.25rem;
}

.assignment-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
  padding: 0.75rem 0;
    cursor: pointer;
    user-select: none;
}

.assignment-accordion-header:hover .assignment-accordion-title {
    color: #1e40af;
}

.assignment-accordion-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #2563eb;
    transition: color 0.15s;
}

.assignment-accordion-chevron {
    font-size: 0.85rem;
    color: #94a3b8;
    transition: transform 0.2s;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
 justify-content: center;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    flex-shrink: 0;
}

.assignment-accordion-chevron.expanded {
    transform: rotate(180deg);
}

.assignment-accordion-content {
    padding: 0.5rem 0 0.75rem;
    animation: slideDown 0.2s ease-out;
}

/* ========== Evidence Labels ========== */
.evidence-label {
    font-size: 0.9rem;
    font-weight: 700;
 color: #003366;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eef0f4;
}

/* ========== Cost of Quality sub-section within Verification ========== */
.coq-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #003366;
    margin: 1.25rem 0 0.75rem 0;
    padding-top: 1rem;
    border-top: 2px solid #eef0f4;
}

/* ========== Checkbox Grid (Root Cause / Corrective Action multi-select) ========== */
.checkbox-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
    margin-top: 0.35rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
  padding: 0.35rem 0;
    font-size: 0.875rem;
    color: #333;
    user-select: none;
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
    margin: 0;
}

.checkbox-item input[type="checkbox"]:checked {
    border-color: #2563eb;
}

.checkbox-label-text {
    line-height: 1.3;
}

/* ========== Fieldset (disabled state for read-only steps) ========== */
fieldset:disabled {
    opacity: 0.65;
    pointer-events: none;
}

fieldset {
    border: none;
    margin: 0;
    padding: 0;
}

/* ========== Supplier Searchable Dropdown ========== */
.supplier-search-container {
    position: relative;
}

.supplier-search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.supplier-search-input-wrapper .field-input {
    padding-right: 2.25rem;
}

.supplier-clear-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.2rem;
    cursor: pointer;
    color: #94a3b8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.supplier-clear-btn:hover {
    color: #ef4444;
    background: #fef2f2;
}

.supplier-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 260px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d5dce6;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.supplier-dropdown-item {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}

.supplier-dropdown-item:last-child {
    border-bottom: none;
}

.supplier-dropdown-item:hover {
    background: #eff6ff;
}

.supplier-dropdown-item.selected {
    background: #dbeafe;
}

.supplier-dropdown-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e293b;
    line-height: 1.3;
}

.supplier-type-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.05rem 0.45rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.supplier-type-badge.inter-group {
    background: #e0e7ff;
    color: #3730a3;
}

.supplier-type-badge.external {
    background: #f1f5f9;
    color: #475569;
}

.supplier-dropdown-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.1rem;
}

.supplier-dropdown-empty {
    padding: 0.75rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }

    .destination-toggle {
        grid-template-columns: 1fr;
    }

    .qty-stepper-grid {
 grid-template-columns: 1fr;
    }

    .checkbox-grid-2 {
        grid-template-columns: 1fr;
    }
}
