/* ========================================
   VARIABLES & RESET
======================================== */
:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --secondary: #764ba2;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --dark: #1a1a2e;
    --darker: #16162a;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: rgba(255,255,255,0.1);
    --shadow: 0 10px 40px rgba(0,0,0,0.3);
    --gradient: linear-gradient(135deg, var(--primary), var(--secondary));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--dark);
    color: var(--light);
    min-height: 100vh;
    line-height: 1.6;
}

/* ========================================
   SECTION AUTHENTIFICATION
======================================== */
.auth-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient);
    padding: 20px;
}

.auth-container {
    background: var(--darker);
    border-radius: 20px;
    padding: 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow);
    text-align: center;
}

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

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}

.logo-icon {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: var(--gray);
    font-size: 0.95rem;
}

.auth-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.auth-content > p {
    color: var(--gray);
    margin-bottom: 25px;
    font-size: 0.9rem;
}

/* Bouton Google */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 20px;
    background: white;
    color: #333;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.btn-google:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.google-icon {
    width: 24px;
    height: 24px;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: var(--gray);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 15px;
    font-size: 0.85rem;
}

/* Bouton invité */
.btn-guest {
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    color: var(--light);
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-guest:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--primary);
}

.auth-note {
    margin-top: 15px;
    color: var(--gray);
}

/* Features */
.auth-features {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--border);
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: var(--gray);
}

.feature-icon {
    font-size: 1.5rem;
}

/* ========================================
   SECTION APPLICATION
======================================== */
.app-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: var(--darker);
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left .logo-icon {
    font-size: 1.8rem;
}

.header-left h1 {
    font-size: 1.4rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

#user-name {
    font-weight: 500;
}

.btn-logout {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.1);
}

/* Main */
.app-main {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 0;
}

.container {
    padding: 30px;
    max-width: 900px;
}

/* Zone d'analyse */
.analyze-section h2 {
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.1);
}

.drop-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.drop-zone p {
    color: var(--gray);
    margin-bottom: 10px;
}

.drop-or {
    display: block;
    color: var(--gray);
    margin: 10px 0;
    font-size: 0.85rem;
}

.btn-upload {
    display: inline-block;
    padding: 10px 20px;
    background: var(--gradient);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.3s;
}

.btn-upload:hover {
    transform: translateY(-2px);
}

/* Textarea */
.textarea-container {
    margin-bottom: 20px;
}

#email-content {
    width: 100%;
    padding: 20px;
    background: var(--darker);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--light);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 200px;
    transition: border-color 0.3s;
}

#email-content:focus {
    outline: none;
    border-color: var(--primary);
}

#email-content::placeholder {
    color: var(--gray);
}

.textarea-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

.char-count {
    font-size: 0.8rem;
    color: var(--gray);
}

/* Boutons d'action */
.action-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-analyze {
    background: var(--gradient);
    color: white;
    flex: 1;
}

.btn-analyze:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-analyze:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-clear {
    background: transparent;
    color: var(--gray);
    border: 1px solid var(--border);
}

.btn-clear:hover {
    background: rgba(255,255,255,0.05);
    color: var(--light);
}

/* Loader */
.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 40px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Résultats */
.results-section {
    margin-top: 30px;
    padding: 25px;
    background: var(--darker);
    border-radius: 15px;
    border: 1px solid var(--border);
}

.results-section h2 {
    margin-bottom: 20px;
}

.analysis-header {
    display: flex;
    gap: 25px;
    align-items: center;
    margin-bottom: 25px;
}

.risk-score {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.score-value {
    font-size: 2.2rem;
    font-weight: 700;
}

.score-label {
    font-size: 0.75rem;
    opacity: 0.9;
}

.risk-level h3 {
    font-size: 1.3rem;
    margin-bottom: 10px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-ai {
    background: rgba(102, 126, 234, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.badge-local {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning);
    border: 1px solid var(--warning);
}

/* Détails analyse */
.analysis-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.indicators-section,
.recommendations-section {
    background: rgba(255,255,255,0.03);
    padding: 20px;
    border-radius: 12px;
}

.indicators-section h4,
.recommendations-section h4 {
    margin-bottom: 15px;
    font-size: 1rem;
}

.indicators-list,
.recommendations-list {
    list-style: none;
}

.indicators-list li,
.recommendations-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.indicators-list li:last-child,
.recommendations-list li:last-child {
    border-bottom: none;
}

.ai-details {
    margin-top: 20px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border-left: 4px solid var(--primary);
}

.ai-details h4 {
    margin-bottom: 10px;
}

.ai-details p {
    color: var(--gray);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* Sidebar */
.sidebar {
    background: var(--darker);
    border-left: 1px solid var(--border);
    padding: 20px;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sidebar-header h3 {
    font-size: 1.1rem;
}

.btn-clear-history {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.3s;
}

.btn-clear-history:hover {
    background: rgba(255,255,255,0.1);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.no-history {
    color: var(--gray);
    text-align: center;
    font-size: 0.9rem;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.3s;
}

.history-item:hover {
    background: rgba(255,255,255,0.06);
}

.history-risk {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.history-info {
    flex: 1;
    overflow: hidden;
}

.history-date {
    font-size: 0.75rem;
    color: var(--gray);
    margin-bottom: 4px;
}

.history-preview {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer */
.app-footer {
    padding: 15px;
    text-align: center;
    background: var(--darker);
    border-top: 1px solid var(--border);
    color: var(--gray);
    font-size: 0.85rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow);
}

.notification.show {
    transform: translateX(0);
}

.notification-success {
    background: var(--success);
    color: white;
}

.notification-error {
    background: var(--danger);
    color: white;
}

.notification-info {
    background: var(--primary);
    color: white;
}

.notification button {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* Responsive */
@media (max-width: 900px) {
    .app-main {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        border-left: none;
        border-top: 1px solid var(--border);
    }
    
    .analysis-details {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 500px) {
    .auth-container {
        padding: 25px;
    }
    
    .auth-features {
        flex-direction: column;
        gap: 15px;
    }
    
    .feature {
        flex-direction: row;
        gap: 10px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .analysis-header {
        flex-direction: column;
        text-align: center;
    }
}

/* ========================================
   STYLES RÉSULTATS D'ANALYSE
======================================== */
.result-card {
    padding: 25px;
    border-radius: 15px;
    background: rgba(255,255,255,0.05);
}

.result-card.critical {
    border-left: 4px solid var(--danger);
}

.result-card.safe {
    border-left: 4px solid var(--success);
}

.result-card.warning {
    border-left: 4px solid var(--warning);
}

.score-display {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.score-circle.risk-critical {
    background: rgba(231, 76, 60, 0.2);
    border: 3px solid var(--danger);
    color: var(--danger);
}

.score-circle.risk-safe {
    background: rgba(39, 174, 96, 0.2);
    border: 3px solid var(--success);
    color: var(--success);
}

.score-circle.risk-warning {
    background: rgba(243, 156, 18, 0.2);
    border: 3px solid var(--warning);
    color: var(--warning);
}

.risk-badge {
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
}

.risk-badge.risk-critical {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger);
}

.risk-badge.risk-safe {
    background: rgba(39, 174, 96, 0.2);
    color: var(--success);
}

.risk-badge.risk-warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning);
}

.indicators-section {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
}

.indicators-section h4 {
    margin-bottom: 10px;
}

.indicators-section ul {
    list-style: none;
    padding-left: 10px;
}

.indicators-section li {
    padding: 5px 0;
    color: var(--gray);
}

.recommendation {
    padding: 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 10px;
    border-left: 3px solid var(--primary);
}
