/* Widening characteristic and value fields in Product Admin Inline without breaking buttons */
.inline-related.tabular td.field-characteristic .related-widget-wrapper,
.inline-related.tabular td.field-value .related-widget-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 5px;
}

.inline-related.tabular td.field-characteristic select,
.inline-related.tabular td.field-value select {
    flex: 1;
    /* Take up all available space */
    min-width: 150px;
    /* Decent minimum width */
    max-width: 400px;
}

/* Ensure the table columns themselves have enough room but are not forced to overlap */
.inline-related.tabular th.column-characteristic,
.inline-related.tabular th.column-value {
    width: auto;
    min-width: 200px;
}

/* Prevent labels from overlapping with select fields */
.inline-related.tabular tr.has_original td.original p,
.inline-related.tabular tr.has_original td.original span,
.inline-related.tabular tr.has_original td.original {
    display: none !important;
    /* Completely hide the "original" column text/labels */
    width: 0 !important;
    padding: 0 !important;
}

/* Ensure the selects don't jump on top of the labels */
.inline-related.tabular td {
    position: relative;
    overflow: visible;
}

.inline-related.tabular td.field-characteristic select,
.inline-related.tabular td.field-value select {
    flex: 1;
    min-width: 150px;
    max-width: 400px;
    z-index: 1;
    /* Ensure select is above any background stuff but below labels if they are intentional */
}

/* Legacy inline image tweaks (no longer used, kept for reference)
   Product images inline now use custom template catalog/admin/product_image_inline.html */

/* Global Admin Proportion Adjustments (Unfold) */
.unfold-form-row label,
.form-row label {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #666 !important;
    flex: 0 0 120px !important;
    /* Fixed smaller width for labels */
    max-width: 120px !important;
}

.unfold-form-row .unfold-control,
.form-row .field-box {
    flex: 1 1 auto !important;
    width: 100% !important;
}

.unfold-form-row input[type="text"],
.unfold-form-row input[type="number"],
.unfold-form-row select,
.unfold-form-row .vTextField {
    width: 100% !important;
    min-width: 150px !important;
}

/* Fix for grouped rows (sku, code, barcode) */
div.flex.flex-col.gap-2.w-full div.flex.flex-col.gap-2 {
    flex-direction: row !important;
    align-items: center !important;
    gap: 15px !important;
}

/* Generic admin object tools layout */
.admin-object-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: 20px;
}

/* Generic admin buttons */
.btn-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    border-width: 1px;
    border-style: solid;
}

.btn-admin--primary {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.btn-admin--danger {
    background-color: #dc2626;
    border-color: #dc2626;
    color: #ffffff;
}

.btn-admin:hover {
    opacity: 0.9;
}

/* Object tools button with spacing on change_list pages */
.admin-object-tools-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    margin-left: 1rem;
}

/* Instruction card on maintenance pages */
.admin-instruction-card {
    padding: 24px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-top: 20px;
}

.admin-instruction-title {
    font-size: 1.125rem;
    font-weight: 500;
    margin-bottom: 12px;
    color: #111827;
}

.admin-instruction-text {
    font-size: 0.875rem;
    color: #6b7280;
}

.admin-instruction-text+.admin-instruction-text {
    margin-top: 8px;
}

/* Generic admin page card (used for result/output pages) */
.admin-page-card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.admin-code-block {
    background-color: #f9fafb;
    padding: 1rem;
    border-radius: 0.375rem;
    border: 1px solid #e5e7eb;
    overflow-x: auto;
}

.admin-code-block pre {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.875rem;
    color: #374151;
    white-space: pre-wrap;
}

.admin-back-link {
    display: inline-flex;
    align-items: center;
    font-weight: 500;
    color: #2563eb;
    text-decoration: none;
    margin-top: 1.5rem;
}

.admin-back-link-icon {
    margin-right: 0.5rem;
}

/* Product thumbnails on changelist */
.admin-product-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    background-color: #ffffff;
    border: 1px solid #eeeeee;
}

.admin-product-thumb-placeholder {
    width: 60px;
    height: 60px;
    background-color: #eeeeee;
    border-radius: 8px;
}

/* Select2 \"add\" button in dropdown */
.admin-select2-add-button {
    color: #ff6b00;
    font-weight: 600;
    cursor: pointer;
    border-top: 1px solid #dddddd;
    padding: 12px;
    background-color: #ffffff;
    display: block;
    text-align: left;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
}

.admin-select2-add-button.is-loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Inline field messages for admin forms */
.admin-field-message {
    margin-top: 4px;
    font-size: 12px;
}

.admin-field-message--warning {
    color: #d97706;
}

.admin-field-message--error {
    color: #b91c1c;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 0.375rem;
}

.badge--green {
    background: #dcfce7;
    color: #065f46;
}

.badge--red {
    background: #fee2e2;
    color: #7f1d1d;
}