/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    background-image: url("/static/backlogin.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    overflow: hidden;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Overlay sombre pour assombrir le fond */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 0;
    pointer-events: none;
}

/* ============================================
   HEADER
   ============================================ */
header {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    width: 100%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.menu, .nav {
    background: none !important;
    box-shadow: none !important;
}

.menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.menu .image {
    width: 45px;
    height: 45px;
    object-fit: contain;
    transition: transform 0.5s cubic-bezier(0.4, 2, 0.6, 1);
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.menu .image:hover {
    transform: rotate(360deg) scale(1.1);
}

header h1 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.2rem, 4vw, 2.1rem);
    color: #fff;
    margin: 0;
    letter-spacing: 1px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    max-height: 100vh;
    width: 100%;
    position: relative;
    z-index: 2;
    padding: 80px 20px 20px;
    overflow: hidden;
    box-sizing: border-box;
}

/* ============================================
   CONTAINER & FORM
   ============================================ */
#container {
    width: 100%;
    max-width: 500px;
    padding: 0;
    margin: 0 auto;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

form {
    width: 100%;
    padding: clamp(20px, 3vh, 32px) clamp(20px, 3vw, 28px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    color: #222;
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vh, 18px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
#container h1 {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    padding-bottom: clamp(5px, 1vh, 10px);
    text-align: center;
    color: #222;
    margin-bottom: clamp(5px, 1vh, 10px);
    font-weight: 700;
    flex-shrink: 0;
}

#container h2 {
    font-family: 'Poppins', sans-serif;
    text-align: center;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    margin-top: clamp(5px, 1vh, 8px);
    color: #555;
    font-weight: 400;
    flex-shrink: 0;
}

h3, h5 {
    color: #fff;
    z-index: 2;
    font-family: 'Poppins', sans-serif;
}

.accroche-mobile {
    display: none;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
label {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    font-weight: 500;
    color: #333;
    margin-bottom: clamp(4px, 0.8vh, 6px);
    display: block;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    background: #f8f9fa;
    color: #222;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.2vw, 0.95rem);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: clamp(10px, 2vh, 12px) clamp(12px, 2vw, 14px);
    width: 100%;
    transition: all 0.3s ease;
    outline: none;
    box-sizing: border-box;
    flex-shrink: 0;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: #dd1818;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(221, 24, 24, 0.1);
}

input[type="submit"] {
    font-family: 'Poppins', sans-serif;
    color: #fff;
    background: linear-gradient(135deg, #dd1818 0%, #b81515 100%);
    padding: clamp(10px, 2vh, 12px) clamp(20px, 3vw, 22px);
    margin-top: clamp(5px, 1vh, 8px);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-size: clamp(0.9rem, 2.2vw, 1rem);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(221, 24, 24, 0.3);
    flex-shrink: 0;
}

input[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(221, 24, 24, 0.4);
    background: linear-gradient(135deg, #e62020 0%, #c41e3a 100%);
}

input[type="submit"]:active {
    transform: translateY(0);
}

.link {
    color: #dd1818;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.link:hover {
    color: #b81515;
    text-decoration: underline;
}

.error {
    background: #fee;
    color: #c33;
    padding: clamp(8px, 1.5vh, 10px) clamp(12px, 2vw, 14px);
    border-radius: 8px;
    border-left: 4px solid #c33;
    font-size: clamp(0.8rem, 2vw, 0.85rem);
    margin: clamp(5px, 1vh, 8px) 0;
    flex-shrink: 0;
}

/* ============================================
   RESPONSIVE - GRAND ÉCRAN
   ============================================ */
@media screen and (min-width: 901px) {
    .main-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 80px 60px 20px;
        max-height: 100vh;
    }

    .accroche-mobile {
        display: block !important;
        position: absolute;
        left: 60px;
        top: 50%;
        transform: translateY(-50%);
        font-size: clamp(1.3rem, 2.5vw, 1.8rem);
        color: white;
        background: rgba(0, 0, 0, 0.4);
        backdrop-filter: blur(10px);
        border-radius: 16px;
        padding: clamp(18px, 3vh, 24px) clamp(24px, 3vw, 32px);
        max-width: 450px;
        text-align: justify;
        line-height: 1.5;
        z-index: 2;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
        max-height: 80vh;
        overflow-y: auto;
    }

    .accroche-courte {
        display: none;
    }

    #container {
        position: absolute;
        right: 60px;
        top: 50%;
        transform: translateY(-50%);
        max-width: 480px;
    }

    form {
        padding: clamp(28px, 4vh, 36px) clamp(32px, 4vw, 40px);
        max-height: calc(100vh - 120px);
    }
}

/* ============================================
   RESPONSIVE - TABLETTE
   ============================================ */
@media screen and (max-width: 900px) and (min-width: 601px) {
    .main-content {
        padding: 80px 30px 20px;
        max-height: 100vh;
    }

    #container {
        max-width: 480px;
    }

    form {
        padding: clamp(24px, 3.5vh, 32px) clamp(24px, 3vw, 28px);
        max-height: calc(100vh - 120px);
    }

    .accroche-mobile {
        display: none !important;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media screen and (max-width: 600px) {
    html, body {
        overflow: hidden;
        height: 100vh;
    }

    header {
        padding: 10px 15px;
    }

    .menu .image {
        width: 36px;
        height: 36px;
    }

    header h1 {
        font-size: 1.2rem;
    }

    .main-content {
        padding: 70px 15px 15px;
        min-height: 100vh;
        max-height: 100vh;
        overflow: hidden;
    }

    #container {
        width: 100%;
        max-width: 100%;
    }

    form {
        padding: clamp(20px, 3vh, 24px) clamp(16px, 3vw, 20px);
        border-radius: 20px;
        gap: clamp(10px, 2vh, 14px);
        max-height: calc(100vh - 100px);
    }

    #container h1 {
        font-size: clamp(1.2rem, 4vw, 1.4rem);
        margin-bottom: clamp(4px, 1vh, 6px);
    }

    label {
        font-size: clamp(0.8rem, 2vw, 0.9rem);
        margin-bottom: clamp(3px, 0.8vh, 5px);
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        font-size: clamp(0.85rem, 2vw, 0.95rem);
        padding: clamp(10px, 2vh, 12px) clamp(10px, 2vw, 12px);
    }

    input[type="submit"] {
        font-size: clamp(0.9rem, 2vw, 1rem);
        padding: clamp(10px, 2vh, 12px) clamp(18px, 3vw, 20px);
        margin-top: clamp(4px, 1vh, 6px);
    }

    #container h2 {
        font-size: clamp(0.75rem, 2vw, 0.85rem);
    }

    .error {
        font-size: clamp(0.75rem, 2vw, 0.85rem);
        padding: clamp(8px, 1.5vh, 10px) clamp(10px, 2vw, 12px);
    }

    .accroche-mobile {
        display: none !important;
    }
}

