/**
 * IOU Multi-Step Signup Form — CSS
 *
 * @package    auth_iouauth
 * @copyright  2025 IOU IT Team <engineering@iou.edu.gm>
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

/* ============================================================
   GOOGLE FONT IMPORT (Plus Jakarta Sans)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */
:root {
    --iou-primary:      #3498db;
    --iou-primary-dark: #1a5276;
    --iou-primary-light:#ebf5fb;
    --iou-accent:       #aeccb5;
    --iou-grad-start:   #1a5276;
    --iou-grad-mid1:    #3498db;
    --iou-grad-mid2:    #5dade2;
    --iou-grad-end:     #aeccb5;
    --iou-success:      #22c55e;
    --iou-error:        #ef4444;
    --iou-warning:      #f59e0b;
    --iou-text:         #1f2937;
    --iou-text-muted:   #64748b;
    --iou-border:       #e2e8f0;
    --iou-bg-input:     #f8fafc;
    --iou-bg-page:      #f1f5f9;
    --iou-white:        #ffffff;
    --iou-radius:       12px;
    --iou-radius-lg:    20px;
    --iou-shadow:       0 10px 40px rgba(43,88,144,0.08);
    --iou-shadow-sm:    0 2px 8px rgba(43,88,144,0.05);
    --iou-transition:   all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   ROOT RESET & OVERRIDES (Aggressive)
   ============================================================ */
#iou-multistep-signup-root {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
    color: var(--iou-text) !important;
    line-height: 1.6 !important;
    background: var(--iou-bg-page) !important;
    position: relative !important;
    z-index: 1000 !important;
}

#iou-multistep-signup-root *,
#iou-multistep-signup-root *::before,
#iou-multistep-signup-root *::after {
    box-sizing: border-box !important;
}

/* Hide Moodle theme elements */
#page-header, #page-footer, .breadcrumb, .navbar, .nav-drawer-button-container, 
#block-region-side-pre, #block-region-side-post, .secondary-navigation {
    display: none !important;
}

/* Force Moodle containers to be full width */
#page, #page-content, #region-main-box, #region-main, .container-fluid, .row, .col-12 {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
}

/* ============================================================
   CUSTOM HEADER 
   ============================================================ */
.iou-header {
    background: white;
    padding: 1.25rem 3rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 1010;
}

.iou-header-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.iou-logo-link {
    display: flex;
    align-items: center;
}

.iou-logo {
    height: 44px;
    width: auto;
}

.iou-header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.iou-guide-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #1e3a5f;
    color: white !important;
    text-decoration: none !important;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    transition: var(--iou-transition);
}

.iou-guide-link:hover {
    background: var(--iou-primary-dark);
}

.iou-login-prompt {
    font-size: 0.85rem;
    color: var(--iou-text-muted);
}

.iou-login-link {
    color: var(--iou-primary);
    font-weight: 600;
    text-decoration: none;
}

.iou-login-link:hover {
    text-decoration: underline;
}

.iou-footer {
    padding: 2rem;
    text-align: center;
    color: var(--iou-text-muted);
    font-size: 0.85rem;
    background: transparent;
    margin-top: 2rem;
}

/* ============================================================
   SIGNUP CONTAINER 
   ============================================================ */
.iou-main-content {
    display: flex;
    justify-content: center;
    padding: 2.5rem 1.5rem;
}

.iou-signup-wrap {
    width: 100% !important;
    max-width: 620px !important; 
    margin: 0 auto !important;
}

.iou-signup-card {
    background: var(--iou-white) !important;
    border-radius: 24px !important;
    padding: 3.5rem 3rem !important;
    width: 100% !important;
    position: relative !important;
    box-shadow: var(--iou-shadow) !important;
}

/* ============================================================
   PROGRESS INDICATOR
   ============================================================ */
.iou-progress-section {
    margin-bottom: 3rem;
}

.iou-progress-bar-track {
    height: 4px;
    background: #e2e8f0;
    border-radius: 99px;
    margin-bottom: 2.5rem;
    overflow: hidden;
}

.iou-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--iou-primary), var(--iou-primary-dark));
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.iou-steps-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.iou-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.iou-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #94a3b8;
    transition: var(--iou-transition);
}

