:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --secondary-color: #f8f9fa;
    --text-color: #333;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
}

body {
    background: linear-gradient(135deg, #f5f7fa, #e4e7eb);
    color: var(--text-color);
    min-height: 100vh;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: center;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    border: none;
    width: 100vw;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

/* Optimisations PWA Mobile pour page de connexion */
@media screen and (display-mode: standalone) {
    body {
        background: #ffffff;
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Détection iOS spécifique pour connexion */
@supports (-webkit-touch-callout: none) {
    @media screen and (display-mode: standalone) {
        body {
            background: #ffffff;
            padding-top: 0;
        }
    }
}

header {
    width: 100vw;
    height: 11vh;
    display: flex;
    padding: 0 2vw;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
}

#title {
    width: 35vw;
    font-size: xx-large;
    text-align: left;
}

#title a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
}

#nav {
    display: flex;
    justify-content: flex-end;
    width: 40vw;
    align-items: center;
    margin: 0;
}

#nav li {
    margin: 0 2vw;
    list-style: none;
}

#nav li a {
    padding: 8px 16px;
    font-size: large;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    border-radius: 8px;
}

#nav li a:hover {
    background-color: rgba(99, 102, 241, 0.08);
}

#username {
    font-size: larger;
    padding: 1.3vh 1.3vh;
    color: var(--primary-color);
    font-weight: 600;
}

/* Form styling */
.formContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

h1.form {
    margin-top: 15vh;
    font-weight: 300;
    text-transform: uppercase;
    color: var(--primary-color);
    letter-spacing: 1px;
    font-family: 'Montserrat', sans-serif;
}

/* Optimisations inputs mobile */
input, textarea, select {
    font-size: 16px !important; /* Évite le zoom automatique iOS */
    border-radius: 8px;
}

/* Responsive design pour mobile */
@media (max-width: 576px) {
    .formContainer {
        padding: 1rem;
    }
    
    h1.form {
        margin-top: 10vh;
        font-size: 1.5rem;
    }
    
    .glass-form {
        width: 100%;
        max-width: 350px;
    }
}

/* Flash messages styling */
.flash-messages {
    width: 400px;
    max-width: 90%;
    margin: 1rem auto;
}

.flash-messages .alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-weight: 500;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    animation: slideInDown 0.3s ease-out;
}

.flash-messages .alert-danger {
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border-left: 4px solid #dc3545;
}

.flash-messages .alert-success {
    background: rgba(40, 167, 69, 0.9);
    color: white;
    border-left: 4px solid #28a745;
}

.flash-messages .alert-info {
    background: rgba(23, 162, 184, 0.9);
    color: white;
    border-left: 4px solid #17a2b8;
}

.flash-messages .alert i {
    margin-right: 0.5rem;
}

.flash-messages .btn-close {
    filter: brightness(0) invert(1);
    opacity: 0.8;
}

.flash-messages .btn-close:hover {
    opacity: 1;
}

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

form {
    font-size: large;
    color: var(--text-color);
    width: 400px;
    max-width: 90%;
    margin: auto;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    padding: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

form:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

label {
    color: var(--text-color);
    background-color: transparent;
    font-weight: 500;
}

form .form-control {
    background-color: rgba(255, 255, 255, 0.5);
    color: var(--text-color);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
}

form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
    background-color: rgba(255, 255, 255, 0.8);
}

.form-floating>.form-control {
    padding: 1.5rem 0.75rem;
}

.form-floating>label {
    padding: 1rem 0.75rem;
}

.submit {
    padding: 12px 24px;
    font-size: 1rem;
    border: none;
    color: white;
    font-weight: 500;
    border-radius: 8px;
    background-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 1rem;
}

.submit:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(99, 102, 241, 0.3);
}

.submit:active {
    transform: translateY(0);
}

#signupInvitation a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 500;
    transition: all 0.2s ease;
}

#signupInvitation a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    form {
        width: 90%;
        padding: 20px;
    }

    header {
        flex-direction: column;
        height: auto;
        padding: 1rem;
    }

    #title,
    #nav {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    #nav {
        margin-top: 1rem;
    }
}