/* assets/css/auth.css - Version avec split layout */

:root {
    /* Palette orange WeBuy */
    --auth-primary: #f7a83d;
    --auth-primary-dark: #e09632;
    --auth-primary-light: #fff5e7;
    --auth-secondary: #2c3e50;
    --auth-light: #f5f7fa;
    --auth-text: #333333;
    --auth-text-light: #777777;
    --auth-border: #e1e5e9;
    --auth-success: #28a745;
    --auth-danger: #dc3545;
    --auth-warning: #ffc107;
    
    /* Variables d'ombre */
    --auth-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --auth-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --auth-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.2);
    
    /* Variables responsive */
    --auth-container-sm: 95%;
    --auth-container-md: 400px;
    --auth-container-lg: 450px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body */
body.auth-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    overflow: hidden;
}

/* Split container - pour desktop */
.split-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Côté gauche avec image de fond */
.left-side {
    flex: 1;
    background-image: url('../images/Photos/background-login.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    min-height: 100vh;
}

/* Fallback si l'image ne charge pas */
.left-side::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #ff9800 0%, #ffb74d 100%);
    opacity: 0;
    z-index: 1;
}

.left-side.image-loaded::before {
    opacity: 0;
}

/* Overlay pour améliorer la lisibilité du logo */
.left-side::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 0;
}

/* Logo en haut à gauche */
.left-header {
    position: absolute;
    top: 30px;
    left: 30px;
    z-index: 10;
}

.logo {
    display: block;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-img {
    height: 40px;
    width: auto;
    max-width: 150px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Côté droit avec formulaire */
.right-side {
    flex: 1;
    background: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    overflow-y: auto;
    min-height: 100vh;
}

/* Message mobile */
.mobile-message {
    display: none;
    text-align: center;
    margin-bottom: 20px;
    padding: 12px 15px;
    background: #fff5e7;
    border-radius: 10px;
    font-size: 14px;
    color: var(--auth-text);
    width: 100%;
    max-width: var(--auth-container-md);
    border-left: 4px solid var(--auth-primary);
}

.mobile-message i {
    color: var(--auth-primary);
    margin-right: 8px;
}

/* Conteneur d'authentification */
.auth-container {
    width: 100%;
    max-width: var(--auth-container-md);
    animation: fadeIn 0.8s ease-out;
    margin: 0 auto;
}

/* Carte d'authentification */
.auth-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--auth-shadow-lg);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid rgba(255, 167, 61, 0.2);
}

.auth-card:hover {
    box-shadow: 0 20px 50px rgba(247, 168, 61, 0.3);
    transform: translateY(-5px);
    border: 1px solid rgba(255, 167, 61, 0.4);
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        var(--auth-primary), 
        #ff9800, 
        var(--auth-primary-dark));
}

/* Header de la carte */
.auth-header {
    padding: 40px 30px 30px;
    text-align: center;
    background: linear-gradient(135deg, 
        rgba(255, 245, 231, 0.95) 0%, 
        rgba(255, 235, 204, 0.9) 100%);
    position: relative;
    overflow: hidden;
}

.auth-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 152, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(247, 168, 61, 0.1) 0%, transparent 50%);
    z-index: 0;
}

.auth-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--auth-primary);
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(247, 168, 61, 0.2);
}

.auth-header p {
    color: var(--auth-text);
    font-size: 15px;
    line-height: 1.5;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    font-weight: 500;
}

/* Formulaire */
#login-form {
    padding: 30px;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--auth-secondary);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 12px;
    border: 2px solid var(--auth-border);
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-wrapper:focus-within {
    border-color: var(--auth-primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(247, 168, 61, 0.15),
                inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.input-icon {
    position: absolute;
    left: 15px;
    color: var(--auth-primary);
    font-size: 16px;
    z-index: 1;
}

.password-toggle {
    position: absolute;
    right: 15px;
    color: var(--auth-primary);
    font-size: 16px;
    cursor: pointer;
    z-index: 1;
    transition: all 0.3s ease;
    background: none;
    border: none;
    padding: 5px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--auth-primary-dark);
    background: rgba(247, 168, 61, 0.1);
    transform: scale(1.1);
}

#login-form input[type="email"],
#login-form input[type="password"] {
    width: 100%;
    padding: 15px 45px;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--auth-text);
    outline: none;
    border-radius: 10px;
    transition: all 0.3s ease;
}

