:root {
    --primary-color: #25d366;
    --background-color: #e5ddd5;
    --message-sent: #dcf8c6;
    --message-received: #ffffff;
    --text-color: #303030;
    --border-color: #e0e0e0;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --shadow-dark: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] {
    --background-color: #0d1418;
    --message-sent: #056162;
    --message-received: #262d31;
    --text-color: #e1e1e1;
    --border-color: #2a2f32;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-dark: rgba(0, 0, 0, 0.5);
}

/* Reset et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    color: var(--text-color);
}

/* Styles pour la page de connexion */
.login-body {
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    padding: 0px;
}

.login-form{
        border-radius: 20px;
    box-shadow: 0 15px 35px var(--shadow-medium);
    padding: 10px;
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: white;
    padding: 40px;
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    margin-bottom: 30px;
}

.app-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 32px;
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.login-header h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
    font-weight: 600;
}

.login-header p {
    color: #666;
    font-size: 14px;
    line-height: 1.4;
}

.login-form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

.form-group label i {
    color: #25d366;
    width: 16px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: #f8f9fa;
}

.form-group input[type="text"]:focus {
    border-color: #25d366;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
    background: white;
}

/* Styles pour le champ PIN */
.pin-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

#pinCode {
    width: 100%;
    padding: 12px 45px 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 8px;
    text-align: center;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    background: #f8f9fa;
}

#pinCode:focus {
    border-color: #25d366;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
    letter-spacing: 12px;
    background: white;
}

.pin-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-toggle:hover {
    background-color: #f0f0f0;
    color: #333;
}

.pin-toggle.active {
    color: #25d366;
}

/* Color picker */
.color-picker {
    display: flex;
    align-items: center;
    gap: 15px;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0;
}

.color-picker input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 8px;
}

#colorValue {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: #333;
    font-size: 14px;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

/* Messages d'erreur */
.error-message {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: none;
    animation: shake 0.5s ease;
}

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

.error-message.show {
    display: block;
}

/* Bouton de connexion */
.login-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #25d366, #128c7e);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.login-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.5s;
}

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

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.3);
}

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

.login-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-btn:disabled::before {
    display: none;
}

/* Footer */
.login-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.login-footer p {
    color: #666;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* Style pour les messages d'erreur PIN */
.pin-error {
    background-color: #ffeaea;
    border: 1px solid #ffcccc;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    color: #d63031;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.pin-success {
    background-color: #e8f5e8;
    border: 1px solid #c8e6c9;
    border-radius: 8px;
    padding: 10px;
    margin: 10px 0;
    color: #2e7d32;
    font-size: 14px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

/* Style pour le compteur de tentatives */
.attempts-warning {
    background-color: #fff3e0;
    border: 1px solid #ffcc80;
    border-radius: 8px;
    padding: 8px 12px;
    margin: 5px 0;
    color: #ef6c00;
    font-size: 12px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

/* Toast messages */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-20px);
}

.toast.success {
    background-color: rgba(37, 211, 102, 0.9);
}

.toast.error {
    background-color: rgba(234, 76, 76, 0.9);
}

.toast.info {
    background-color: rgba(64, 156, 255, 0.9);
}

/* Loading spinner */
.loading-spinner {
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 480px) {
    .login-container {
        padding: 10px;
    }
    
    .login-card {
        padding: 30px 20px;
    }
    
    .login-header h1 {
        font-size: 22px;
    }
    
    .app-logo {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    .login-body {
        padding: 10px;
    }
}

/* États de focus accessibles */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Animation de fadeIn générale */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Pulse animation pour le bouton */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.login-btn.pulse {
    animation: pulse 2s infinite;
}