/* Khadim Reference Cascade Form Styling (Exact Match) */

.khadim-ref-container {
    max-width: 1040px;
    margin: 30px auto;
    font-family: 'Tajawal', 'IBM Plex Sans Arabic', system-ui, sans-serif;
    color: #1c2420;
    direction: rtl;
    text-align: right;
}

.khadim-form-header-box {
    margin-bottom: 28px;
    text-align: center;
}

.khadim-eyebrow {
    display: inline-block;
    background: rgba(14, 70, 56, 0.08);
    color: #0E4638;
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 12px;
}

.khadim-main-title {
    font-size: 32px;
    font-weight: 800;
    color: #082921;
    margin: 0 0 10px 0;
}

.khadim-subtitle {
    font-size: 15px;
    color: #5e6d66;
    max-width: 680px;
    margin: 0 auto;
    line-height: 1.6;
}

.khadim-section-card {
    background: #ffffff;
    border: 1px solid #e5e9e7;
    border-radius: 20px;
    padding: 26px;
    margin-bottom: 24px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.02);
}

.section-card-header, .cascade-section-head, .inventory-section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.khadim-field-label {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1c2420;
}

.khadim-field-hint {
    font-size: 13px;
    color: #5e6d66;
    margin: 4px 0 0 0;
}

.req-star {
    color: #dc2626;
}

/* Role Pills */
.role-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.role-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: 1px solid #e5e9e7;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    background: #fdfdfc;
    transition: all 0.2s ease;
}

.role-pill input {
    display: none;
}

.role-pill.active {
    background: #0E4638;
    color: #ffffff;
    border-color: #0E4638;
}

/* Mosque Toggle & Search */
.mosque-mode-actions {
    display: flex;
    gap: 8px;
}

.btn-mosque-mode {
    background: #f4f6f5;
    border: 1px solid #e2e8f0;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: #475569;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-mosque-mode.active {
    background: rgba(14, 70, 56, 0.1);
    color: #0E4638;
    border-color: #0E4638;
}

.search-input-field {
    position: relative;
    margin-top: 10px;
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #94a3b8;
}

.search-spinner {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #0E4638;
}

.search-input-field .khadim-input {
    padding-right: 42px;
}

.ajax-results-dropdown {
    position: absolute;
    width: 100%;
    max-height: 280px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    z-index: 100;
    margin-top: 4px;
}

.ajax-mosque-item {
    padding: 11px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.ajax-mosque-item:hover {
    background: #f8fafc;
    color: #0E4638;
}

.selected-mosque-pill {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    padding: 12px 18px;
    border-radius: 12px;
    margin-top: 10px;
}

.selected-mosque-pill .pill-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.district-badge, .type-badge {
    font-size: 12px;
    background: rgba(14, 70, 56, 0.12);
    color: #0E4638;
    padding: 2px 8px;
    border-radius: 6px;
}

.btn-unselect {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
}

.new-mosque-panel {
    background: #fdfaf6;
    border: 1px dashed #c59b27;
    border-radius: 14px;
    padding: 18px;
    margin-top: 14px;
}

.new-mosque-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #8c6a0c;
    margin-bottom: 14px;
}

/* 3. CASCADE 3-COLUMNS SELECTOR (مطابق للصورة تماماً) */
.cascade-columns-wrapper {
    display: flex;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fbfbf9;
    overflow-x: auto;
    margin-top: 12px;
    min-height: 290px;
}

.cascade-column {
    flex: 1;
    min-width: 220px;
    border-left: 1px solid #e5e9e7;
    display: flex;
    flex-direction: column;
}

.cascade-column:last-child {
    border-left: none;
}

.cascade-col-header {
    background: #f1f5f9;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

.cascade-items-list {
    padding: 8px;
    overflow-y: auto;
    max-height: 270px;
    flex: 1;
}

.cascade-item-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 10px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
    text-align: right;
    transition: all 0.15s ease;
    margin-bottom: 3px;
}

.cascade-item-btn:hover {
    background: #edf2f0;
}

.cascade-item-btn.active {
    background: #0E4638;
    color: #ffffff;
}

.cascade-item-btn.active i {
    color: #ffffff !important;
}