#login-form input::placeholder {
    color: var(--auth-text-light);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#login-form input:focus::placeholder {
    opacity: 0.4;
}

/* Bouton de soumission */
.btn-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, 
        var(--auth-primary) 0%, 
        #ff9800 50%, 
        var(--auth-primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(247, 168, 61, 0.3);
}

.btn-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.3), 
        transparent);
    transition: left 0.7s ease;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(247, 168, 61, 0.4);
    background: linear-gradient(135deg, 
        var(--auth-primary-dark) 0%, 
        #ff9800 50%, 
        var(--auth-primary) 100%);
}

.btn-submit:hover::before {
    left: 100%;
}

.btn-submit:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(247, 168, 61, 0.3);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background: linear-gradient(135deg, 
        #cccccc 0%, 
        #aaaaaa 50%, 
        #888888 100%);
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-loading {
    position: relative;
    z-index: 1;
}

/* Messages d'état */
#login-message {
    margin-bottom: 20px;
    animation: fadeIn 0.5s ease;
}

.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: slideInRight 0.4s ease;
    border-left: 4px solid transparent;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-error {
    background: linear-gradient(135deg, 
        rgba(220, 53, 69, 0.1) 0%, 
        rgba(220, 53, 69, 0.05) 100%);
    border-left-color: var(--auth-danger);
    color: #c53030;
    border-color: rgba(220, 53, 69, 0.2);
}

.alert-success {
    background: linear-gradient(135deg, 
        rgba(40, 167, 69, 0.1) 0%, 
        rgba(40, 167, 69, 0.05) 100%);
    border-left-color: var(--auth-success);
    color: #2b8a3e;
    border-color: rgba(40, 167, 69, 0.2);
}

/* Footer d'authentification */
.auth-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 1px solid rgba(255, 167, 61, 0.2);
    position: relative;
}

.auth-footer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: var(--auth-primary);
    border-radius: 2px;
}

.auth-footer p {
    color: var(--auth-text);
    font-size: 14px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-footer a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    padding: 2px 0;
}

.auth-footer a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--auth-primary);
    transition: width 0.3s ease;
    border-radius: 1px;
}

.auth-footer a:hover {
    color: var(--auth-primary-dark);
}

.auth-footer a:hover::after {
    width: 100%;
}

/* Terms */
.terms {
    margin-top: 25px;
    text-align: center;
    font-size: 12px;
    color: var(--auth-text-light);
    line-height: 1.5;
    padding: 15px;
    background: linear-gradient(135deg, 
        rgba(255, 245, 231, 0.5) 0%, 
        rgba(255, 235, 204, 0.3) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 167, 61, 0.2);
}

.terms i {
    color: var(--auth-primary);
    margin-right: 8px;
}

.terms a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0 2px;
    border-radius: 2px;
}

.terms a:hover {
    color: var(--auth-primary-dark);
    text-decoration: underline;
    background: rgba(247, 168, 61, 0.1);
}

