/* ============================================
   Online Register Form - Accessible Styles
   WCAG 2.1 AA Compliant
   ============================================ */

/* === FOCUS STATES === */
*:focus-visible {
    outline: 2px solid #1f3f9b;
    outline-offset: 2px;
    border-radius: 4px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    border-color: #1f3f9b !important;
    box-shadow: 0 0 0 0.2rem rgba(31, 63, 155, 0.25) !important;
}

.btn:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(31, 63, 155, 0.5) !important;
}

/* === INTERACTION STATES === */
.btn {
    transition: all 0.2s ease-in-out;
}

.btn:hover:not(:disabled) {
    transform: scale(1.02);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input:not(:disabled),
select:not(:disabled),
textarea:not(:disabled) {
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

/* === ERROR STATES === */
.is-invalid {
    border-color: #dc3545 !important;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.invalid-feedback {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #dc3545;
    margin-top: 0.25rem;
}

.invalid-feedback::before {
    content: "⚠";
    font-size: 1rem;
}

/* === SUCCESS STATES === */
.is-valid {
    border-color: #198754 !important;
}

.valid-feedback {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #198754;
    margin-top: 0.25rem;
}

.valid-feedback::before {
    content: "✓";
    font-size: 1rem;
    font-weight: bold;
}

/* === WIZARD STEPPER === */
.wizard-stepper {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding: 1.5rem 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    position: relative;
}

.wizard-stepper::before {
    content: '';
    position: absolute;
    top: 2.5rem;
    left: 5%;
    right: 5%;
    height: 2px;
    background: #dee2e6;
    z-index: 0;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    z-index: 1;
    flex: 1;
    cursor: pointer;
}

.wizard-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #6c757d;
    transition: all 0.3s ease;
}

.wizard-step.active .wizard-step-circle {
    background: #1f3f9b;
    border-color: #1f3f9b;
    color: #fff;
    box-shadow: 0 4px 12px rgba(31, 63, 155, 0.3);
}

.wizard-step.completed .wizard-step-circle {
    background: #198754;
    border-color: #198754;
    color: #fff;
}

.wizard-step.completed .wizard-step-circle::after {
    content: "✓";
    position: absolute;
    font-weight: bold;
}

.wizard-step-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #6c757d;
    text-align: center;
    max-width: 100px;
}

.wizard-step.active .wizard-step-label {
    color: #1f3f9b;
    font-weight: 600;
}

.wizard-step.completed .wizard-step-label {
    color: #198754;
}

/* === WIZARD CONTENT === */
.wizard-content {
    min-height: 400px;
}

.wizard-step-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.wizard-step-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === WIZARD NAVIGATION === */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #dee2e6;
}

/* === REQUIRED FIELD INDICATOR === */
.required-indicator {
    color: #dc3545;
    font-weight: bold;
    margin-left: 0.25rem;
}

label.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* === FIELD HINTS === */
.field-hint {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-hint::before {
    content: "ℹ";
    font-weight: bold;
}

/* === TOUCH TARGETS (44x44px minimum) === */
@media (max-width: 767.98px) {
    input[type="radio"],
    input[type="checkbox"] {
        width: 24px;
        height: 24px;
    }

    .form-check {
        padding-left: 2rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .form-check-input {
        margin-left: -2rem;
    }

    .btn {
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 767.98px) {
    .wizard-stepper {
        padding: 1rem 0.5rem;
    }

    .wizard-step-label {
        font-size: 0.65rem;
        max-width: 60px;
    }

    .wizard-step-circle {
        width: 40px;
        height: 40px;
        font-size: 0.875rem;
    }

    .wizard-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #fff;
        padding: 1rem;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        margin-top: 0;
    }

    .wizard-content {
        margin-bottom: 80px;
    }

    .card {
        border-radius: 0 !important;
    }

    .row.g-3 {
        row-gap: 1rem !important;
    }
}

/* === SCREEN READER ONLY === */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === LIVE REGION === */
.live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* === HIGH CONTRAST RATIOS === */
.form-label,
.form-check-label {
    color: #212529; /* Contrast ratio 16.7:1 on white */
    font-weight: 500;
}

.text-muted {
    color: #495057 !important; /* Improved contrast from Bootstrap default */
}

/* === LOADING STATE === */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* === PROGRESS INDICATOR === */
.progress-bar-wizard {
    height: 4px;
    background: #dee2e6;
    margin-bottom: 1rem;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-wizard .progress {
    height: 100%;
    background: linear-gradient(90deg, #1f3f9b 0%, #4a6fa5 100%);
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* === REVIEW SECTION === */
.review-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.review-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.review-section-title {
    font-weight: 600;
    color: #212529;
}

.review-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.review-item:last-child {
    border-bottom: none;
}

.review-item-label {
    font-weight: 500;
    color: #495057;
}

.review-item-value {
    color: #212529;
    font-weight: 400;
}

.edit-link {
    color: #1f3f9b;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

.edit-link:hover {
    color: #142d6d;
    text-decoration: underline;
}

/* === ESTIMATED TIME === */
.estimated-time {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #e7f3ff;
    border-left: 3px solid #1f3f9b;
    border-radius: 4px;
    font-size: 0.875rem;
    color: #1f3f9b;
    margin-bottom: 1rem;
}

/* === ACCESSIBILITY IMPROVEMENTS === */
fieldset {
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

legend {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    padding: 0 0.5rem;
    width: auto;
    margin-bottom: 0;
    float: none;
}

/* === SKIP LINK === */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1f3f9b;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