.iou-step-item.active .iou-step-circle {
    background: white;
    border-color: var(--iou-primary);
    color: var(--iou-primary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.iou-step-item.completed .iou-step-circle {
    background: var(--iou-primary);
    border-color: var(--iou-primary);
    color: white;
}

.iou-step-check {
    display: none;
    font-size: 1.1rem;
}

.iou-step-item.completed .iou-step-number {
    display: none;
}

.iou-step-item.completed .iou-step-check {
    display: block;
}

.iou-step-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    margin-top: 0.75rem;
    transition: var(--iou-transition);
}

.iou-step-item.active .iou-step-label,
.iou-step-item.completed .iou-step-label {
    color: var(--iou-primary);
}

/* ============================================================
   TITLES
   ============================================================ */
.iou-step-title {
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin-bottom: 0.5rem !important;
    letter-spacing: -0.02em !important;
}

.iou-step-subtitle {
    font-size: 1rem !important;
    color: #64748b !important;
    margin-bottom: 2.5rem !important;
}

.iou-step-divider {
    height: 3px;
    background: #e2e8f0;
    width: 60px;
    border-radius: 99px;
    margin-bottom: 2.5rem;
}

.iou-section-block {
    margin-bottom: 2rem;
}

.iou-section-title {
    font-size: 1.15rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    margin-bottom: 1.25rem !important;
}

.iou-section-divider {
    height: 1px;
    background: #e2e8f0;
    width: 100%;
    margin: 2rem 0;
}

/* ============================================================
   INPUTS
   ============================================================ */
.iou-form-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 1.5rem !important;
    margin-bottom: 0.5rem;
}

/* ============================================================
   GENDER CARDS
   ============================================================ */
.iou-gender-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.iou-gender-option {
    padding: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    transition: var(--iou-transition);
    background: white;
}

.iou-gender-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.iou-gender-option.active {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

/* ============================================================
   SELECTS & ENHANCEMENTS
   ============================================================ */
.iou-select-wrapper {
    position: relative;
    width: 100%;
}

.iou-select-arrow {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
    font-size: 1.25rem;
}

.iou-form-select {
    appearance: none !important;
    -webkit-appearance: none !important;
    padding-right: 3rem !important;
}

.iou-phone-wrapper .iti {
    width: 100% !important;
}

.iou-phone-wrapper .iti__selected-dial-code {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
    margin-left: 8px;
}

.iou-phone-wrapper .iti__selected-flag {
    padding-left: 12px !important;
    padding-right: 8px !important;
    background: transparent !important;
}

.iou-phone-wrapper .iti--separate-dial-code .iti__selected-flag {
    background: #f1f5f9 !important;
    border-right: 1px solid #e2e8f0;
    border-radius: 12px 0 0 12px;
}

.iou-phone-wrapper .iti--separate-dial-code input {
    padding-left: 95px !important;
}

.iou-phone-wrapper .iti__country-list {
    z-index: 100 !important;
    border-radius: 12px !important;
    box-shadow: var(--iou-shadow) !important;
    border: 1px solid var(--iou-border) !important;
}


.iou-info-box {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f9ff;
    border-radius: 10px;
    font-size: 0.85rem;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.iou-info-box a {
    color: #0284c7;
    font-weight: 700;
    text-decoration: underline;
}

/* ============================================================
   PROMO SECTION
   ============================================================ */
.iou-promo-section {
    margin-bottom: 2rem;
}

.iou-promo-toggle {
    background: none;
    border: none;
    color: #64748b;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
}

.iou-promo-toggle:hover {
    color: #3b82f6;
}

.iou-promo-content {
    display: none;
    margin-top: 1rem;
    animation: iouFadeSlide 0.3s ease;
}

.iou-promo-section.open .iou-promo-content {
    display: block;
}

.iou-promo-arrow {
    transition: transform 0.3s ease;
}

.iou-promo-section.open .iou-promo-arrow {
    transform: rotate(180deg);
}

/* ============================================================
   CHECKBOXES
   ============================================================ */
.iou-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    margin: 2rem 0;
}

.iou-checkbox-input {
    width: 20px !important;
    height: 20px !important;
    margin-top: 0.2rem !important;
    cursor: pointer !important;
}

.iou-checkbox-text {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
}

.iou-checkbox-text a {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
}

/* ============================================================
   PROGRESS CONNECTORS
   ============================================================ */
.iou-step-connector {
    flex: 1;
    height: 2px;
    background: #e2e8f0;
    margin-top: 18px;
    margin-left: -18px;
    margin-right: -18px;
    z-index: 1;
}

.iou-step-item.active ~ .iou-step-connector,
.iou-step-item:not(.completed):not(.active) ~ .iou-step-connector {
    background: #e2e8f0;
}

.iou-step-item.completed + .iou-step-connector {
    background: var(--iou-primary);
}

.iou-step-circle {
    z-index: 2;
    position: relative;
}

/* ============================================================
   MODALS (Success State)
   ============================================================ */
.iou-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1.5rem;
}

.iou-modal-overlay.show {
    display: flex !important;
}

