/* =======================================
   Django Unfold Admin: Custom Field Styles
   Author: Alaa Jrad
   ======================================= */

/* 1. Native disabled/readonly input, select, textarea */
input[disabled],
input[readonly],
select[disabled],
select[readonly],
textarea[disabled],
textarea[readonly] {
    background-color: #f5f5f5 !important;
    color: #777 !important;
    cursor: not-allowed !important;
    border: 1px dashed #ccc !important;
    opacity: 0.7;
}

/* 2. Readonly fields rendered as <p class="readonly"> */
p.readonly {
    background-color: #f5f5f5;
    color: #555;
    padding: 6px 10px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    font-style: italic;
    opacity: 0.9;
}

/* 3. Select2 fields (e.g., user field) - based on aria-disabled */
.select2-selection[aria-disabled="true"] {
    background-color: #f5f5f5 !important;
    color: #777 !important;
    border: 1px dashed #ccc !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

/* 4. Prevent glow on focus of disabled fields */
input[disabled]:focus,
select[disabled]:focus,
textarea[disabled]:focus {
    box-shadow: none !important;
}

/* 5. Optional: dim the label of disabled or readonly fields */
fieldset .form-row label {
    opacity: 0.95;
}

/* 6. Optional: style Select2 clear (x) icon for disabled fields */
.select2-selection[aria-disabled="true"] .select2-selection__clear {
    display: none !important;
}