/* =================================
   PAGE: p-auth
   Styles spécifiques aux pages d'authentification
   ================================= */

/* =================================
   1. RESET ET STYLES DE BASE
   ================================= */

/* Curseur de saisie visible sur tous les champs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="number"],
textarea,
.form-control,
.custom-input {
    cursor: text !important;
    caret-color: #3182ce !important;
}

/* États de focus et hover */
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="tel"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
input[type="number"]:hover,
textarea:hover,
.form-control:hover,
.custom-input:hover,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="number"]:focus,
textarea:focus,
.form-control:focus,
.custom-input:focus {
    cursor: text !important;
    caret-color: #3182ce !important;
}

body {
    background: linear-gradient(135deg, #EBF4FF 0%, #F0F9FF 100%);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* =================================
   2. LAYOUT DE LA PAGE
   ================================= */
.p-auth {
    min-height: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    padding: 1rem 1rem 2rem 1rem;
    margin-top: var(--header-height);
}

.p-auth__section {
    min-height: auto;
    display: flex;
    flex-direction: column;
    padding-top: 1rem;
    background: var(--auth-bg);
    position: relative;
}

.p-auth__container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Container plus large pour l'inscription */
.p-auth__container--register {
    max-width: 500px;
}

/* =================================
   3. FOOTER
   ================================= */
footer {
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
}

/* =================================
   4. SURCHARGES BOOTSTRAP
   ================================= */

/* Suppression des styles de validation par défaut de Bootstrap */
.was-validated .form-control:invalid,
.was-validated .form-control:valid,
.form-control.is-invalid,
.form-control.is-valid {
    border-color: transparent !important;
    padding-right: calc(1.5em + 0.75rem) !important;
    background-image:
        url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%231976d2'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%231976d2' stroke='none'/%3e%3c/svg%3e"),
        linear-gradient(white, white),
        linear-gradient(135deg, #3182ce 0%, #2c5282 100%) !important;
    background-repeat: no-repeat, repeat, repeat !important;
    background-position: right 0.5rem center, 0 0, 0 0 !important;
    background-size: 1rem auto, 100% 100%, 100% 100% !important;
    background-origin: content-box, padding-box, border-box !important;
    background-clip: padding-box, padding-box, border-box !important;
}

.was-validated .form-control:invalid:focus,
.was-validated .form-control:valid:focus,
.form-control.is-invalid:focus,
.form-control.is-valid:focus {
    border-color: transparent !important;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.25) !important;
}

/* Suppression des messages de validation */
.invalid-feedback,
.valid-feedback {
    display: none !important;
}

/* Style de la case à cocher */
.form-check-input:checked {
    background-color: var(--auth-primary) !important;
    border-color: var(--auth-primary) !important;
}

.form-check-input:focus {
    border-color: var(--auth-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(49, 130, 206, 0.25) !important;
}

.form-check-label {
    color: #495057 !important;
}

/* Force maximale pour les liens d'authentification - surcharge Bootstrap */
.p-auth .p-auth__container .c-auth-form .c-auth-form__links a,
.p-auth .p-auth__container .c-auth-form .auth-form .auth-links a {
    color: #3182ce !important;
}

.p-auth .p-auth__container .c-auth-form .c-auth-form__links a:hover,
.p-auth .p-auth__container .c-auth-form .c-auth-form__links a:focus,
.p-auth .p-auth__container .c-auth-form .c-auth-form__links a:active,
.p-auth .p-auth__container .c-auth-form .auth-form .auth-links a:hover,
.p-auth .p-auth__container .c-auth-form .auth-form .auth-links a:focus,
.p-auth .p-auth__container .c-auth-form .auth-form .auth-links a:active {
    color: #2c5282 !important;
}

/* =================================
   5. RESPONSIVE
   ================================= */
@media (min-height: 800px) {
    .p-auth {
        align-items: flex-start;
        padding-top: 1rem;
    }
}

@media (max-height: 700px) {
    .p-auth {
        padding-top: 0.75rem;
    }
}

@media (max-height: 600px) {
    .p-auth {
        padding-top: 0.5rem;
    }
}

/* =================================
   6. COMPATIBILITÉ LEGACY
   ================================= */

/* Support des anciennes classes pour transition progressive */
.auth-page {
    min-height: auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    padding: 1rem 1rem 2rem 1rem;
    margin-top: var(--header-height);
}

.auth-section {
    min-height: auto;
    display: flex;
    flex-direction: column;
    padding-top: 1rem;
    background: var(--auth-bg);
    position: relative;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.auth-container.register-container {
    max-width: 500px;
}

.auth-card {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: var(--auth-border-radius);
    padding: 0;
    box-shadow: none;
    animation: fadeIn 0.6s ease-out;
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-header i {
    font-size: 1rem;
    color: var(--auth-primary);
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

.auth-header h1 {
    color: var(--text);
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.auth-form {
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.auth-submit {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--auth-transition);
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.auth-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.auth-submit i {
    font-size: 1.1rem;
}

.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #EDF2F7;
    font-size: 0.9rem;
}

.auth-links a,
.auth-link {
    color: var(--auth-primary) !important;
    text-decoration: none;
    transition: var(--auth-transition);
    font-weight: 500;
}

.auth-links a:hover,
.auth-links a:focus,
.auth-links a:active,
.auth-link:hover,
.auth-link:focus,
.auth-link:active,
.auth-card .auth-links a:hover,
.auth-card .auth-links a:focus,
.auth-card .auth-links a:active {
    color: var(--auth-primary-dark) !important;
    text-decoration: underline;
}

.auth-back {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: var(--auth-primary);
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--auth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.auth-back:hover {
    color: var(--auth-primary-dark);
    background: rgba(33, 150, 243, 0.05);
    text-decoration: underline;
}

.auth-back i {
    font-size: 0.9rem;
}

.auth-messages {
    margin-bottom: 1.5rem;
}

.auth-message {
    padding: 1rem;
    border-radius: 8px;
    background-color: rgba(49, 130, 206, 0.1);
    color: var(--auth-primary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(49, 130, 206, 0.2);
}

.auth-message.success {
    background-color: rgba(49, 130, 206, 0.1);
    color: var(--auth-primary);
    border-color: rgba(49, 130, 206, 0.2);
}

.register-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 2rem 0;
}

.register-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--auth-glass-border);
    transform: translateY(-50%);
    z-index: 1;
}

.progress-step {
    position: relative;
    z-index: 2;
    background: white;
    padding: 0 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--auth-glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    color: white;
}

.progress-step.active .step-label {
    color: var(--auth-primary);
    font-weight: 600;
}

.progress-step.completed .step-number {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    color: white;
}

.progress-step.completed .step-number::after {
    content: '✓';
    font-size: 0.875rem;
}

.password-strength {
    height: 4px;
    background: var(--auth-glass-border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-bar.weak { background: #dc3545; }
.strength-bar.medium { background: #ffc107; }
.strength-bar.good { background: #17a2b8; }
.strength-bar.strong { background: #28a745; }

.recap-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem;
}

.recap-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--auth-glass-border);
}

.recap-item:last-child {
    border-bottom: none;
}

.auth-submit-secondary {
    background: transparent;
    border: 2px solid var(--auth-primary);
    color: var(--auth-primary);
}

.auth-submit-secondary:hover {
    background: rgba(33, 150, 243, 0.1);
}

/* Legacy support - redirecting to BEM classes */
.register-progress,
.step-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.progress-step,
.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
}

.step-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
    transition: color 0.3s ease;
    text-align: center;
}

.progress-step.active .step-number,
.step.active .step-number {
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    color: white;
    transform: scale(1.1);
}

.progress-step.active .step-label,
.step.active .step-label {
    color: var(--auth-primary);
    font-weight: 600;
}

.progress-step.completed .step-number,
.step.completed .step-number {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
}

.progress-step.completed .step-label,
.step.completed .step-label {
    color: #059669;
}

.step-line {
    flex: 1;
    height: 2px;
    background: #e9ecef;
    margin: 0 1rem;
    position: relative;
    overflow: hidden;
    min-width: 40px;
}

.step-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%);
    transition: width 0.5s ease;
}

.step-line.completed::after {
    width: 100%;
}

.password-strength {
    height: 4px;
    background: var(--auth-glass-border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.strength-bar.weak { background: #dc3545; }
.strength-bar.medium { background: #ffc107; }
.strength-bar.good { background: #17a2b8; }
.strength-bar.strong { background: #28a745; }

.recap-section {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    padding: 1rem;
}

.recap-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--auth-glass-border);
}

.recap-item:last-child {
    border-bottom: none;
}

/* Legacy form step support */
.register-step,
.form-step {
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.4s ease;
}

.register-step.active,
.form-step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
    animation: fadeIn 0.3s ease-out;
}

.register-step.slide-out-left,
.form-step.slide-out-left {
    opacity: 0;
    transform: translateX(-30px);
}

.register-step.slide-in-right,
.form-step.slide-in-right {
    opacity: 1;
    transform: translateX(0);
}

/* Form section support */
.form-section {
    margin-bottom: 2rem;
}

.form-section:last-child {
    margin-bottom: 1rem;
}

.form-section h5 {
    color: var(--auth-primary, #3182ce);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section h5 i {
    flex-shrink: 0;
}

/* Checkbox alignment fix */
.form-section .form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

.form-section .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    margin-top: 0.125rem;
    margin-right: 0;
    flex-shrink: 0;
    border: 2px solid #ced4da;
    border-radius: 0.25rem;
    background-color: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.form-section .form-check-input:checked {
    background-color: var(--auth-primary, #3182ce);
    border-color: var(--auth-primary, #3182ce);
}

.form-section .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(49, 130, 206, 0.25);
    border-color: var(--auth-primary, #3182ce);
}

.form-section .form-check-label {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #495057;
    cursor: pointer;
    margin-bottom: 0;
}

/* Form navigation support */
.form-navigation {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.form-navigation .auth-submit {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    min-height: auto;
}

/* Custom tooltip support */
.custom-tooltip {
    position: absolute;
    background: #333;
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    z-index: 1001;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    min-width: 200px;
    max-width: 320px;
    width: max-content;
    word-wrap: break-word;
    white-space: normal;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: translateY(-5px);
    text-align: left;
}

.custom-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 20px;
    transform: translateX(0);
    border: 6px solid transparent;
    border-top-color: #333;
}

.register-step {
    animation: fadeIn 0.3s ease-out;
}

@media (max-height: 700px) {
    .auth-card {
        padding: 2rem 1.5rem;
    }

    .auth-header {
        margin-bottom: 1.5rem;
    }
}

@media (max-height: 600px) {
    .auth-card {
        padding: 1.5rem 1rem;
    }

    .auth-header {
        margin-bottom: 1rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }
}
