/* ============================================================
   ATC Admin — Unified Form Styling
   Goal: consistent input height/width across all add/edit forms
   (Workshops, Courses, Students, Instructors, HR) and keep the
   file-upload (choose-file) icon inline on the SAME line as its input.
   Scoped to dialogs / modals / forms to avoid affecting toolbars, filters, etc.
   ============================================================ */

:root {
    --atc-input-height: 44px;
    --atc-input-radius: 8px;
    --atc-input-border: #e2e5ec;
    --atc-input-focus: #4361ee; /* primary */
    --atc-input-gap: 16px;
}

/* ---- Normalize text-like inputs & selects inside forms/dialogs ---- */
md-dialog form .uk-input,
md-dialog form .uk-select,
md-dialog form .form-control,
md-dialog form .form-select,
md-dialog form select,
md-dialog form textarea.uk-textarea,
md-dialog .uk-input,
md-dialog .uk-select,
md-dialog .form-control,
md-dialog .form-select,
.uk-modal-dialog .uk-input,
.uk-modal-dialog .uk-select,
.uk-modal-dialog .form-control,
.uk-modal-dialog .form-select,
form .uk-input,
form .uk-select,
form .form-control,
form .form-select {
    height: var(--atc-input-height) !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border: 1px solid var(--atc-input-border) !important;
    border-radius: var(--atc-input-radius) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    font-family: 'Inter', 'Almarai', sans-serif !important;
    background-color: #fff !important;
    transition: border-color .15s ease, box-shadow .15s ease;
    line-height: 1.4 !important;
}

/* textareas keep a consistent width but grow vertically */
md-dialog form textarea.uk-textarea,
md-dialog .uk-textarea,
.uk-modal-dialog .uk-textarea,
form textarea.uk-textarea,
form textarea.form-control {
    height: auto !important;
    min-height: 90px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    border: 1px solid var(--atc-input-border) !important;
    border-radius: var(--atc-input-radius) !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
}

/* focus state matching the primary color */
md-dialog .uk-input:focus,
md-dialog .uk-select:focus,
md-dialog .form-control:focus,
md-dialog .form-select:focus,
.uk-modal-dialog .uk-input:focus,
form .uk-input:focus,
form .uk-select:focus,
form .form-control:focus,
form .form-select:focus {
    border-color: var(--atc-input-focus) !important;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, .12) !important;
    outline: none !important;
}

/* consistent vertical rhythm between fields inside modals */
md-dialog form .mb-3,
.uk-modal-dialog form .mb-3 {
    margin-bottom: var(--atc-input-gap) !important;
}

/* ============================================================
   choose-file (file upload) — icon inline & same height as inputs
   ============================================================ */
choose-file > div[layout='row'],
choose-file div[layout='row'] {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;      /* keep icon level with the input */
    gap: 8px !important;
}

/* the filename box takes remaining width and matches input height */
choose-file md-input-container {
    flex: 1 1 auto !important;
    margin: 0 !important;
    padding: 0 !important;
}
choose-file md-input-container .md-errors-spacer,
choose-file md-input-container label { display: none !important; }

choose-file md-input-container input[type="text"] {
    height: var(--atc-input-height) !important;
    box-sizing: border-box !important;
    border: 1px solid var(--atc-input-border) !important;
    border-radius: var(--atc-input-radius) !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    background-color: #f8f9fb !important;
    color: #6b7280 !important;
    width: 100% !important;
}

/* the attach-file button sized to match the input height, centered on the line */
choose-file .md-fab.md-mini {
    flex: 0 0 auto !important;
    margin: 0 !important;
    width: var(--atc-input-height) !important;
    height: var(--atc-input-height) !important;
    min-height: var(--atc-input-height) !important;
    line-height: var(--atc-input-height) !important;
    background-color: var(--atc-input-focus) !important;
}
choose-file .md-fab.md-mini md-icon,
choose-file .md-fab.md-mini .material-icons {
    color: #fff !important;
    line-height: var(--atc-input-height) !important;
}

/* ============================================================
   ATC Admin — Modern md-select & md-select-menu Styling
   ============================================================ */

/* 1. Backdrop & Container */
.md-select-backdrop {
    z-index: 999990 !important;
    background-color: transparent !important;
}

.md-select-menu-container,
.md-select-menu-container.md-active {
    z-index: 999999 !important;
    box-shadow: none !important;
    pointer-events: auto !important;
    opacity: 1 !important;
}