/* Animation pour le loading */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(247, 168, 61, 0.1);
    border-top: 3px solid var(--auth-primary);
    border-right: 3px solid var(--auth-primary);
    border-bottom: 3px solid var(--auth-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Pied de page global */
.global-footer {
    width: 100%;
    max-width: var(--auth-container-md);
    margin-top: 30px;
    padding: 15px;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 167, 61, 0.2);
    border-radius: 10px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.copyright {
    color: var(--auth-text);
    font-size: 12px;
    font-weight: 500;
}

.version {
    background: var(--auth-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
    display: inline-block;
}

.security-info {
    color: var(--auth-primary-dark);
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.security-info i {
    font-size: 10px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================================= */
/* RESPONSIVE DESIGN                                             */
/* ============================================================= */

/* Tablettes et petits écrans */
@media (max-width: 1024px) {
    .split-container {
        flex-direction: row;
    }
    
    .left-side {
        flex: 0.8;
    }
    
    .right-side {
        flex: 1.2;
    }
}

/* Tablettes en mode portrait */
@media (max-width: 768px) {
    .split-container {
        flex-direction: column;
        min-height: 100vh;
        overflow-y: auto;
    }
    
    .left-side {
        min-height: 200px;
        height: 200px;
        flex: none;
        background-position: center 30%;
    }
    
    .left-header {
        top: 20px;
        left: 20px;
    }
    
    .right-side {
        min-height: calc(100vh - 200px);
        padding: 20px 15px;
        justify-content: flex-start;
        overflow-y: visible;
    }
    
    .mobile-message {
        display: block;
    }
    
    .auth-container {
        max-width: 100%;
        margin: 0;
    }
    
    .auth-card {
        box-shadow: var(--auth-shadow-md);
    }
    
    .global-footer {
        margin-top: 20px;
        padding: 12px;
    }
}

/* Téléphones */
@media (max-width: 480px) {
    .left-side {
        min-height: 150px;
        height: 150px;
    }
    
    .right-side {
        min-height: calc(100vh - 150px);
        padding: 15px 10px;
    }
    
    .logo-img {
        height: 30px;
    }
    
    .auth-header {
        padding: 30px 20px 20px;
    }
    
    .auth-header h2 {
        font-size: 28px;
    }
    
    #login-form {
        padding: 20px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    #login-form input[type="email"],
    #login-form input[type="password"] {
        padding: 12px 40px;
        font-size: 14px;
    }
    
    .btn-submit {
        padding: 14px;
        font-size: 15px;
    }
    
    .global-footer {
        margin-top: 15px;
        padding: 10px;
    }
    
    .copyright {
        font-size: 11px;
    }
}

/* Très petits écrans */
@media (max-width: 320px) {
    .left-side {
        min-height: 120px;
        height: 120px;
    }
    
    .right-side {
        min-height: calc(100vh - 120px);
        padding: 10px;
    }
    
    .auth-header {
        padding: 20px 15px 15px;
    }
    
    .auth-header h2 {
        font-size: 24px;
    }
    
    .auth-header p {
        font-size: 14px;
    }
    
    #login-form {
        padding: 15px;
    }
}

/* Mode paysage mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .split-container {
        flex-direction: row;
    }
    
    .left-side {
        min-height: 100vh;
        height: auto;
    }
    
    .right-side {
        min-height: 100vh;
        height: auto;
        padding: 20px;
        justify-content: center;
    }
    
    .mobile-message {
        display: none;
    }
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .right-side {
        background: #1a1a1a;
    }
    
    .auth-card {
        background: #2c3e50;
        color: #ecf0f1;
        border-color: rgba(255, 152, 0, 0.3);
    }
    
    .auth-header {
        background: linear-gradient(135deg, 
            rgba(255, 152, 0, 0.2) 0%, 
            rgba(255, 111, 0, 0.15) 100%);
    }
    
    .auth-header h2 {
        color: #ffcc80;
        text-shadow: 0 2px 4px rgba(255, 152, 0, 0.3);
    }
    
    .auth-header p {
        color: #e0e0e0;
    }
    
    .form-group label {
        color: #e0e0e0;
    }
    
    .input-wrapper {
        background: linear-gradient(135deg, #34495e 0%, #2c3e50 100%);
        border-color: #4a6572;
    }
    
    #login-form input[type="email"],
    #login-form input[type="password"] {
        color: #ecf0f1;
        background: transparent;
    }
    
    #login-form input::placeholder {
        color: #95a5a6;
    }
    
    .input-wrapper:focus-within {
        border-color: #ff9800;
        background: #2c3e50;
        box-shadow: 0 0 0 4px rgba(255, 152, 0, 0.2),
                    inset 0 1px 3px rgba(0, 0, 0, 0.2);
    }
    
    .terms {
        background: linear-gradient(135deg, 
            rgba(255, 152, 0, 0.1) 0%, 
            rgba(255, 111, 0, 0.05) 100%);
        border-color: rgba(255, 152, 0, 0.3);
        color: #bdc3c7;
    }
    
    .global-footer {
        background: rgba(44, 62, 80, 0.9);
        border-top-color: rgba(255, 152, 0, 0.3);
    }
    
    .copyright {
        color: #e0e0e0;
    }
}

/* Mode impression */
@media print {
    .left-side {
        display: none;
    }
    
    .split-container {
        display: block;
    }
    
    .right-side {
        display: block;
        padding: 0;
        background: white;
    }
    
    .auth-card {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .btn-submit,
    .password-toggle,
    .mobile-message {
        display: none !important;
    }
    
    .global-footer {
        position: static;
        background: white;
        color: black;
        border-top: 1px solid #ccc;
    }
}