.iou-modal-box {
    background: white;
    width: 100%;
    max-width: 440px;
    padding: 3rem;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    animation: iouFadeSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.iou-modal-icon {
    width: 80px;
    height: 80px;
    background: #f0fdf4;
    color: #22c55e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin: 0 auto 1.5rem;
}

.iou-modal-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.iou-modal-text {
    color: #64748b;
    margin-bottom: 2rem;
}

.iou-modal-btn {
    justify-content: center !important;
    margin: 0 auto !important;
    width: auto !important;
    min-width: 220px !important;
}

/* ============================================================
   INPUTS & TOGGLE REFINEMENT
   ============================================================ */
.iou-form-group {
    margin-bottom: 1.75rem;
}

.iou-form-label {
    display: block !important;
    font-size: 0.9rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.6rem !important;
    color: #1e293b !important;
}

.iou-required {
    color: var(--iou-error) !important;
    margin-left: 2px !important;
}

.iou-input-wrapper {
    position: relative;
    width: 100%;
    display: block;
}

.iou-form-input, .iou-form-select {
    width: 100% !important;
    height: 54px !important;
    padding-top: 0.75rem !important;
    padding-bottom: 0.75rem !important;
    padding-right: 1.25rem !important;
    padding-left: 1.25rem;
    background: #f8fafc !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 12px !important;
    font-size: 1rem !important;
    color: #0f172a !important;
    transition: var(--iou-transition) !important;
    outline: none !important;
}

.iou-input-wrapper input[type="date"] {
    padding-right: 5rem !important;
}

.iou-input-wrapper input[type="date"] + .iou-input-icon {
    right: 1.3rem !important;
}

.iou-input-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    position: absolute;
    right: 3rem;
    width: 20px;
    height: 20px;
    margin: 0;
}

.iou-input-wrapper input[type="date"]::-webkit-inner-spin-button,
.iou-input-wrapper input[type="date"]::-webkit-clear-button {
    display: none;
}

/* Fix for intlTelInput */
.iti {
    width: 100% !important;
    display: block !important;
}
.iti__flag-container {
    /* Kept default */
}
.iti .iou-form-input {
    text-indent: 15px !important;
}

.iou-form-input:focus {
    border-color: #3b82f6 !important;
    background: white !important;
}

