
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Couleurs Cotonou */
    --color-primary: #004B70;
    --color-primary-light: #006494;
    --color-secondary: #96D0EE;
    --color-text: #454b4e;
    --color-text-light: #6b7280;
    
    /* Couleurs drapeau béninois */
    --flag-green: #009E60;
    --flag-yellow: #FCD116;
    --flag-red: #E8112D;
    
    /* Autres */
    --bg-light: #f8fbfd;
    --white: #ffffff;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   BANDES TRICOLORES
======================================== */
.flag-strip {
    width: 100%;
    height: 9px;
    display: flex;
    flex-shrink: 0;
    z-index: 100;
}

.flag-strip-top {
    position: fixed;
    top: 0;
    left: 0;
}

.flag-strip-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
}

.flag-color {
    flex: 1;
}

.flag-color.green {
    background-color: var(--flag-green);
}

.flag-color.yellow {
    background-color: var(--flag-yellow);
}

.flag-color.red {
    background-color: var(--flag-red);
}

/* ========================================
   CONTENU PRINCIPAL AVEC DÉGRADÉ
======================================== */
.main-content {
    flex-grow: 1;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, 
        #00172d 0%,
        #003a5d 25%,
        #006494 50%,
        #96D0EE 75%,
        #e6f7ff 100%
    );
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* Animation du dégradé */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 75, 112, 0.03) 0%, rgba(150, 208, 238, 0.05) 100%);
    pointer-events: none;
}

/* ========================================
   ÉLÉMENTS DÉCORATIFS
======================================== */
.decorative-elements {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.bubble {
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, 
        rgba(255, 255, 255, 0.15) 0%, 
        rgba(150, 208, 238, 0.1) 30%,
        rgba(0, 75, 112, 0.05) 70%
    );
    filter: blur(50px);
    animation: floatBubble 25s ease-in-out infinite;
}

.bubble:nth-child(2) {
    animation-delay: 2s;
}

.bubble:nth-child(3) {
    animation-delay: 4s;
}

.bubble:nth-child(4) {
    animation-delay: 1s;
}

.bubble:nth-child(5) {
    animation-delay: 3s;
}

.bubble:nth-child(6) {
    animation-delay: 5s;
}

/* ========================================
   HEADER AVEC LOGO ET TEXTE CENTRÉS
======================================== */
.header {
    position: relative;
    padding: 1rem 1rem 0;
    z-index: 10;
}

/* Conteneur du logo centré */
.logo-container.centered {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInUp 0.7s ease forwards;
}

.logo-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #004B70 0%, #0077B6 100%);
    box-shadow: 0 8px 24px rgba(0, 75, 112, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.logo-fallback {
    color: white;
    font-size: 2rem;
    font-weight: bold;
    display: none;
}

/* Si l'image ne charge pas, afficher le fallback */
.logo-img[src=""] + .logo-fallback,
.logo-img:not([src]) + .logo-fallback {
    display: block;
}

/* Texte du header centré */
.header-text.centered {
    text-align: center;
    opacity: 0;
    transform: translateY(-15px);
    animation: fadeInUp 0.7s ease forwards 0.2s;
}

.header-title {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 0%, #96D0EE 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.header-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ========================================
   CONTENU CENTRAL
======================================== */
.central-content {
    position: relative;
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    z-index: 10;
}

.content-wrapper {
    width: 100%;
    max-width: 1280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

/* ========================================
   IMAGE TPE
======================================== */
.tpe-container {
    flex: 1;
    display: flex;
    justify-content: center;
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
    animation: slideInLeft 1s ease forwards 0.3s;
}

.tpe-device-wrapper {
    position: relative;
}

.tpe-image {
    width: 100%;
    max-width: 280px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(0, 75, 112, 0.3));
    animation: elegantFloat 6s ease-in-out infinite, deviceGlow 4s ease-in-out infinite;
}

/* Appareil TPE de secours si l'image n'existe pas */
.tpe-device-fallback {
    position: relative;
    width: 280px;
    height: 380px;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 75, 112, 0.4);
    animation: elegantFloat 6s ease-in-out infinite, deviceGlow 4s ease-in-out infinite;
    display: none;
}

.tpe-image[src=""] ~ .tpe-device-fallback,
.tpe-image:not([src]) ~ .tpe-device-fallback {
    display: block;
}

.tpe-screen {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    height: 45%;
    background: linear-gradient(180deg, #96D0EE 0%, #004B70 100%);
    border-radius: 0.5rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tpe-icon {
    width: 4rem;
    height: 4rem;
    color: white;
    opacity: 0.8;
}

.tpe-keyboard {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 75%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.25rem;
}

.tpe-key {
    aspect-ratio: 1;
    background: linear-gradient(145deg, #3a3a3a, #2a2a2a);
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tpe-reflection {
    position: absolute;
    bottom: -0.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    height: 20px;
    background: radial-gradient(ellipse, rgba(0, 75, 112, 0.2) 0%, transparent 70%);
    filter: blur(8px);
    animation: pulseReflection 4s ease-in-out infinite;
}

/* ========================================
   FORMULAIRE AVEC ICÔNES
======================================== */
.form-container {
    flex: 1;
    display: flex;
    justify-content: center;
    width: 100%;
    opacity: 0;
    transform: translateX(30px) scale(0.95);
    animation: slideInRight 1s ease forwards 0.5s;
}

.form-card {
    width: 100%;
    max-width: 28rem;
    padding: 2rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 20px 60px rgba(0, 75, 112, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.1) inset,
        0 0 30px rgba(150, 208, 238, 0.4);
}

.form-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.form-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--color-primary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.form-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.form-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group.with-icon {
    position: relative;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-primary);
    z-index: 10;
}

.input-icon svg {
    width: 100%;
    height: 100%;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-text-light);
    transition: color 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--color-primary);
}

.password-toggle svg {
    width: 100%;
    height: 100%;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--color-secondary);
    border-radius: 0.5rem;
    background-color: white;
    color: var(--color-text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 75, 112, 0.08);
    transition: all 0.3s ease;
}

.form-group.with-icon .form-input {
    padding-left: 3rem;
    padding-right: 3rem;
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 
        0 0 0 3px rgba(0, 75, 112, 0.1),
        0 4px 12px rgba(0, 75, 112, 0.15);
}

.btn-submit {
    width: 100%;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, 
        #004B70 0%, 
        #0077B6 50%, 
        #0096c7 100%
    );
    color: white;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 75, 112, 0.35);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn-submit::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.6s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 75, 112, 0.45);
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:active {
    transform: translateY(0);
}

