/* --- Variables Thème Harmonisé avec Collection --- */
:root {
    --primary: #2ecc71;
    --primary-glow: rgba(46, 204, 113, 0.4);
    --bg: #1e293b;
    --card-bg: #334155;
    --input-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --radius-lg: 24px;
    --radius-md: 16px;
}

/* --- Base & Global --- */
html {
    box-sizing: border-box;
}

*, *:before, *:after {
    box-sizing: inherit;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(300deg, #1e293b, #111921, #1e293b);
    background-size: 180% 180%;
    animation: gradient-animation 15s ease infinite;
    color: var(--text-main);
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

body::-webkit-scrollbar {
    display: none;
    width: 0 !important;
    height: 0 !important;
}

::-webkit-scrollbar {
    display: none;
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

/* --- Main Container --- */
main {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    padding: 20px;
}

/* --- Login Card --- */
.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    border: 1px solid var(--border);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header img {
    height: 120px;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
}

.login-header h2 {
    color: var(--text-main);
    font-size: 1.5rem;
    margin: 1rem 0 0.5rem 0;
    border-bottom: 3px solid var(--primary);
    display: inline-block;
    padding: 0 15px 8px 15px;
}

.login-header p {
    color: var(--text-muted);
    margin: 0.5rem 0 0 0;
    font-size: 0.95rem;
}

/* --- Form Fields --- */
.field {
    margin-bottom: 1.5rem;
    position: relative;
}

.ui-inputwrapper, .ui-password {
    width: 100% !important;
    display: block !important;
}

.ui-inputfield, .btn-login {
    height: 50px !important;
    border-radius: var(--radius-md) !important;
    box-sizing: border-box !important;
}

.ui-inputfield {
    width: 100% !important;
    padding: 0 1rem 0 3rem !important;
    border: 1.5px solid var(--border) !important;
    background: var(--input-bg) !important;
    color: var(--text-main) !important;
    font-size: 1rem !important;
    transition: all 0.3s ease !important;
}

.ui-inputfield:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px var(--primary-glow) !important;
    outline: none !important;
}

.ui-inputfield::placeholder {
    color: var(--text-muted) !important;
}

.ui-input-icon-left {
    display: block !important;
    width: 100% !important;
    position: relative !important; /* Crucial pour le 'absolute' de l'icône */
    padding: 0 !important;          /* On annule tout padding par défaut de PrimeFaces */
    margin: 0 !important;
}

.ui-input-icon-left > i {
    position: absolute !important;
    left: 1rem !important;          /* Alignement horizontal propre */
    top: 50% !important;            /* On place le haut de l'icône au centre du champ */
    transform: translateY(-50%) !important; /* Remonte l'icône de la moitié de sa propre hauteur = Centrage vertical parfait */

    /* Styles visuels */
    z-index: 10 !important;         /* Passe au-dessus de l'input */
    color: var(--primary) !important;
    font-size: 1.1rem !important;

    /* On annule les marges/alignements par défaut de PrimeFaces qui décalent l'icône */
    margin-top: 0 !important;
    display: block !important;
    vertical-align: middle !important;
}
.ui-input-icon-left > .ui-inputfield {
    padding-left: 3rem !important; /* Espace suffisant pour l'icône à gauche */
}

/* --- Buttons --- */
.btn-login {
    width: 100% !important;
    background: var(--primary) !important;
    color: var(--bg) !important;
    font-weight: 700 !important;
    border: none !important;
    margin-top: 1.5rem;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px var(--primary-glow) !important;
}

.btn-login:active {
    transform: translateY(0);
}

/* --- PrimeFaces Growl Messages --- */
.ui-growl {
    top: 20px !important;
    right: 20px !important;
}

.ui-growl-item {
    background: var(--card-bg) !important;
    border-left: 4px solid var(--primary) !important;
    border-radius: var(--radius-md) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}

.ui-growl-title {
    color: var(--text-main) !important;
    font-weight: 700 !important;
}

.ui-growl-message {
    color: var(--text-muted) !important;
}

/* --- Loading Dialog --- */
.ui-dialog {
    background: var(--card-bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-lg) !important;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4) !important;
}

.ui-dialog-mask {
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(3px);
}

.ui-dialog-titlebar {
    background: var(--card-bg) !important;
    border-bottom: 1px solid var(--border) !important;
}

.pi-spin {
    color: var(--primary) !important;
}
