/* ===================================
   AUTHENTIFICATION TEDPLAS - login.css
   Compatible: login.php, login-phone.php, register.php
   =================================== */

/* ===================================
   LOADER TEDPLAS
   =================================== */

.tp-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 32px;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.tp-loader-overlay.tp-loader--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.tp-loader-core {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.tp-loader-ring {
    width: 56px;
    height: 56px;
    border: 4px solid #f0f0f0;
    border-top-color: #F66B0E;
    border-radius: 50%;
    animation: tp-spin 0.8s linear infinite;
}

@keyframes tp-spin {
    to { transform: rotate(360deg); }
}

.tp-loader-brand {
    text-align: center;
}

.tp-loader-brand__name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: #1A1A1A;
    letter-spacing: -0.5px;
}

.tp-loader-brand__name span {
    color: #F66B0E;
}

.tp-loader-brand__tagline {
    font-size: 13px;
    color: #9b9b9b;
    margin-top: 4px;
}

.tp-loader-progress {
    width: 240px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tp-loader-progress__bar-bg {
    width: 100%;
    height: 4px;
    background: #f0f0f0;
    border-radius: 2px;
    overflow: hidden;
}

.tp-loader-progress__bar-fill {
    height: 100%;
    width: 0%;
    background: #F66B0E;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.tp-loader-progress__text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #9b9b9b;
}

#tpProgressMsg {
    transition: opacity 0.2s ease;
}

.tp-loader-progress__percent {
    font-weight: 600;
    color: #F66B0E;
}

/* ===================================
   DARK MODE — Loader
   =================================== */
[data-theme="dark"] .tp-loader-overlay {
    background: #1a1a1a;
}

[data-theme="dark"] .tp-loader-brand__name {
    color: #f0f0f0;
}

[data-theme="dark"] .tp-loader-ring {
    border-color: #333;
    border-top-color: #F66B0E;
}

[data-theme="dark"] .tp-loader-progress__bar-bg {
    background: #333;
}

/* ===================================
   Reset & Base
   =================================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Maax', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f4f4f6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Container principal ─── */
.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
}

/* ─── Auth Container : centré, largeur max ─── */
.auth-container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ─── Suppression de l'ancienne auth-info sidebar ─── */
/* L'ancien .auth-info n'est plus utilisé dans login-phone.php.
   On le garde masqué au cas où il serait encore dans login.php. */
.auth-info {
    display: none !important;
}

/* ─── Brand (logo + tagline) dans auth-box ─── */
.auth-brand {
    text-align: center;
    margin-bottom: 24px;
}

.auth-brand h1 {
    color: #F66B0E;
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -1px;
    line-height: 1;
    margin-bottom: 8px;
}

.auth-brand__tagline {
    font-size: 15px;
    color: #646464;
    line-height: 22px;
}

/* ─── Tabs méthodes de connexion ─── */
.auth-methods {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    background: #f0f0f2;
    border-radius: 10px;
    padding: 4px;
}

.auth-method-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #646464;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.auth-method-tab i {
    font-size: 13px;
}

.auth-method-tab:hover {
    color: #F66B0E;
    background: #fff;
}

.auth-method-tab.active {
    background: #ffffff;
    color: #F66B0E;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ─── Auth Box ─── */
.auth-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.08);
    padding: 40px;
    width: 100%;
}

/* ─── En-tête de la boîte ─── */
.auth-box-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-box-icon {
    font-size: 32px;
    line-height: 1;
}

.auth-box-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 2px;
}

.auth-box-header p {
    font-size: 14px;
    color: #8b8b8b;
}

/* ─── Alerts ─── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    line-height: 20px;
}

.alert i {
    margin-top: 1px;
    flex-shrink: 0;
}

.alert-error {
    background-color: #fff1f0;
    color: #cf1322;
    border: 1px solid #ffccc7;
}

.alert-success {
    background-color: #f6ffed;
    color: #389e0d;
    border: 1px solid #b7eb8f;
}

/* ─── Formulaire ─── */
.auth-form {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 8px;
}