.btn-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.btn-icon svg {
    width: 100%;
    height: 100%;
}

.form-footer {
    text-align: center;
    padding-top: 0.5rem;
}

.forgot-password {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
}

.forgot-password:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ========================================
   FOOTER
======================================== */
.footer {
    position: relative;
    padding: 1.5rem 1rem;
    z-index: 10;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.7s ease forwards 0.7s;
}

.footer-copyright {
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.footer-version {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes elegantFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-12px) rotate(1deg);
    }
    50% {
        transform: translateY(-8px) rotate(-0.5deg);
    }
    75% {
        transform: translateY(-10px) rotate(0.5deg);
    }
}

@keyframes deviceGlow {
    0%, 100% {
        filter: drop-shadow(0 10px 30px rgba(0, 75, 112, 0.3));
    }
    50% {
        filter: drop-shadow(0 15px 40px rgba(150, 208, 238, 0.5));
    }
}

@keyframes pulseReflection {
    0%, 100% {
        opacity: 0.5;
        transform: translateX(-50%) scaleX(1);
    }
    50% {
        opacity: 0.7;
        transform: translateX(-50%) scaleX(1.1);
    }
}

@keyframes floatBubble {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.3;
    }
    33% {
        transform: translate(30px, -30px) scale(1.1);
        opacity: 0.4;
    }
    66% {
        transform: translate(-20px, 20px) scale(0.9);
        opacity: 0.25;
    }
}

/* ========================================
   RESPONSIVE
======================================== */
@media (min-width: 640px) {
    .logo-circle {
        width: 100px;
        height: 100px;
    }
    
    .header-title {
        font-size: 2rem;
    }
    
    .header-subtitle {
        font-size: 1.2rem;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    .form-subtitle {
        font-size: 1rem;
    }
    
    .footer-copyright {
        font-size: 1rem;
    }
    
    .footer-version {
        font-size: 0.875rem;
        display: inline;
    }
    
    .footer-content {
        flex-direction: row;
    }
}

@media (min-width: 1024px) {
    .content-wrapper {
        flex-direction: row;
        gap: 3rem;
    }
    
    .tpe-container {
        order: 1;
    }
    
    .form-container {
        order: 2;
    }
}

@media (max-width: 768px) {
    .header-title {
        font-size: 1.5rem;
    }
    
    .header-subtitle {
        font-size: 1rem;
    }
    
    .form-card {
        padding: 1.5rem;
    }
}

@media (max-width: 1023px) {
    .tpe-container {
        order: 2;
    }
    
    .form-container {
        order: 1;
    }
    
    .tpe-image,
    .tpe-device-fallback {
        max-width: 200px;
        height: 280px;
    }
    
    .tpe-reflection {
        width: 180px;
    }
}

@media (max-width: 480px) {
    .logo-circle {
        width: 80px;
        height: 80px;
    }
    
    .header-title {
        font-size: 1.3rem;
    }
    
    .header-subtitle {
        font-size: 0.9rem;
    }
    
    .form-title {
        font-size: 1.1rem;
    }
}