.iou-input-icon {
    position: absolute !important;
    right: 1.25rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 4 !important;
    pointer-events: none !important;
    opacity: 0 !important;
    transform-origin: center !important;
    transition: var(--iou-transition) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.iou-valid-icon {
    color: var(--iou-success) !important;
}

.iou-spinner {
    color: var(--iou-primary) !important;
    animation: iou-spin 1s linear infinite !important;
}

@keyframes iou-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.iou-match-icon,
.iou-password-icon {
    color: var(--iou-success) !important;
    right: 3.5rem !important; /* Positioned to the left of the eye icon */
}

/* Visibility based on validation state */
.iou-valid + .iou-input-icon,
.iou-matched + .iou-input-icon,
.iou-input-icon.show {
    opacity: 1 !important;
}

/* Valid state border */
.iou-form-input.iou-valid,
.iou-form-select.iou-valid {
    border-color: var(--iou-success) !important;
}

.iou-form-input.iou-invalid,
.iou-form-select.iou-invalid {
    border-color: var(--iou-error) !important;
    background: #fff1f2 !important;
}


.iou-toggle-password {
    position: absolute !important;
    right: 1rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: none !important;
    border: none !important;
    font-size: 1.25rem !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    z-index: 5 !important;
}

.iou-eye-icon {
    font-size: 1.25rem;
    pointer-events: none;
}

/* ============================================================
   PASSWORD STRENGTH METER
   ============================================================ */
.iou-strength-wrap {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.iou-strength-bar {
    flex: 1 !important;
    height: 6px !important;
    background: #e2e8f0 !important; /* Visible track background */
    border-radius: 99px !important;
    overflow: hidden !important;
    min-width: 100px !important;
}

.iou-strength-fill {
    height: 100% !important;
    width: 0%;
    background-color: #cbd5e1;
    transition: width 0.4s ease, background-color 0.4s ease !important;
    border-radius: 99px !important;
}

.iou-strength-label {
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
    transition: color 0.3s ease;
}

/* Strength Levels (Increased specificity) */
#iou-multistep-signup .iou-strength-fill.weak   { width: 25% !important; background: #ef4444 !important; }
#iou-multistep-signup .iou-strength-fill.fair   { width: 50% !important; background: #f59e0b !important; }
#iou-multistep-signup .iou-strength-fill.good   { width: 75% !important; background: #84cc16 !important; }
#iou-multistep-signup .iou-strength-fill.strong { width: 100% !important; background: #22c55e !important; }

#iou-multistep-signup .iou-strength-label.weak   { color: #ef4444 !important; }
#iou-multistep-signup .iou-strength-label.fair   { color: #f59e0b !important; }
#iou-multistep-signup .iou-strength-label.good   { color: #84cc16 !important; }
#iou-multistep-signup .iou-strength-label.strong { color: #22c55e !important; }

/* ============================================================
   BUTTONS
   ============================================================ */
.iou-form-nav {
    display: flex !important;
    margin-top: 2.5rem;
    gap: 1rem;
}

.iou-btn {
    display: inline-flex;
    align-items: center;
    height: 54px !important;
    padding: 0 1.5rem !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    line-height: 1 !important;
    transition: var(--iou-transition) !important;
    cursor: pointer !important;
    text-align: center !important;
    gap: 0.75rem;
}

.iou-btn:disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.iou-btn-loader {
    display: none;
    margin-left: 0.5rem;
    align-items: center;
    justify-content: center;
}

.iou-btn.loading .iou-btn-loader {
    display: inline-flex !important;
}

.iou-btn.loading .iou-btn-icon {
    display: none !important;
}

.iou-btn-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.iou-toggle-password {
    position: absolute !important;
    right: 0.75rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: 38px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #94a3b8 !important;
    outline: none !important;
    z-index: 10 !important;
}

.iou-toggle-password svg {
    width: 20px;
    height: 20px;
    display: block;
    transition: color 0.25s ease;
    pointer-events: none;
}

.iou-toggle-password:hover svg {
    color: #3b82f6;
}

.iou-btn-primary, .iou-btn-submit {
    background: #3385c3 !important;
    color: white !important;
    border: none !important;
    margin-left: auto;
    min-width: 180px;
    justify-content: space-between;
}

.iou-btn-primary:hover {
    background: #2a6e9f !important;
    transform: translateY(-1px) !important;
}

.iou-btn-secondary {
    background: white !important;
    color: #64748b !important;
    border: 2px solid #e2e8f0 !important;
    justify-content: center;
    min-width: 180px;
}

.iou-btn-back {
    justify-content: space-between !important;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .iou-footer-rights {
        display: block;
        margin-top: 0.25rem;
    }
    .iou-header { padding: 1rem 1.5rem; }
    .iou-header-right { gap: 0.75rem; }
    .iou-guide-link { font-size: 0.75rem; padding: 0.5rem 1rem; }
    .iou-login-prompt { display: none; }
    
    .iou-main-content { padding: 1.5rem 1rem; }
    .iou-signup-card { padding: 2.5rem 1.5rem !important; }
    
    .iou-form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
        margin-bottom: 0 !important;
    }

    .iou-form-nav {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.85rem;
        margin-top: 2rem;
        width: 100%;
    }

    .iou-form-nav.iou-nav-no-back {
        grid-template-columns: 1fr;
    }

    .iou-btn {
        height: 50px !important;
        font-size: 1rem !important;
        white-space: nowrap;
        justify-content: center !important;
        min-width: 0 !important;
        overflow: hidden;
    }

    .iou-btn-back, #iou-btn-next {
        min-width: 0 !important;
        width: 100% !important;
    }

    .iou-btn-submit {
        min-width: 0 !important;
        width: 100% !important;
        order: 0;
        padding: 0 0.6rem !important;
        gap: 0.25rem;
        font-size: 0.88rem !important;
        justify-content: center !important;
    }

    .iou-btn-submit .iou-btn-text {
        min-width: 0;
        overflow: hidden;
        text-overflow: clip;
        white-space: nowrap;
    }

    .iou-btn-submit .iou-btn-text {
        font-size: 0;
    }

    .iou-btn-submit .iou-btn-text::after {
        content: attr(data-mobile-text);
        font-size: 0.88rem;
    }

    .iou-btn-submit .iou-btn-icon {
        display: none;
    }
}

/* ============================================================
   FORM STEP VISIBILITY & ANIMATION
   ============================================================ */
.iou-form-step {
    display: none;
    animation: iouFadeSlide 0.4s ease forwards;
}

.iou-form-step.active {
    display: block !important;
}

@keyframes iouFadeSlide {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.iou-error-msg {
    display: none;
    color: #ef4444 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    margin-top: 0.4rem !important;
}

.iou-error-msg.show {
    display: block !important;
}

.iou-helper-text {
    display: block;
    color: var(--iou-text-muted);
    font-size: 0.75rem;
    margin-top: 0.4rem;
    font-weight: 500;
}

.iou-resume-banner {
    display: flex !important;
}

.iou-invalid-icon { color: var(--iou-error) !important; }

/* Promo Note Alert */
.iou-promo-note {
    margin-top: 12px;
    padding: 10px 14px;
    background-color: var(--iou-primary-light);
    border-radius: 8px;
    border-left: 4px solid var(--iou-primary);
    font-size: 0.75rem;
    color: var(--iou-text-muted);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.iou-promo-note i {
    font-size: 1.25rem;
    color: var(--iou-primary);
    flex-shrink: 0;
    margin-top: 1px;
}
