/* ================================================================
   CONNECT.CSS - Page de Connexion/Inscription Ergonomique
   ================================================================ */

/* === BASE & RESET === */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0a0d14 0%, #131a2a 50%, #0f121d 100%);
    color: #e6e6fa;
    font-family: 'EB Garamond', Georgia, serif;
    line-height: 1.6;
}

/* Cache le portail canvas */
#portal-center-container {
    display: none;
}

/* === CONTAINER PRINCIPAL === */
main.connect-page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: calc(100vh - 80px);
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* === ALERTE DE MESSAGE === */
.connect-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: linear-gradient(135deg, rgba(30, 50, 80, 0.98) 0%, rgba(20, 35, 60, 0.98) 100%);
    color: #ffe082;
    border: 2px solid #ffe08288;
    border-radius: 16px;
    padding: 16px 32px;
    font-family: 'EB Garamond', serif;
    font-size: 1.1rem;
    box-shadow: 
        0 8px 32px rgba(255, 224, 130, 0.2),
        0 0 20px rgba(127, 216, 255, 0.1);
    backdrop-filter: blur(10px);
    animation: slideDown 0.5s ease-out, fadeIn 0.5s ease-out;
    max-width: 90%;
}

@keyframes slideDown {
    from { top: -50px; }
    to { top: 20px; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* === SLIDER CONTAINER === */
.connect-slider-outer {
    position: relative;
    width: 100%;
    max-width: 1100px;
    height: auto;
    min-height: 580px;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(15, 20, 35, 0.95) 0%, rgba(20, 28, 45, 0.95) 100%);
    border-radius: 24px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(127, 216, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(127, 216, 255, 0.15);
}

.connect-slider-wrapper {
    display: flex;
    width: 200%;
    height: 100%;
    min-height: 580px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === VUE (LOGIN/REGISTER) === */
.connect-view {
    width: 50%;
    height: 100%;
    min-height: 580px;
    display: flex;
    align-items: stretch;
}

/* === SECTION FORMULAIRE === */
.form-section-half {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 35px;
    background: linear-gradient(180deg, rgba(18, 24, 42, 0.98) 0%, rgba(15, 20, 35, 0.98) 100%);
    position: relative;
    overflow-y: auto;
}

.form-section-half::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #7fd8ff, #a084e8, #7fd8ff, transparent);
    opacity: 0.6;
}

/* === WRAPPER DU FORMULAIRE === */
.connect-form-wrapper {
    width: 100%;
    max-width: 380px;
    animation: formAppear 0.6s ease-out;
}

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

.connect-form-wrapper h2 {
    color: #b2eaff;
    text-shadow: 0 0 20px rgba(127, 216, 255, 0.5);
    margin-bottom: 30px;
    font-size: 2.2rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 1px;
    position: relative;
}

.connect-form-wrapper h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #7be9c7, #a084e8);
    margin: 15px auto 0;
    border-radius: 2px;
}

/* === FORMULAIRE === */
.connect-form .form-group {
    margin-bottom: 22px;
}

.connect-form label {
    display: block;
    color: #ffe082;
    font-weight: 500;
    font-size: 1rem;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(255, 224, 130, 0.3);
    transition: color 0.3s ease;
}

.connect-form .form-control {
    width: 100%;
    padding: 14px 18px;
    background: rgba(20, 35, 60, 0.8);
    border: 2px solid rgba(127, 216, 255, 0.2);
    color: #e6e6fa;
    border-radius: 12px;
    font-family: 'EB Garamond', serif;
    font-size: 1.05rem;
    transition: all 0.3s ease;
    outline: none;
}

.connect-form .form-control::placeholder {
    color: rgba(230, 230, 250, 0.4);
}

.connect-form .form-control:hover {
    border-color: rgba(127, 216, 255, 0.4);
    background: rgba(25, 40, 70, 0.85);
}

.connect-form .form-control:focus {
    border-color: #b2eaff;
    box-shadow: 
        0 0 0 4px rgba(127, 216, 255, 0.15),
        0 0 20px rgba(127, 216, 255, 0.2);
    background: rgba(30, 50, 80, 0.9);
    color: #fffbe7;
}

/* === BOUTON PRINCIPAL === */
.connect-form .btn-primary {
    width: 100%;
    padding: 16px 24px;
    margin-top: 10px;
    background: linear-gradient(135deg, #7be9c7 0%, #5ac8b0 50%, #a084e8 100%);
    background-size: 200% 100%;
    border: none;
    color: #1a1833;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.4s ease;
    box-shadow: 
        0 4px 15px rgba(123, 233, 199, 0.3),
        0 0 30px rgba(123, 233, 199, 0.1);
    position: relative;
    overflow: hidden;
}

.connect-form .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.connect-form .btn-primary:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(123, 233, 199, 0.4),
        0 0 40px rgba(160, 132, 232, 0.2);
}

.connect-form .btn-primary:hover::before {
    left: 100%;
}

.connect-form .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(123, 233, 199, 0.3);
}

