* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #2c5530 0%, #4a7c59 50%, #6b8e6b 100%);
    --secondary-gradient: linear-gradient(45deg, #8b7355 0%, #a8927a 100%);
    --tertiary-gradient: linear-gradient(135deg, #d4af37 0%, #f7ef8a 100%);
    --dark-gradient: linear-gradient(135deg, #1a1f2e 0%, #2d3748 50%, #4a5568 100%);
    --glass-bg: rgba(255, 255, 255, 0.98);
    --glass-border: rgba(44, 85, 48, 0.15);
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --accent-color: #2c5530;
    --accent-gold: #d4af37;
    --accent-brown: #8b7355;
    --success-color: #38a169;
    --error-color: #e53e3e;
    --warning-color: #dd6b20;
    --card-shadow: 0 25px 50px rgba(44, 85, 48, 0.12);
}

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    background: var(--dark-gradient);
    color: var(--text-primary);
}

/* Advanced Theme Controls */
.control-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 15px;
    align-items: center;
}

.theme-toggle,
.language-selector,
.accessibility-toggle {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: var(--card-shadow);
}

.theme-toggle:hover,
.language-selector:hover,
.accessibility-toggle:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(44, 85, 48, 0.2);
    border-color: var(--accent-color);
    background: white;
}

/* Enhanced Background */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--dark-gradient);
    z-index: -3;
}

.background::before {
    content: '';
    position: absolute;
    width: 300%;
    height: 300%;
    background:
        radial-gradient(circle at 15% 40%, rgba(44, 85, 48, 0.25) 0%, transparent 45%),
        radial-gradient(circle at 85% 25%, rgba(139, 115, 85, 0.2) 0%, transparent 45%),
        radial-gradient(circle at 50% 75%, rgba(212, 175, 55, 0.15) 0%, transparent 45%),
        radial-gradient(circle at 25% 85%, rgba(26, 31, 46, 0.3) 0%, transparent 45%);
    animation: backgroundShift 20s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(-5%, 5%) scale(1.1);
    }
    50% {
        transform: translate(5%, -5%) scale(1.05);
    }
    75% {
        transform: translate(-3%, -3%) scale(1.08);
    }
}

/* Enhanced Floating Elements with Domotique Icons */
.floating-elements {
    position: fixed;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -2;
}

/* Domotique Icons */
.domotique-icon {
    position: absolute;
    font-size: 2.5rem;
    animation: floatDomotique 20s ease-in-out infinite;
    opacity: 0.1;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.3));
}

/* Smart Home Devices avec couleurs naturelles */
.domotique-icon.thermostat {
    top: 15%;
    left: 8%;
    animation-delay: 0s;
    color: #4a7c59; /* Vert moyen */
}

.domotique-icon.lightbulb {
    top: 25%;
    right: 12%;
    animation-delay: 3s;
    color: #d4af37; /* Or */
}

.domotique-icon.security {
    bottom: 30%;
    left: 15%;
    animation-delay: 6s;
    color: #8b7355; /* Brun */
}

.domotique-icon.camera {
    bottom: 20%;
    right: 18%;
    animation-delay: 9s;
    color: #2c5530; /* Vert forêt */
}

.domotique-icon.energy {
    top: 60%;
    left: 7%;
    animation-delay: 12s;
    color: #f7ef8a; /* Or clair */
}

.domotique-icon.climate {
    top: 45%;
    right: 6%;
    animation-delay: 15s;
    color: #6b8e6b; /* Vert gris */
}

.domotique-icon.automation {
    bottom: 45%;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 18s;
    color: #a8927a; /* Brun clair */
}

.domotique-icon.smartplug {
    top: 12%;
    left: 60%;
    animation-delay: 21s;
    color: #4a7c59; /* Vert */
}

.domotique-icon.voice {
    bottom: 15%;
    left: 35%;
    animation-delay: 24s;
    color: #d4af37; /* Or */
}

.domotique-icon.schedule {
    top: 35%;
    left: 25%;
    animation-delay: 27s;
    color: #8b7355; /* Brun */
}

@keyframes floatDomotique {
    0%, 100% {
        transform: translateY(0px) rotate(0deg) scale(1);
        opacity: 0.08;
    }
    20% {
        transform: translateY(-40px) rotate(8deg) scale(1.1);
        opacity: 0.15;
    }
    40% {
        transform: translateY(-20px) rotate(-5deg) scale(0.95);
        opacity: 0.1;
    }
    60% {
        transform: translateY(-60px) rotate(12deg) scale(1.05);
        opacity: 0.12;
    }
    80% {
        transform: translateY(-30px) rotate(-8deg) scale(0.98);
        opacity: 0.09;
    }
}

/* Original Floating Icons */
.floating-icon {
    position: absolute;
    color: rgba(255, 255, 255, 0.08);
    font-size: 4rem;
    animation: float 12s ease-in-out infinite;
}

