/**
 * AgriCapital Microsite - Authentication Styles
 * Document confidentiel - Tous droits réservés © AgriCapital 2026
 */

/* ========== Animations ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ========== Page Load Animations ========== */
.page-animate {
    opacity: 0;
    animation: fadeIn 0.6s ease-out forwards;
}

.page-animate-delay-1 { animation-delay: 0.1s; }
.page-animate-delay-2 { animation-delay: 0.2s; }
.page-animate-delay-3 { animation-delay: 0.3s; }
.page-animate-delay-4 { animation-delay: 0.4s; }

/* ========== Auth Modal Base ========== */
#login-modal,
#admin-choice-modal,
#admin-panel-modal,
#email-choice-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(44, 95, 45, 0.95) 0%, rgba(26, 26, 26, 0.98) 100%);
    backdrop-filter: blur(10px);
}

.auth-modal {
    position: relative;
    background: white;
    border-radius: 20px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.admin-modal {
    max-width: 500px;
}

.admin-panel-modal {
    max-width: 550px;
}

.email-choice-modal {
    max-width: 480px;
}

/* ========== Auth Header ========== */
.auth-header {
    text-align: center;
    padding: 2rem 2rem 1rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #fff9e6 100%);
    border-radius: 20px 20px 0 0;
}

.auth-logo {
    width: 80px;
    height: auto;
    margin-bottom: 1rem;
    border-radius: 8px;
}

.auth-header h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    color: #2c5f2d;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: #6b7280;
    font-size: 0.95rem;
}

/* ========== Auth Body ========== */
.auth-body {
    padding: 1.5rem 2rem;
}

.auth-form label {
    display: block;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.5rem;
}

.auth-form input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: #2c5f2d;
    box-shadow: 0 0 0 4px rgba(44, 95, 45, 0.1);
}

.auth-hint {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0.75rem 0;
}

.auth-error {
    background: #fff0f0;
    border: 1px solid #dc3545;
    color: #dc3545;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.auth-error small {
    display: block;
    margin-top: 0.5rem;
    color: #666;
}

.auth-feedback {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.auth-feedback.success {
    background: #f0fff0;
    border: 1px solid #28a745;
    color: #28a745;
}

.auth-feedback.error {
    background: #fff0f0;
    border: 1px solid #dc3545;
    color: #dc3545;
}

/* ========== Auth Buttons ========== */
.auth-btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #2c5f2d 0%, #97c93d 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 1rem;
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(44, 95, 45, 0.3);
}

.auth-btn-secondary {
    padding: 0.75rem 1.5rem;
    background: white;
    color: #2c5f2d;
    border: 2px solid #2c5f2d;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-btn-secondary:hover {
    background: #2c5f2d;
    color: white;
}

.auth-btn-logout {
    padding: 0.75rem 1.5rem;
    background: #fff0f0;
    color: #dc3545;
    border: 1px solid #dc3545;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-btn-logout:hover {
    background: #dc3545;
    color: white;
}

/* ========== Auth Footer ========== */
.auth-footer {
    text-align: center;
    padding: 1.5rem 2rem;
    background: #f3f4f6;
    border-radius: 0 0 20px 20px;
}

.auth-footer p {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
}

/* ========== Admin Choices ========== */
.admin-choices,
.email-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-choice-btn,
.email-choice-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
}

.admin-choice-btn:hover,
.email-choice-btn:hover {
    border-color: #2c5f2d;
    background: #e8f5e9;
    transform: translateX(5px);
}

.admin-choice-icon,
.email-choice-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 10px;
}

.admin-choice-text,
.email-choice-text {
    flex: 1;
}

.admin-choice-text strong,
.email-choice-text strong {
    display: block;
    color: #1a1a1a;
    font-size: 1rem;
}

.admin-choice-text small,
.email-choice-text small {
    color: #6b7280;
    font-size: 0.85rem;
}

/* ========== Admin Email Management ========== */
.admin-add-email {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.admin-add-email input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e5e5;
    border-radius: 10px;
    font-size: 0.95rem;
}

.admin-add-email input:focus {
    outline: none;
    border-color: #2c5f2d;
}

.admin-add-email button {
    padding: 0.75rem 1rem;
    white-space: nowrap;
    margin-top: 0;
}

.admin-email-list {
    margin-top: 1.5rem;
}

.admin-email-list h4 {
    font-size: 0.9rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e5e5;
}

.admin-email-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.admin-email-item:hover {
    background: #f0f0f0;
}

.admin-email-protected {
    background: #e8f5e9;
    border: 1px solid #97c93d;
}

.admin-email-text {
    font-size: 0.9rem;
    color: #1a1a1a;
    word-break: break-all;
}

.admin-email-badge {
    background: linear-gradient(135deg, #2c5f2d 0%, #97c93d 100%);
    color: white;
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

.admin-email-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: #fff0f0;
    color: #dc3545;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-email-delete:hover {
    background: #dc3545;
    color: white;
}

/* ========== Hide content until authenticated ========== */
body:not(.authenticated) .protected-content {
    display: none !important;
}

/* ========== Floating Download Button ========== */
.floating-download {
    position: fixed;
    top: 80px;
    right: 1.5rem;
    z-index: 98;
}

.floating-download-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(230, 126, 34, 0.3);
    transition: all 0.3s;
    cursor: pointer;
    border: none;
}

.floating-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 34, 0.4);
}

/* ========== Floating Activities Button ========== */
.floating-activities {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    z-index: 98;
}

.floating-activities-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, #1976d2 0%, #42a5f5 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(25, 118, 210, 0.3);
    transition: all 0.3s;
}

.floating-activities-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(25, 118, 210, 0.4);
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .auth-modal {
        width: 95%;
        margin: 1rem;
    }
    
    .auth-header {
        padding: 1.5rem 1.5rem 1rem;
    }
    
    .auth-body {
        padding: 1.25rem 1.5rem;
    }
    
    .auth-footer {
        padding: 1.25rem 1.5rem;
    }
    
    .admin-add-email {
        flex-direction: column;
    }
    
    .admin-add-email button {
        width: 100%;
    }
    
    .floating-download {
        top: auto;
        bottom: 1rem;
        left: 1rem;
        right: auto;
    }
    
    .floating-activities {
        bottom: 4rem;
    }
}

/* ========== Confidentiality Notice ========== */
.confidentiality-notice {
    background: linear-gradient(135deg, rgba(44, 95, 45, 0.05) 0%, rgba(230, 126, 34, 0.05) 100%);
    border: 1px solid rgba(44, 95, 45, 0.2);
    border-radius: 12px;
    padding: 1.25rem;
    margin: 1.5rem 0;
    font-size: 0.85rem;
    color: #6b7280;
}

.confidentiality-notice strong {
    color: #2c5f2d;
}

.confidentiality-notice .notice-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: #e67e22;
    margin-bottom: 0.5rem;
}

/* ========== User Badge ========== */
.user-badge {
    position: fixed;
    top: 80px;
    left: 1.5rem;
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.8rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    z-index: 98;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-badge .badge-icon {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #2c5f2d 0%, #97c93d 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
}

.user-badge .badge-logout {
    margin-left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: #f3f4f6;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    color: #6b7280;
    transition: all 0.2s;
}

.user-badge .badge-logout:hover {
    background: #dc3545;
    color: white;
}

@media (max-width: 768px) {
    .user-badge {
        display: none;
    }
}