/* === SECTION IMAGE === */
.image-section-half {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    overflow: hidden;
    min-height: 100%;
}

.image-section-half .panel-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    z-index: 0;
    filter: brightness(0.85) saturate(1.1);
    transition: transform 0.6s ease, filter 0.4s ease;
}

.image-section-half:hover .panel-image {
    transform: scale(1.03);
    filter: brightness(0.9) saturate(1.2);
}

/* Overlay gradient sur l'image */
.image-section-half::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(15, 18, 29, 0.95) 0%, rgba(15, 18, 29, 0.6) 50%, transparent 100%);
    z-index: 1;
    pointer-events: none;
}

/* === BOUTON DE BASCULE === */
.slide-toggle-btn {
    position: relative;
    z-index: 2;
    margin-bottom: 35px;
    padding: 14px 28px;
    font-family: 'EB Garamond', serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffe082 !important;
    background: rgba(20, 35, 60, 0.85);
    border: 2px solid rgba(255, 224, 130, 0.6) !important;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 20px rgba(255, 224, 130, 0.2),
        0 0 30px rgba(255, 224, 130, 0.1);
    backdrop-filter: blur(8px);
}

.slide-toggle-btn:hover {
    background: rgba(255, 224, 130, 0.95);
    color: #1a2a45 !important;
    transform: translateY(-3px);
    box-shadow: 
        0 8px 30px rgba(255, 224, 130, 0.4),
        0 0 40px rgba(255, 224, 130, 0.2);
}

.slide-toggle-btn:active {
    transform: translateY(-1px);
}

/* === FOOTER ACTION (Retour accueil) === */
.connect-action-footer {
    margin-top: 25px;
    padding: 15px;
    text-align: center;
}

.retour-accueil-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-family: 'EB Garamond', serif;
    font-size: 1rem;
    font-weight: 600;
    color: #b2eaff !important;
    background: rgba(20, 35, 60, 0.7);
    border: 2px solid rgba(127, 216, 255, 0.4) !important;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(127, 216, 255, 0.1);
}

.retour-accueil-btn:hover {
    background: rgba(40, 65, 100, 0.9);
    color: #ffe082 !important;
    border-color: #ffe082 !important;
    transform: translateY(-2px);
    box-shadow: 
        0 6px 25px rgba(127, 216, 255, 0.2),
        0 0 20px rgba(255, 224, 130, 0.1);
    text-decoration: none;
}

/* === FOOTER PRINCIPAL === */
.connect-footer {
    background: linear-gradient(180deg, rgba(15, 18, 29, 0.98) 0%, rgba(10, 13, 20, 0.99) 100%) !important;
    color: #b2eaff !important;
    border-top: 1px solid rgba(127, 216, 255, 0.15);
    font-family: 'EB Garamond', serif;
    flex-shrink: 0;
    padding: 20px;
}

.connect-footer p {
    margin: 0;
    opacity: 0.8;
}

/* ================================================================
   RESPONSIVE - TABLETTE (768px - 1024px)
   ================================================================ */
@media (max-width: 1024px) {
    .connect-slider-outer {
        max-width: 95%;
        min-height: 520px;
    }

    .connect-slider-wrapper,
    .connect-view {
        min-height: 520px;
    }

    .form-section-half {
        padding: 35px 28px;
    }

    .connect-form-wrapper h2 {
        font-size: 1.9rem;
    }
}

/* ================================================================
   RESPONSIVE - MOBILE (max 767px)
   ================================================================ */