/* Input générique avec icône */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap > i:first-child {
    position: absolute;
    left: 14px;
    color: #9b9b9b;
    font-size: 15px;
    pointer-events: none;
    z-index: 1;
}

.input-wrap input,
.input-wrap select {
    width: 100%;
    padding: 13px 44px 13px 42px;
    font-size: 15px;
    border: 1.5px solid #d4d4d4;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
    color: #1A1A1A;
}

.input-wrap select {
    padding-left: 42px;
    appearance: none;
    cursor: pointer;
}

.input-wrap input:focus,
.input-wrap select:focus {
    border-color: #F66B0E;
    box-shadow: 0 0 0 3px rgba(246, 107, 14, 0.10);
}

.input-wrap input::placeholder {
    color: #b0b0b0;
}

.input-wrap input.error {
    border-color: #EF5350;
}

.input-wrap input.success {
    border-color: #43A047;
}

/* Toggle mot de passe */
.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    color: #9b9b9b;
    padding: 4px;
    display: flex;
    align-items: center;
    font-size: 15px;
    transition: color 0.2s;
}

.password-toggle:hover {
    color: #F66B0E;
}

/* ─── Champ téléphone ─── */
.phone-field-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #d4d4d4;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.phone-field-wrap:focus-within {
    border-color: #F66B0E;
    box-shadow: 0 0 0 3px rgba(246, 107, 14, 0.10);
}

.phone-flag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    background: #f8f8f8;
    border-right: 1.5px solid #d4d4d4;
    height: 46px;
    white-space: nowrap;
    flex-shrink: 0;
}

.phone-field-wrap input {
    flex: 1;
    padding: 13px 14px;
    font-size: 15px;
    border: none;
    outline: none;
    background: #ffffff;
    color: #1A1A1A;
}

.phone-field-wrap input::placeholder {
    color: #b0b0b0;
}

/* Phone prefix pour register */
.phone-prefix {
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    background: #f8f8f8;
    border-right: 1.5px solid #d4d4d4;
    height: 46px;
    border-radius: 8px 0 0 8px;
    flex-shrink: 0;
}

.phone-input {
    flex: 1;
    padding: 13px 14px !important;
    border-radius: 0 8px 8px 0 !important;
    border-left: none !important;
}

/* ─── Lien mot de passe oublié ─── */
.forgot-link {
    text-align: right;
    margin-bottom: 20px;
    margin-top: -4px;
}

.forgot-link a {
    color: #F66B0E;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
}

.forgot-link a:hover {
    text-decoration: underline;
}

/* ─── Boutons ─── */
.btn {
    font-size: 15px;
    font-weight: 600;
    padding: 13px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.btn-primary {
    background: #F66B0E;
    color: #ffffff;
}

.btn-primary:hover {
    background: #E55A00;
}

.btn-primary:active {
    background: #D14D00;
    transform: scale(0.98);
}

/* Bouton Google */
.btn-google {
    background: #ffffff;
    color: #1A1A1A;
    border: 1.5px solid #d4d4d4;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    border-radius: 8px;
}

.btn-google:hover {
    background: #f9f9f9;
    border-color: #b8b8b8;
}

.btn-google svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Bouton Créer un compte */
.btn-create {
    background: #ffffff;
    color: #F66B0E;
    border: 2px solid #F66B0E;
    font-size: 15px;
    padding: 12px 24px;
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    display: flex;
}

.btn-create:hover {
    background: #FFF8F1;
}

/* ─── Séparateur ─── */
.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #b0b0b0;
    font-size: 13px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e8e8e8;
}

.divider span {
    padding: 0 14px;
    font-weight: 500;
}

/* ─── Liens bas de page ─── */
.create-page {
    text-align: center;
    padding-top: 16px;
    font-size: 13px;
    color: #8b8b8b;
}

.create-page a {
    color: #F66B0E;
    font-weight: 600;
    text-decoration: none;
}

.create-page a:hover {
    text-decoration: underline;
}

.switch-method {
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
}