.floating-icon:nth-child(1) {
    top: 8%;
    left: 12%;
    animation-delay: 0s;
}

.floating-icon:nth-child(2) {
    top: 25%;
    right: 8%;
    animation-delay: 2s;
}

.floating-icon:nth-child(3) {
    bottom: 35%;
    left: 18%;
    animation-delay: 4s;
}

.floating-icon:nth-child(4) {
    bottom: 15%;
    right: 22%;
    animation-delay: 6s;
}

.floating-icon:nth-child(5) {
    top: 45%;
    left: 5%;
    animation-delay: 8s;
}

.floating-icon:nth-child(6) {
    top: 65%;
    right: 5%;
    animation-delay: 10s;
}

.floating-icon:nth-child(7) {
    bottom: 45%;
    left: 45%;
    animation-delay: 1s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg) scale(1);
        opacity: 0.06;
    }
    20% {
        transform: translateY(-40px) rotate(8deg) scale(1.15);
        opacity: 0.12;
    }
    40% {
        transform: translateY(-20px) rotate(-5deg) scale(0.9);
        opacity: 0.08;
    }
    60% {
        transform: translateY(-60px) rotate(12deg) scale(1.1);
        opacity: 0.1;
    }
    80% {
        transform: translateY(-30px) rotate(-8deg) scale(0.95);
        opacity: 0.07;
    }
}

/* Geometric Shapes */
.floating-elements::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 60%;
    width: 200px;
    height: 200px;
    background: linear-gradient(45deg, rgba(44, 85, 48, 0.1), rgba(139, 115, 85, 0.15));
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: morphShape 15s ease-in-out infinite;
}

@keyframes morphShape {
    0%, 100% {
        border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
        transform: rotate(0deg);
    }
    25% {
        border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
        transform: rotate(90deg);
    }
    50% {
        border-radius: 50% 50% 33% 67% / 55% 58% 42% 45%;
        transform: rotate(180deg);
    }
    75% {
        border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
        transform: rotate(270deg);
    }
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 30px 20px;
    position: relative;
    z-index: 10;
}

.signup-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border-radius: 35px;
    padding: 50px 40px;
    box-shadow:
        var(--card-shadow),
        0 0 0 1px var(--glass-border),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    width: 100%;
    max-width: 520px;
    animation: cardFloat 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--glass-border);
}

.signup-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--tertiary-gradient); /* Ligne dorée en haut */
    opacity: 0.9;
    border-radius: 35px 35px 0 0;
}

.signup-card::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(44, 85, 48, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes cardFloat {
    0% {
        opacity: 0;
        transform: translateY(60px) scale(0.8) rotateX(20deg);
        filter: blur(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotateX(0deg);
        filter: blur(0px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.08;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.12;
    }
}

.logo-section {
    text-align: center;
    margin-bottom: 45px;
    animation: logoSlide 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
    position: relative;
    z-index: 1;
}

@keyframes logoSlide {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.7);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0px);
    }
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 110px;
    height: 110px;
    background: var(--primary-gradient); /* Vert forêt */
    border-radius: 28px;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
    animation: logoGlow 4s ease-in-out infinite alternate;
    box-shadow: 0 20px 40px rgba(44, 85, 48, 0.25);
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
    animation: shine 3s linear infinite;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--tertiary-gradient); /* Effet doré */
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.logo-icon:hover::after {
    opacity: 0.1;
}

@keyframes shine {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

@keyframes logoGlow {
    0% {
        box-shadow: 0 0 40px rgba(44, 85, 48, 0.3);
        transform: scale(1) rotate(0deg);
    }
    100% {
        box-shadow: 0 0 60px rgba(74, 124, 89, 0.4);
        transform: scale(1.05) rotate(2deg);
    }
}

.logo-icon i {
    font-size: 3rem;
    color: white;
    z-index: 1;
    position: relative;
    animation: iconBounce 2s ease-in-out infinite alternate;
}

@keyframes iconBounce {
    0% {
        transform: translateY(0) scale(1);
    }
    100% {
        transform: translateY(-3px) scale(1.05);
    }
}

.logo-text {
    font-size: 3.2rem;
    font-weight: 900;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 15px;
    letter-spacing: -2px;
    text-shadow: 0 0 30px rgba(44, 85, 48, 0.2);
}

.logo-subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* Enhanced Error and Success Messages */
.error-message,
.success-message {
    padding: 20px;
    border-radius: 18px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    animation: messageSlide 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: none;
    align-items: center;
    gap: 15px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    background-color: white;
}

.error-message::before,
.success-message::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 0 18px 18px 0;
}

.error-message {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.08), rgba(229, 62, 62, 0.04));
    border: 1px solid rgba(229, 62, 62, 0.2);
    color: var(--error-color);
}

.error-message::before {
    background: var(--error-color);
}