@media (max-width: 767px) {
    main.connect-page-container {
        padding: 15px;
        min-height: auto;
        justify-content: flex-start;
    }

    .connect-alert {
        position: relative;
        top: 0;
        left: 0;
        transform: none;
        margin-bottom: 15px;
        padding: 12px 20px;
        font-size: 1rem;
    }

    .connect-slider-outer {
        max-width: 100%;
        min-height: auto;
        border-radius: 20px;
        margin: 0;
    }

    .connect-slider-wrapper {
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: auto;
    }

    .connect-view {
        flex-direction: column;
        width: 100%;
        height: auto;
        min-height: auto;
    }

    /* Image en premier sur mobile */
    .image-section-half {
        order: -1;
        width: 100%;
        min-height: 200px;
        max-height: 240px;
    }

    .image-section-half::before {
        height: 60%;
    }

    .slide-toggle-btn {
        margin-bottom: 25px;
        padding: 12px 24px;
        font-size: 0.95rem;
    }

    .form-section-half {
        width: 100%;
        padding: 30px 25px;
        min-height: auto;
    }

    .form-section-half::before {
        display: none;
    }

    .connect-form-wrapper {
        max-width: 100%;
    }

    .connect-form-wrapper h2 {
        font-size: 1.7rem;
        margin-bottom: 25px;
    }

    .connect-form-wrapper h2::after {
        width: 50px;
        margin-top: 12px;
    }

    .connect-form .form-group {
        margin-bottom: 18px;
    }

    .connect-form .form-control {
        padding: 14px 16px;
        font-size: 1rem;
        border-radius: 10px;
        /* Touch-friendly size */
        min-height: 50px;
    }

    .connect-form .btn-primary {
        padding: 16px 20px;
        font-size: 1.1rem;
        border-radius: 10px;
        min-height: 54px;
    }

    .connect-action-footer {
        margin-top: 20px;
        padding: 10px;
    }

    .retour-accueil-btn {
        padding: 12px 24px;
        font-size: 0.95rem;
        width: 100%;
        max-width: 280px;
        justify-content: center;
    }

    .connect-footer {
        padding: 15px;
    }
}

/* ================================================================
   RESPONSIVE - PETIT MOBILE (max 480px)
   ================================================================ */
@media (max-width: 480px) {
    main.connect-page-container {
        padding: 10px;
    }

    .connect-slider-outer {
        border-radius: 16px;
    }

    .image-section-half {
        min-height: 170px;
        max-height: 200px;
    }

    .slide-toggle-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .form-section-half {
        padding: 25px 20px;
    }

    .connect-form-wrapper h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }

    .connect-form label {
        font-size: 0.95rem;
    }

    .connect-form .form-control {
        padding: 12px 14px;
    }

    .connect-form .btn-primary {
        padding: 14px 18px;
        font-size: 1.05rem;
    }
}

/* ================================================================
   RESPONSIVE - TRÈS PETIT MOBILE (max 360px)
   ================================================================ */
@media (max-width: 360px) {
    .connect-slider-outer {
        border-radius: 12px;
    }

    .image-section-half {
        min-height: 140px;
        max-height: 170px;
    }

    .slide-toggle-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .form-section-half {
        padding: 20px 15px;
    }

    .connect-form-wrapper h2 {
        font-size: 1.35rem;
    }

    .connect-form label {
        font-size: 0.9rem;
    }

    .connect-form .form-control {
        padding: 12px;
        font-size: 0.95rem;
    }

    .connect-form .btn-primary {
        padding: 14px 16px;
        font-size: 1rem;
    }

    .retour-accueil-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* ================================================================
   MODE PAYSAGE MOBILE
   ================================================================ */
@media (max-height: 500px) and (orientation: landscape) {
    main.connect-page-container {
        min-height: auto;
        padding: 10px 20px;
    }

    .connect-slider-outer {
        min-height: auto;
    }

    .connect-slider-wrapper {
        min-height: auto;
    }

    .connect-view {
        flex-direction: row;
        min-height: auto;
    }

    .image-section-half {
        order: 0;
        min-height: 300px;
        max-height: none;
    }

    .form-section-half {
        padding: 20px 25px;
    }

    .connect-form-wrapper h2 {
        margin-bottom: 15px;
        font-size: 1.5rem;
    }

    .connect-form .form-group {
        margin-bottom: 12px;
    }
}

/* ================================================================
   ACCESSIBILITÉ & FOCUS
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible pour accessibilité clavier */
.connect-form .form-control:focus-visible,
.slide-toggle-btn:focus-visible,
.retour-accueil-btn:focus-visible,
.connect-form .btn-primary:focus-visible {
    outline: 3px solid #ffe082;
    outline-offset: 2px;
}

/* ================================================================
   DARK MODE PRÉFÉRENCE (si supporté)
   ================================================================ */
@media (prefers-color-scheme: dark) {
    /* Déjà en mode sombre par défaut, pas de changement nécessaire */
}