/* ============================================
   RESPONSIVE - TRÈS PETIT MOBILE
   ============================================ */
@media screen and (max-width: 430px) {
    header {
        padding: 8px 12px;
    }

    .menu .image {
        width: 32px;
        height: 32px;
    }

    header h1 {
        font-size: 1.1rem;
    }

    .main-content {
        padding: 65px 12px 12px;
        max-height: 100vh;
    }

    form {
        padding: clamp(18px, 2.5vh, 20px) clamp(14px, 2.5vw, 16px);
        border-radius: 16px;
        gap: clamp(10px, 1.5vh, 12px);
        max-height: calc(100vh - 90px);
    }

    #container h1 {
        font-size: clamp(1.1rem, 3.5vw, 1.3rem);
    }

    label {
        font-size: clamp(0.8rem, 2vw, 0.85rem);
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        font-size: clamp(0.85rem, 2vw, 0.9rem);
        padding: clamp(8px, 1.5vh, 10px) clamp(10px, 2vw, 12px);
    }

    input[type="submit"] {
        font-size: clamp(0.85rem, 2vw, 0.9rem);
        padding: clamp(8px, 1.5vh, 10px) clamp(16px, 2.5vw, 18px);
    }
}

/* ============================================
   RESPONSIVE - HAUTEUR LIMITÉE
   ============================================ */
@media screen and (max-height: 700px) {
    .main-content {
        padding: 70px 20px 15px;
    }

    form {
        padding: clamp(16px, 2.5vh, 20px) clamp(16px, 2.5vw, 20px);
        max-height: calc(100vh - 100px);
        gap: clamp(8px, 1.5vh, 12px);
    }

    #container h1 {
        font-size: clamp(1.1rem, 3vw, 1.3rem);
        margin-bottom: clamp(4px, 1vh, 6px);
    }

    label {
        font-size: clamp(0.8rem, 2vw, 0.85rem);
        margin-bottom: clamp(3px, 0.8vh, 4px);
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        padding: clamp(8px, 1.5vh, 10px) clamp(10px, 2vw, 12px);
        font-size: clamp(0.85rem, 2vw, 0.9rem);
    }

    input[type="submit"] {
        padding: clamp(8px, 1.5vh, 10px) clamp(16px, 2.5vw, 18px);
        font-size: clamp(0.85rem, 2vw, 0.9rem);
    }

    #container h2 {
        font-size: clamp(0.75rem, 2vw, 0.8rem);
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

form {
    animation: fadeIn 0.5s ease-out;
}
