:root {
    --primary: #3F3D56;
    --primary-rgb: 63, 61, 86;
    --primary-dark: #2E2C40;
    --secondary: #1E1E1E;
    --secondary-rgb: 30, 30, 30;
    --secondary-light: #282828;
    --accent: #5A5A89;
    --accent-rgb: 90, 90, 137;
    --accent-dark: #484872;
    --bg: #F0F0F5;
    --text: #5A5A89;
    --shadow-color: rgba(63, 61, 86, 0.2);
    --shadow-hover: rgba(63, 61, 86, 0.4);
    --white: #FFFFFF;
    --black: #000000;
    --black-rgb: 0, 0, 0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Space Grotesk', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header et navigation */
header {
    position: static;
    top: 0;
    width: 100%;
    background: rgba(63, 61, 86, 0.8);
    padding: 1rem 2rem;
    z-index: 100;
    margin-bottom: 2rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: "Orbitron", sans-serif;
    font-size: 1.5rem;
    color: var(--white);
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.nav-links li {
    display: flex;
    align-items: center;
}

.nav-links li a {
    color: var(--white);
    text-decoration: none;
    font-size: 1rem;
    font-family: "Space Grotesk", sans-serif;
    transition: color 0.3s ease;
    padding: 5px 10px;
}

.nav-links li a:hover {
    background-color: rgba(255, 255, 255, 0.103);
    border-radius: 20px;
}

/* User menu */
.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.user-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    min-width: 220px;
    margin-top: 1rem;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.user-dropdown.show {
    opacity: 1;
    transform: translateY(0);
}

.user-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: var(--bg);
}

.user-avatar {
    font-size: 2.5rem;
    margin-right: 1rem;
    color: var(--primary);
}

.user-details {
    line-height: 1.4;
}

.user-name {
    font-weight: 600;
    display: block;
    color: var(--primary);
}

.user-role {
    font-size: 0.8rem;
    color: var(--accent);
}

.dropdown-divider {
    border-top: 1px solid rgba(0,0,0,0.1);
}

.dropdown-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    color: var(--accent) !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background: var(--bg);
}

.dropdown-item i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
}

.login-icon {
    padding: 0.5rem;
    transition: all 0.3s ease;
}

.login-icon:hover {
    background: rgba(255,255,255,0.15);
}

/* Main content */
main {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Styles pour le conteneur de connexion */
.login-container {
    max-width: 400px;
    width: 100%;
    margin: 3rem auto;
    padding: 2rem;
    background: linear-gradient(to bottom right, var(--bg), var(--white));
    border: 3px solid var(--primary);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Animation de retournement */
.form-wrapper {
    perspective: 1000px;
    min-height: 300px;
}

.form-inner {
    position: relative;
    width: 100%;
    min-height: 300px;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.form-front, .form-back {
    backface-visibility: hidden;
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 1rem;
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.form-front {
    transform: rotateY(0deg);
}

.form-back {
    transform: rotateY(180deg);
}

.form-inner.flipped {
    transform: rotateY(180deg);
}

/* Styles des formulaires */
form {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
}

h2 {
    font-family: 'Orbitron', sans-serif;
    color: var(--primary);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    text-transform: uppercase;
}

input {
    border: 2px solid var(--accent);
    border-radius: 5px;
    padding: 0.8rem;
    margin: 0.5rem 0;
    font-family: 'Space Grotesk', sans-serif;
    width: 100%;
    transition: border-color 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

.password-container {
    position: relative;
    width: 100%;
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--accent);
    z-index: 10;
    background: none;
    border: none;
    padding: 0.5rem;
}

.action {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: 0.8rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
    width: 100%;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: bold;
    margin-top: 0.5rem;
}

.action:hover {
    background: var(--accent);
}

.toggle-message {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.toggle-message span {
    color: var(--primary);
    cursor: pointer;
    font-weight: bold;
    transition: color 0.3s ease;
}

.toggle-message span:hover {
    color: var(--accent);
}

.toast-error {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #e74c3c;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    z-index: 9999;
}

.toast-error.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #2ecc71; /* vert pour le succès */
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    z-index: 9999;
}

.toast-success.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Footer */
footer {
    background: var(--primary);
    text-align: center;
    padding: 1rem;
    color: var(--white);
    font-size: 0.9rem;
}

/* Hamburger menu */
.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--white);
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .hamburger {
        display: block;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px;
        left: 0;
        background: var(--primary);
        padding: 1rem;
        z-index: 1000;
    }
    .nav-links.show {
        display: flex;
    }
    .nav-links li {
        width: 100%;
        justify-content: center;
        margin: 0.5rem 0;
    }
    .login-container {
        margin: 1rem;
        padding: 1rem;
    }
    .form-inner {
        min-height: 400px;
    }
    input, .action {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    h2 {
        font-size: 1.5rem;
    }
    .toggle-message {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.2rem;
    }
    .hamburger {
        font-size: 1.2rem;
    }
    .nav-links li a {
        font-size: 0.9rem;
    }
    .login-container {
        padding: 0.5rem;
    }
    input, .action {
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    h2 {
        font-size: 1.2rem;
    }
    .toggle-message {
        font-size: 0.7rem;
    }
}