.cascade-item-btn.checked {
    background: rgba(197, 155, 39, 0.15);
    font-weight: 700;
}

.cascade-item-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cascade-empty-hint {
    padding: 30px 14px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
}

.selected-counter-badge {
    background: rgba(14, 70, 56, 0.1);
    color: #0E4638;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
}

/* 4. SELECTED NEEDS CARDS WITH INDEPENDENT PRIORITIES */
.selected-needs-workspace {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px;
}

.workspace-title h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
}

.workspace-title .sub-hint {
    font-size: 12px;
    color: #64748b;
}

.needs-empty-banner {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    font-size: 14px;
}

.needs-empty-banner i {
    font-size: 32px;
    margin-bottom: 6px;
    display: block;
}

.needs-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 14px;
}

.need-card-item {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.need-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.need-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.need-title-wrap strong {
    font-size: 15px;
    color: #082921;
}

.need-cat-label {
    font-size: 12px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 6px;
}

.btn-remove-need-item {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 4px 10px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12.5px;
    font-weight: 700;
    transition: all 0.2s ease;
}

.btn-remove-need-item:hover {
    background: #fca5a5;
    color: #7f1d1d;
}

.need-card-index {
    background: #0E4638;
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
}

.need-card-body {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 900px) {
    .need-card-body {
        grid-template-columns: 1fr;
    }
}

.need-field-block {
    display: flex;
    flex-direction: column;
}

.need-sublabel {
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
    display: block;
    margin-bottom: 6px;
}

.prio-pill-group {
    display: flex;
    gap: 6px;
}

.btn-prio-choice {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 8px;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn-prio-choice:hover {
    border-color: #94a3b8;
    transform: translateY(-1px);
}

.btn-prio-choice.high.active {
    background: #fee2e2;
    border-color: #dc2626;
    color: #991b1b;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.25);
}

.btn-prio-choice.med.active {
    background: #fef3c7;
    border-color: #d97706;
    color: #92400e;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.25);
}

.btn-prio-choice.low.active {
    background: #dcfce7;
    border-color: #16a34a;
    color: #14532d;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.25);
}

/* Need Photo Upload Box */
.need-photo-upload-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-need-upload-photo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1.5px dashed #0E4638;
    border-radius: 10px;
    background: rgba(14, 70, 56, 0.04);
    color: #0E4638;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.btn-need-upload-photo:hover {
    background: rgba(14, 70, 56, 0.1);
    border-color: #082921;
}

.need-photo-preview-wrap {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #cbd5e1;
    margin-top: 4px;
}

.need-photo-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-need-photo {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: rgba(220, 38, 38, 0.85);
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.btn-remove-need-photo:hover {
    background: #dc2626;
}

/* 5. INVENTORY TABLE */
.inventory-table-container {
    overflow-x: auto;
    margin-top: 14px;
}

.khadim-inv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background: #ffffff;
}

.khadim-inv-table th, .khadim-inv-table td {
    padding: 12px 14px;
    border: 1px solid #e2e8f0;
    text-align: right;
}

.khadim-inv-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #334155;
}

.btn-delete-row {
    background: #fee2e2;
    color: #b91c1c;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
}

.btn-secondary-action {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    color: #1e293b;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.btn-add-row {
    background: #ffffff;
    border: 1px dashed #0E4638;
    color: #0E4638;
    padding: 10px;
    width: 100%;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}

/* Inputs & Form Controls */
.khadim-input, .khadim-textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 14px;
    background: #ffffff;
    box-sizing: border-box;
    outline: none;
    font-family: inherit;
}

.khadim-input:focus, .khadim-textarea:focus {
    border-color: #0E4638;
    box-shadow: 0 0 0 3px rgba(14, 70, 56, 0.12);
}

.coords-box {
    display: flex;
    gap: 8px;
}

.btn-gps {
    background: #e2e8f0;
    border: none;
    padding: 0 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
}

.btn-primary-submit {
    width: 100%;
    background: #0E4638;
    color: #ffffff;
    border: none;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary-submit:hover {
    background: #082921;
}

.status-feedback {
    margin-top: 14px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
}

.khadim-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.khadim-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .cascade-columns-wrapper {
        flex-direction: column;
        min-height: auto;
    }
    .cascade-column {
        border-left: none;
        border-bottom: 1px solid #e5e9e7;
    }
    .need-card-body {
        grid-template-columns: 1fr;
    }
}


