/**
 * Register Form Fixes & Enhancements
 * - Phone input styling for intl-tel-input (improved)
 * - File upload styling (enhanced UX)
 * - Labels without asterisk for non-required fields
 * - Question label styling
 */

/* ============================================================
   PHONE INPUT FIX (intl-tel-input compatibility) - ENHANCED
   ============================================================ */

/* Fix for intl-tel-input dropdown overlap */
.iti {
    width: 100% !important;
    display: flex !important;
}

.iti--separate-dial-code {
    display: flex !important;
}

.iti--separate-dial-code .iti__tel-input {
    padding-left: 15px !important;
    width: 100% !important;
    border: none !important;
    background: none !important;
}

.form-control[type="tel"],
#phone {
    padding-left: 0 !important;
    width: 100% !important;
}

/* Prevent intl-tel-input from overlapping with form styles */
.iti__flag-container {
    left: 0;
    z-index: 5;
    padding-left: 12px;
    display: flex;
    align-items: center;
}

.iti__country-list {
    z-index: 1060 !important;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(106, 27, 109, 0.15);
    border: 1px solid rgba(106, 27, 109, 0.1);
}

.iti__country {
    padding: 8px 10px;
    transition: background-color 0.15s ease;
}

.iti__country:hover {
    background-color: rgba(106, 27, 109, 0.08);
}

.iti__country-name,
.iti__dial-code {
    font-size: 13px;
    font-weight: 500;
}

/* Adjust phone input in register form */
#register .form-control[type="tel"],
#register .form-control#phone {
    padding-left: 0 !important;
    padding-right: 15px !important;
    border: 2px solid rgba(106, 27, 109, 0.12) !important;
    border-radius: 14px !important;
    height: 48px !important;
}

#register .form-control[type="tel"]:focus,
#register .form-control#phone:focus {
    border-color: var(--premium-primary, #6a1b6d) !important;
    box-shadow: 0 0 0 4px rgba(106, 27, 109, 0.08), 0 4px 16px rgba(106, 27, 109, 0.06) !important;
}

#register .iti {
    width: 100% !important;
    display: flex !important;
    border: 2px solid rgba(106, 27, 109, 0.12) !important;
    border-radius: 14px !important;
    padding: 0 !important;
    background: rgba(245, 240, 247, 0.5) !important;
    transition: all 0.3s ease !important;
}

#register .iti:focus-within {
    border-color: var(--premium-primary, #6a1b6d) !important;
    box-shadow: 0 0 0 4px rgba(106, 27, 109, 0.08), 0 4px 16px rgba(106, 27, 109, 0.06) !important;
}

#register .iti__tel-input {
    width: 100% !important;
    border: none !important;
    background: none !important;
    padding: 10px 12px !important;
    font-size: 15px !important;
    height: 48px !important;
    display: flex !important;
    align-items: center !important;
}

#register .iti__flag-container {
    position: relative;
    left: 0;
    z-index: 5;
    padding-right: 8px;
}

/* Responsive fix for phone input on mobile */
@media (max-width: 576px) {
    #register .form-control[type="tel"],
    #register .form-control#phone {
        padding-left: 0 !important;
        font-size: 14px;
    }
    
    #register .iti {
        flex-direction: column;
    }
}


/* ============================================================
   FILE UPLOAD - MINIMAL PROFESSIONAL DESIGN
   ============================================================ */