/* 2. Menu Surface & Opaque Content */
.md-select-menu-container md-select-menu,
md-select-menu,
md-select-menu md-content,
.md-select-menu-container md-content {
    background-color: #ffffff !important;
    background: #ffffff !important;
    color: #1e293b !important;
}

md-select-menu {
    border-radius: 12px !important;
    box-shadow: 0 12px 30px -4px rgba(15, 23, 42, 0.15), 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.06) !important;
    border: 1px solid #e2e8f0 !important;
    padding: 6px !important;
    max-height: 320px !important;
    overflow-y: auto !important;
    pointer-events: auto !important;
}

md-select-menu md-content {
    padding: 0 !important;
}

/* 3. Options & Items */
md-select-menu md-option,
.md-select-menu-container md-option {
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 14px !important;
    margin: 2px 0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    font-family: 'Inter', 'Almarai', sans-serif !important;
    color: #334155 !important;
    display: flex !important;
    align-items: center !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    transition: background-color 0.15s ease, color 0.15s ease !important;
}

md-select-menu md-option .md-text {
    font-size: 14px !important;
    font-weight: 500 !important;
    color: inherit !important;
    pointer-events: none !important;
}

/* Hover & Focus state */
md-select-menu md-option:hover,
md-select-menu md-option:focus,
md-select-menu md-option.md-focused {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
}

/* Selected state */
md-select-menu md-option[selected],
md-select-menu md-option.md-selected,
md-select-menu md-option.md-active {
    background-color: #eef2ff !important;
    color: #4338ca !important;
    font-weight: 600 !important;
}

md-select-menu md-option[selected] .md-text,
md-select-menu md-option.md-selected .md-text {
    font-weight: 600 !important;
    color: #4338ca !important;
}

/* Optgroup Header */
md-select-menu md-optgroup label {
    font-size: 12px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #94a3b8 !important;
    padding: 8px 12px 4px !important;
    margin: 0 !important;
}

/* 4. Select Header Search Box (Inside md-select-header) */
md-select-header.demo-select-header,
.selectdemoSelectHeader .demo-select-header {
    background: #ffffff !important;
    padding: 8px 10px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 4px !important;
}

.demo-header-searchbox,
md-select-header input[type="search"] {
    width: 100% !important;
    height: 36px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    background-color: #f8fafc !important;
    color: #1e293b !important;
    box-sizing: border-box !important;
    outline: none !important;
    transition: all 0.2s ease !important;
}

.demo-header-searchbox:focus,
md-select-header input[type="search"]:focus {
    border-color: #4361ee !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15) !important;
}

/* 5. Trigger Select Input Control in Forms */
/* 5. Trigger Select Input Control in Forms */
md-input-container md-select {
    margin: 0 !important;
}

md-input-container md-select .md-select-value {
    min-height: 38px !important;
    border-bottom: 1px solid #d1d5db !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    padding: 6px 2px !important;
    font-size: 14px !important;
    font-family: 'Inter', 'Almarai', sans-serif !important;
    color: #1e293b !important;
    background: transparent !important;
    transition: border-color 0.15s ease !important;
}

md-input-container.md-input-focused md-select .md-select-value,
md-input-container md-select:focus .md-select-value {
    border-bottom: 2px solid var(--atc-input-focus, #4361ee) !important;
}

md-input-container md-select .md-select-icon {
    color: #64748b !important;
    margin: 0 !important;
}

/* 6. Night Mode / Dark Theme in Admin */
body.night-mode .md-select-menu-container md-select-menu,
body.night-mode md-select-menu,
body.night-mode md-select-menu md-content,
body.night-mode .md-select-menu-container md-content {
    background-color: #1e293b !important;
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.night-mode md-select-menu md-option,
body.night-mode .md-select-menu-container md-option {
    color: #cbd5e1 !important;
}

body.night-mode md-select-menu md-option:hover,
body.night-mode md-select-menu md-option:focus {
    background-color: #334155 !important;
    color: #ffffff !important;
}

body.night-mode md-select-menu md-option[selected],
body.night-mode md-select-menu md-option.md-selected {
    background-color: #312e81 !important;
    color: #c7d2fe !important;
}

body.night-mode md-select-menu md-option[selected] .md-text,
body.night-mode md-select-menu md-option.md-selected .md-text {
    color: #c7d2fe !important;
}

body.night-mode md-select-header.demo-select-header {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.night-mode .demo-header-searchbox,
body.night-mode md-select-header input[type="search"] {
    background-color: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.night-mode md-input-container md-select .md-select-value {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}