.success-message {
    background: linear-gradient(135deg, rgba(56, 161, 105, 0.08), rgba(56, 161, 105, 0.04));
    border: 1px solid rgba(56, 161, 105, 0.2);
    color: var(--success-color);
}

.success-message::before {
    background: var(--success-color);
}

@keyframes messageSlide {
    0% {
        opacity: 0;
        transform: translateX(-30px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Enhanced Form Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.form-group {
    animation: formSlide 0.8s cubic-bezier(0.4, 0, 0.2, 1) both;
    position: relative;
}

.form-group:nth-child(1) {
    animation-delay: 0.8s;
}

.form-group:nth-child(2) {
    animation-delay: 1s;
}

.form-group:nth-child(3) {
    animation-delay: 1.2s;
}

.form-group:nth-child(4) {
    animation-delay: 1.4s;
}

.form-group:nth-child(5) {
    animation-delay: 1.6s;
}

.full-width {
    grid-column: 1 / -1;
}

@keyframes formSlide {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    letter-spacing: 0.3px;
    position: relative;
}

.input-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
}

.form-input {
    width: 100%;
    padding: 22px 65px 22px 22px;
    border: 2px solid rgba(44, 85, 48, 0.15);
    border-radius: 16px;
    font-size: 1.1rem;
    background: white;
    color: var(--text-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.03);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.form-input:focus {
    border-color: var(--accent-color);
    background: white;
    transform: translateY(-3px);
    box-shadow:
        0 20px 40px rgba(44, 85, 48, 0.15),
        0 10px 20px rgba(0, 0, 0, 0.05);
}

.form-input:valid:not(:placeholder-shown) {
    border-color: var(--success-color);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: var(--error-color);
}

.input-wrapper i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}

.input-wrapper i:first-of-type {
    right: 22px;
}

.form-input:focus+i,
.form-input:focus~i:not(.password-toggle) {
    color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.password-toggle {
    right: 22px !important;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.password-toggle:hover {
    background: rgba(44, 85, 48, 0.1);
    transform: translateY(-50%) scale(1.2);
}

/* Enhanced Password Strength Indicator */
.password-strength {
    height: 4px;
    background: rgba(44, 85, 48, 0.1);
    border-radius: 2px;
    margin-top: 12px;
    overflow: hidden;
    position: relative;
}

.strength-bar {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.strength-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: strengthShine 2s infinite;
}

@keyframes strengthShine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.strength-text {
    margin-top: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.3s ease;
    color: var(--text-secondary);
}

.error-text {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 8px;
    display: block;
    animation: errorShake 0.5s ease-in-out;
}

@keyframes errorShake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Enhanced Submit Button */
.signup-btn {
    width: 100%;
    padding: 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: buttonSlide 1s cubic-bezier(0.4, 0, 0.2, 1) 1.8s both;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 20px;
    box-shadow: 0 15px 35px rgba(44, 85, 48, 0.25);
}

.signup-btn::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.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.signup-btn::after {
    content: '';
    position: absolute;
    inset: 2px;
    background: var(--tertiary-gradient);
    border-radius: 16px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.signup-btn:hover {
    transform: translateY(-5px);
    box-shadow:
        0 25px 50px rgba(44, 85, 48, 0.35),
        0 0 40px rgba(212, 175, 55, 0.2);
}

.signup-btn:hover::before {
    left: 100%;
}

.signup-btn:hover::after {
    opacity: 0.1;
}

.signup-btn:active {
    transform: translateY(-2px);
}

@keyframes buttonSlide {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced Login Link */
.login-link {
    text-align: center;
    margin-top: 35px;
    color: var(--text-secondary);
    animation: linkSlide 1s cubic-bezier(0.4, 0, 0.2, 1) 2s both;
    font-size: 1rem;
}

.login-link a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
    position: relative;
    padding: 5px 0;
}

.login-link a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-link a:hover::after {
    width: 100%;
}

@keyframes linkSlide {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading Animation */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    border: 3px solid transparent;
    border-top: 3px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .control-panel {
        top: 15px;
        right: 15px;
        gap: 10px;
    }

    .signup-card {
        padding: 35px 25px;
        margin: 15px;
        border-radius: 25px;
    }

    .logo-text {
        font-size: 2.4rem;
    }

    .logo-icon {
        width: 90px;
        height: 90px;
    }

    .form-input {
        padding: 18px 55px 18px 18px;
        font-size: 1rem;
    }

    /* Hide some domotique icons on mobile for better performance */
    .domotique-icon:nth-child(n+6) {
        display: none;
    }
}

@media (max-width: 480px) {
    .control-panel {
        position: relative;
        top: auto;
        right: auto;
        justify-content: center;
        margin-bottom: 20px;
    }

    .container {
        padding: 15px 10px;
    }

    .signup-card {
        padding: 25px 20px;
    }

    /* Hide more domotique icons on very small screens */
    .domotique-icon:nth-child(n+4) {
        display: none;
    }
}