/*.custom-file {
    position: relative;
    display: inline-block;
    width: 100%;
    height: auto;
    margin-bottom: 0;
}

.custom-file-input {
    position: absolute;
    z-index: 100;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    pointer-events: auto;
}

.custom-file-label {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    padding: 24px 20px;
    margin-bottom: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.5;
    color: #6b7280;
    text-align: center;
    background-color: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    min-height: 90px;
    pointer-events: none;
    z-index: 1;
}

.custom-file-label i {
    font-size: 32px;
    color: #d1d5db;
    transition: all 0.2s ease;
    pointer-events: none;
}

.custom-file-label span {
    display: block;
    pointer-events: none;
}

.custom-file-label:hover {
    border-color: #6a1b6d;
    background-color: #fafafa;
    color: #374151;
}

.custom-file-label:hover i {
    color: #6a1b6d;
    transform: translateY(-2px);
}

.custom-file-input:focus ~ .custom-file-label {
    border-color: #6a1b6d;
    box-shadow: 0 0 0 3px rgba(106, 27, 109, 0.1);
}

.custom-file-input.file-selected ~ .custom-file-label,
.custom-file-label.selected {
    border-color: #10b981;
    background-color: #f0fdf4;
    color: #059669;
}

.custom-file-input.file-selected ~ .custom-file-label i,
.custom-file-label.selected i {
    color: #10b981;
}

.custom-file-label .file-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    pointer-events: none;
}

.custom-file-label .file-name {
    font-weight: 500;
    font-size: 12px;
    color: #1f2937;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

.custom-file-label .file-size {
    font-size: 11px;
    color: #9ca3af;
    pointer-events: none;
}

.custom-file-label .default-text {
    font-size: 13px;
    pointer-events: none;
}

.custom-file-label.selected .default-text {
    display: none;
}

.custom-file-label *,
.custom-file-label::before,
.custom-file-label::after {
    pointer-events: none;
}

[data-repeater-list] {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

[data-repeater-item] {
    width: 100%;
}

[data-repeater-item] .row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

[data-repeater-item] .form-group {
    margin-bottom: 0;
}

[data-repeater-delete] {
    height: 90px;
    padding: 0 16px;
    border: 1.5px solid #fee2e2;
    background-color: #ffffff;
    color: #ef4444;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-repeater-delete]:hover {
    background-color: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

[data-repeater-delete] i {
    font-size: 18px;
}

[data-repeater-create] {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    margin-top: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background-color: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

[data-repeater-create]:hover {
    border-color: #6a1b6d;
    color: #6a1b6d;
    background-color: #fafafa;
    box-shadow: 0 2px 8px rgba(106, 27, 109, 0.1);
}

[data-repeater-create] i {
    font-size: 16px;
}

[dir="rtl"] .custom-file-label {
    text-align: center;
}

@media (max-width: 576px) {
    .custom-file-label {
        padding: 20px 16px;
        min-height: 80px;
    }
    
    .custom-file-label i {
        font-size: 28px;
    }
    
    [data-repeater-delete] {
        height: 80px;
        padding: 0 12px;
    }
}*/

/* ============================================================
   LABEL STYLING (Question & Assessment Labels)
   ============================================================ */

/* Base label styling */
.form-label-clean {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--premium-text, #333);
    margin-bottom: 8px;
    line-height: 1.4;
    position: relative;
}

/* Class for labels that should NOT show asterisk */
.form-label-clean::after,
.label-no-asterisk::after,
.question-label::after,
.survey-question-label::after {
    content: "" !important;
}

/* Ensure required labels still show asterisk */
.required-label {
    position: relative;
}

.required-label::after {
    content: " *";
    color: #EF4444;
    font-weight: 800;
    margin-left: 2px;
}

/* Question label styling for surveys/assessments */
.question-label,
.survey-question-label,
.assessment-question {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--premium-text, #333);
    margin-bottom: 12px;
    margin-top: 8px;
    line-height: 1.4;
    position: relative;
}

.question-label::after,
.survey-question-label::after,
.assessment-question::after {
    content: "" !important;
}

/* RTL Support */
[dir="rtl"] .iti__flag-container {
    left: auto;
    right: 15px;
}

[dir="rtl"] #register .form-control[type="tel"],
[dir="rtl"] #register .form-control#phone {
    padding-left: 15px !important;
    padding-right: 70px !important;
}

[dir="rtl"] .custom-file-label {
    text-align: center;
}

/* Question survey styling (for assessment questions) */
.question-label,
.survey-question-label {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    color: var(--premium-text, #333);
}

.question-label::after,
.survey-question-label::after {
    content: "" !important;
}

/* Ensure form stability and prevent jumping */
#formRegister {
    display: flex;
    flex-direction: column;
}

#formRegister .row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -12px;
    margin-left: -12px;
}

#formRegister .col-md-6,
#formRegister .col-md-12 {
    padding-right: 12px;
    padding-left: 12px;
    flex-basis: auto;
}

/* Ensure consistent form control height */
#register .form-control {
    min-height: 48px;
    display: flex;
    align-items: center;
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

/* Better focus states */
.form-control:focus,
.custom-file-label:focus,
select:focus {
    outline: 2px solid transparent;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
