/* Date picker */
.date-picker {
    position: relative;
    width: 100%;
}

.date-picker-trigger {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 40px;
    padding: 10px 12px;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--slate-800);
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.date-picker-trigger:hover {
    border-color: var(--slate-400);
}

.date-picker-trigger:focus-visible,
.date-picker.is-open .date-picker-trigger {
    outline: none;
    border-color: var(--red-600);
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.1);
}

.date-picker-trigger.is-invalid {
    border-color: var(--red-600);
}

.date-picker-value.is-placeholder {
    color: var(--slate-400);
}

.date-picker-icon {
    flex-shrink: 0;
    color: var(--slate-500);
}

.date-picker-popover {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 60;
    width: 280px;
    padding: 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.date-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.date-picker-month {
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-900);
}

.date-picker-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--slate-600);
    cursor: pointer;
    transition: background 0.15s;
}

.date-picker-nav:hover {
    background: var(--slate-100);
}

.date-picker-weekdays,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.date-picker-weekdays {
    margin-bottom: 4px;
}

.date-picker-weekday {
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-500);
    text-align: center;
    padding: 4px 0;
}

.date-picker-day {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 1;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--slate-800);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.date-picker-day:hover:not(:disabled) {
    background: var(--slate-100);
}

.date-picker-day.is-selected {
    background: var(--red-600);
    color: var(--white);
}

.date-picker-day.is-today:not(.is-selected) {
    border: 1px solid var(--red-200);
}

.date-picker-day:disabled {
    color: var(--slate-300);
    cursor: default;
}

.date-picker-day.is-outside {
    color: var(--slate-300);
}

/* File upload */
.file-upload {
    width: 100%;
}

.file-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 120px;
    padding: 20px 16px;
    border: 1.5px dashed var(--slate-300);
    border-radius: var(--radius);
    background: var(--slate-50);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.file-upload-zone:hover,
.file-upload.is-dragover .file-upload-zone {
    border-color: var(--red-300);
    background: var(--red-50);
}

.file-upload.is-invalid .file-upload-zone {
    border-color: var(--red-600);
    background: var(--red-50);
}

.file-upload-icon {
    width: 36px;
    height: 36px;
    color: var(--slate-400);
}

.file-upload-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-800);
}

.file-upload-hint {
    font-size: 12px;
    color: var(--slate-500);
}

.file-upload-browse {
    font-size: 13px;
    font-weight: 600;
    color: var(--red-600);
}

.file-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.file-upload-preview {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: var(--white);
}

.file-upload.has-file .file-upload-preview {
    display: flex;
}

.file-upload.has-file .file-upload-zone {
    min-height: 88px;
    padding: 14px;
}

.file-upload-file {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-upload-file-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--red-50);
    color: var(--red-600);
}

.file-upload-file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--slate-800);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-upload-remove {
    flex-shrink: 0;
    padding: 6px 10px;
    border: 1px solid var(--slate-200);
    border-radius: 999px;
    background: var(--white);
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.file-upload-remove:hover {
    border-color: var(--red-200);
    color: var(--red-600);
    background: var(--red-50);
}

/* Compact file upload (inline / membership conditional rows) */
.file-upload--compact .file-upload-zone {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    min-height: 0;
    max-height: 52px;
    padding: 10px 14px;
    text-align: left;
}

.file-upload--compact .file-upload-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.file-upload--compact .file-upload-title,
.file-upload--compact .file-upload-hint {
    display: none;
}

.file-upload--compact .file-upload-browse {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
}

.file-upload--compact.has-file .file-upload-zone {
    display: none;
}

.file-upload--compact.has-file .file-upload-preview {
    margin-top: 0;
    padding: 8px 10px;
}

.file-upload--compact .file-upload-file-icon {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.file-upload--compact .file-upload-file-name {
    font-size: 12px;
}

.file-upload--compact .file-upload-remove {
    padding: 5px 9px;
    font-size: 11px;
}

@media (max-width: 480px) {
    .file-upload--compact .file-upload-zone {
        max-height: none;
        min-height: 44px;
    }
}

/* Field validation */
.imdd-required-mark {
    color: var(--red-600);
    font-weight: 600;
    margin-left: 2px;
}

.imdd-form-field.has-error .imdd-form-control,
.imdd-form-field.has-error .combobox-trigger,
.imdd-form-field.has-error .date-picker-trigger,
.imdd-form-field.has-error .file-upload-zone,
.imdd-form-field.has-error input:not([type="file"]),
.imdd-form-field.has-error select,
.imdd-form-field.has-error textarea {
    border-color: var(--red-600) !important;
}

.imdd-form-field.has-error .combobox-trigger:focus-visible,
.imdd-form-field.has-error .combobox.is-open .combobox-trigger,
.imdd-form-field.has-error .date-picker-trigger:focus-visible,
.imdd-form-field.has-error .date-picker.is-open .date-picker-trigger,
.imdd-form-field.has-error input:not([type="file"]):focus,
.imdd-form-field.has-error select:focus,
.imdd-form-field.has-error textarea:focus {
    border-color: var(--red-600) !important;
    box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.12);
}

.imdd-form-field.has-error .file-upload-zone {
    background: var(--red-50);
}

.imdd-field-error {
    display: none;
    margin: 0;
    font-size: 12px;
    color: var(--red-600);
    line-height: 1.4;
}

.imdd-form-field.has-error .imdd-field-error {
    display: block;
}