.switch-method a {
    color: #646464;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.switch-method a:hover {
    color: #F66B0E;
}

/* ─── Badge sécurité ─── */
.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    font-size: 12px;
    color: #9b9b9b;
}

.security-badge i {
    color: #43A047;
}

/* =========================================
   REGISTER — layout deux colonnes
   ========================================= */

.register-container {
    display: flex;
    gap: 32px;
    max-width: 960px;
    margin: 0 auto;
    padding: 32px 20px;
    width: 100%;
    align-items: flex-start;
}

/* Sidebar register */
.register-info {
    flex: 0 0 280px;
    background: #F66B0E;
    border-radius: 12px;
    padding: 32px 28px;
    color: #fff;
    position: sticky;
    top: 24px;
}

.register-info h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.register-info > p {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 28px;
    line-height: 20px;
}

.info-feature {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.info-feature-icon {
    font-size: 24px;
    flex-shrink: 0;
    line-height: 1;
    margin-top: 2px;
}

.info-feature-text h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 2px;
}

.info-feature-text p {
    font-size: 12px;
    opacity: 0.80;
    line-height: 18px;
}

.info-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.25);
}

.info-stat {
    text-align: center;
}

.info-stat-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.info-stat-label {
    display: block;
    font-size: 11px;
    opacity: 0.75;
    margin-top: 2px;
}

/* Boîte register */
.register-box {
    flex: 1;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.08);
    padding: 40px;
}

.register-box h1 {
    font-size: 26px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 6px;
}

.subtitle {
    color: #8b8b8b;
    font-size: 14px;
    margin-bottom: 28px;
}

/* Grille formulaire */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.form-grid .form-group {
    grid-column: span 1;
}

/* Full-width dans la grille */
.form-grid .form-group:has(input[type="email"]),
.form-grid .user-type-group,
.form-grid .terms-row {
    grid-column: span 2;
}

/* Hint / label facultatif */
.field-hint {
    display: block;
    font-size: 12px;
    color: #9b9b9b;
    margin-top: 4px;
}

.required {
    color: #F66B0E;
}

.optional {
    font-weight: 400;
    color: #9b9b9b;
    font-size: 12px;
}