/* Simplified Inventory Styles */
.khadim-badge-opt {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 2px 8px;
    border-radius: 20px;
    margin-right: 6px;
    vertical-align: middle;
}

.inventory-section-head-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    user-select: none;
}

.btn-toggle-inv {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f0fdf4;
    color: #166534;
    border: 1.5px solid #86efac;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-toggle-inv:hover {
    background: #dcfce7;
    border-color: #4ade80;
}

.btn-toggle-inv.active {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fca5a5;
}

.inventory-collapsible-content {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed #e2e8f0;
}

.inv-card-item {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 14px;
    position: relative;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    transition: border-color 0.2s;
}

.inv-card-item:hover {
    border-color: #cbd5e1;
}

.inv-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.inv-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #0E4638;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-del-inv-card {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-del-inv-card:hover {
    background: #fee2e2;
}

.inv-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

@media (max-width: 640px) {
    .inv-card-grid {
        grid-template-columns: 1fr;
    }
}

.inv-file-upload-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.inv-file-input {
    display: none;
}

.btn-choose-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px dashed #94a3b8;
    padding: 8px 14px;
    border-radius: 8px;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.btn-choose-file:hover {
    background: #f1f5f9;
    border-color: #0E4638;
    color: #0E4638;
}

.inv-file-name-preview {
    font-size: 12px;
    color: #166534;
    font-weight: 600;
    margin-top: 4px;
    display: none;
}

.btn-add-inv-card {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1.5px dashed #0E4638;
    color: #0E4638;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-inv-card:hover {
    background: rgba(14, 70, 56, 0.05);
}

/* ===================================================
   6. SUPERVISOR AUTH & LOGIN GATE STYLES
   =================================================== */
.khadim-auth-box {
    max-width: 540px;
    margin: 40px auto 60px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 10px 30px -5px rgba(14, 70, 56, 0.08);
    direction: rtl;
    text-align: right;
}

.auth-box-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-icon-circle {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, rgba(14, 70, 56, 0.1) 0%, rgba(200, 169, 106, 0.2) 100%);
    color: #0E4638;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    margin: 0 auto 14px;
    border: 1px solid rgba(200, 169, 106, 0.3);
}

.auth-badge {
    display: inline-block;
    background: rgba(200, 169, 106, 0.15);
    color: #92400e;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 14px;
    border-radius: 50px;
    margin-bottom: 10px;
    border: 1px solid rgba(200, 169, 106, 0.3);
}

.auth-title {
    font-size: 24px;
    font-weight: 800;
    color: #0E4638;
    margin: 0 0 10px;
}

.auth-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0;
}

.auth-field-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.auth-input {
    height: 48px;
    font-size: 15px;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    background: #f8fafc;
    transition: all 0.2s ease;
}

.auth-input:focus {
    border-color: #0E4638;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(14, 70, 56, 0.12);
}

.password-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrap .auth-input {
    padding-left: 45px;
    width: 100%;
}

.btn-toggle-pwd {
    position: absolute;
    left: 12px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.btn-toggle-pwd:hover {
    color: #0E4638;
}

.auth-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 13px;
    color: #475569;
}

.remember-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.btn-primary-auth {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, #0E4638 0%, #155c4a 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(14, 70, 56, 0.25);
    transition: all 0.2s ease;
}

.btn-primary-auth:hover {
    background: linear-gradient(135deg, #093329 0%, #0E4638 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(14, 70, 56, 0.35);
}

.auth-footer-note {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12.5px;
    color: #64748b;
    line-height: 1.6;
    text-align: center;
}

/* Logged-in Session Bar */
.supervisor-session-bar {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 14px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.session-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar-badge {
    width: 38px;
    height: 38px;
    background: #dcfce7;
    color: #166534;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: 1px solid #86efac;
}

.session-email {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-top: 2px;
}

.btn-logout-session {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
}

.btn-logout-session:hover {
    background: #fecaca;
}