/* Barre de force mot de passe */
.strength-bar-wrap {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.strength-seg {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #e8e8e8;
    transition: background 0.3s;
}

.strength-seg.weak   { background: #EF5350; }
.strength-seg.medium { background: #FFA726; }
.strength-seg.strong { background: #66BB6A; }
.strength-seg.great  { background: #26A69A; }

.strength-label {
    display: block;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
}

.strength-label.weak   { color: #EF5350; }
.strength-label.medium { color: #FFA726; }
.strength-label.strong { color: #66BB6A; }
.strength-label.great  { color: #26A69A; }

/* Sélection type utilisateur */
.user-type-group {
    margin-top: 4px;
}

.user-type-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1A1A1A;
    margin-bottom: 10px;
}

.user-type-options {
    display: flex;
    gap: 10px;
}

.user-type-card {
    flex: 1;
}

.user-type-card input[type="radio"] {
    display: none;
}

.user-type-card label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 10px;
    border: 1.5px solid #d4d4d4;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    text-align: center;
    color: #646464;
}

.user-type-card label i {
    font-size: 20px;
    color: #9b9b9b;
}

.user-type-card label strong {
    font-size: 13px;
    color: #1A1A1A;
}

.user-type-card label span {
    font-size: 11px;
    color: #9b9b9b;
    line-height: 15px;
}

.user-type-card input:checked + label {
    border-color: #F66B0E;
    background: #FFF8F1;
    color: #F66B0E;
}

.user-type-card input:checked + label i,
.user-type-card input:checked + label strong {
    color: #F66B0E;
}

/* Checkbox conditions */
.terms-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 4px;
    margin-bottom: 0;
}

.terms-row input[type="checkbox"] {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: #F66B0E;
    flex-shrink: 0;
}

.terms-row label {
    font-size: 13px;
    color: #646464;
    line-height: 20px;
    cursor: pointer;
}

.terms-row label a {
    color: #F66B0E;
    text-decoration: none;
    font-weight: 600;
}

.terms-row label a:hover {
    text-decoration: underline;
}

/* Lien connexion en bas du register */
.login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #646464;
}

.login-link a {
    color: #F66B0E;
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
}

.login-link a:hover {
    text-decoration: underline;
}

/* ─── Animation bouton loading ─── */
.btn.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to { transform: rotate(360deg); }
}

/* ─── Responsive ─── */
@media (max-width: 820px) {
    .register-container {
        flex-direction: column;
        padding: 20px 16px;
    }

    .register-info {
        flex: none;
        width: 100%;
        position: static;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .form-group:has(input[type="email"]),
    .form-grid .user-type-group,
    .form-grid .terms-row {
        grid-column: span 1;
    }

    .user-type-options {
        flex-direction: column;
    }
}

@media (max-width: 520px) {
    .auth-box {
        padding: 28px 20px;
        border-radius: 8px;
        box-shadow: none;
    }

    .auth-brand h1 {
        font-size: 36px;
    }

    .auth-methods {
        flex-direction: column;
    }

    .auth-method-tab {
        justify-content: flex-start;
    }

    .register-box {
        padding: 28px 20px;
        border-radius: 8px;
        box-shadow: none;
    }
}

/* =========================================
   FORGOT PASSWORD — styles
   ========================================= */

/* La page forgot utilise .auth-container/.auth-box existants.
   On ajoute les éléments spécifiques manquants. */

/* Header de la boîte forgot */
.forgot-header {
    margin-bottom: 24px;
}

.forgot-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1A1A1A;
    margin-bottom: 8px;
}

.forgot-header p {
    font-size: 14px;
    color: #8b8b8b;
    line-height: 20px;
}

/* Lien retour connexion */
.forgot-back-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
}

.forgot-back-link a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #F66B0E;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: color 0.2s;
}

.forgot-back-link a:hover {
    color: #E55A00;
    text-decoration: underline;
}

/* Bloc dev (lien de reset en local) */
.dev-block {
    background: #e3f2fd;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #2196f3;
    margin-bottom: 20px;
    font-size: 13px;
}

.dev-block h3 {
    margin: 0 0 10px;
    color: #1976d2;
    font-size: 16px;
}

.dev-block .dev-smtp-err {
    background: #fff3e0;
    border: 1px solid #ffb74d;
    border-radius: 6px;
    padding: 10px 14px;
    margin: 10px 0;
    color: #e65100;
    word-break: break-all;
}

.dev-block .dev-link-box {
    background: #fff;
    padding: 12px;
    border-radius: 4px;
    margin: 12px 0;
    word-break: break-all;
}

.dev-block .dev-link-box a {
    color: #1877f2;
    font-size: 13px;
    text-decoration: none;
}

.dev-block .btn-dev {
    display: inline-block;
    background: #1877f2;
    color: #fff;
    padding: 12px 24px;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    margin-top: 8px;
}

/* Succès envoi email */
.forgot-success {
    text-align: center;
    padding: 12px 0 4px;
}

.forgot-success .success-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.forgot-success p {
    font-size: 14px;
    color: #646464;
    line-height: 20px;
    margin-bottom: 24px;
}

/* Input sans label (compat ancien code) */
.form-group > input[type="email"],
.form-group > input[type="text"],
.form-group > input[type="password"] {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    border: 1.5px solid #d4d4d4;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
    color: #1A1A1A;
}

.form-group > input[type="email"]:focus,
.form-group > input[type="text"]:focus,
.form-group > input[type="password"]:focus {
    border-color: #F66B0E;
    box-shadow: 0 0 0 3px rgba(246,107,14,0.10);
}

.form-group > input::placeholder {
    color: #b0b0b0;
}

/* auth-links générique (utilisé dans forgot) */
.auth-links {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e8e8e8;
    font-size: 14px;
}

.auth-links a {
    color: #F66B0E;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.auth-links a:hover {
    text-decoration: underline;
}