:root {
    --sg-orange: #d97706;
    --sg-blue: #0069d9;
    --discord: #5865F2;
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #2c3e50;
    --text-muted: #6c757d;
    --border: #e2e8f0;
    --radius: 12px;
}

* { box-sizing: border-box; font-family: 'Segoe UI', sans-serif; margin: 0; padding: 0; }

/* NOUVEAU : On applique le fond et la couleur du texte à TOUT le site */
body {
    background-color: var(--bg-page);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
}

/* La page de connexion garde juste son centrage */
body.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    background: var(--bg-card);
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
}

.auth-header { text-align: center; margin-bottom: 2rem; }
.auth-logo { max-width: 250px; height: auto; margin-bottom: 1rem; }
.auth-header h1 { font-size: 1.5rem; color: var(--text-main); margin-bottom: 0.5rem; }

/* Boutons OAuth */
.oauth-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 1.5rem; }
.btn-oauth {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; padding: 0.8rem; border-radius: var(--radius);
    font-weight: bold; text-decoration: none; transition: 0.2s;
}
.btn-discord { background: var(--discord); color: white; }
.btn-discord:hover { background: #4752C4; }
.btn-google { background: white; color: #333; border: 1px solid var(--border); }
.btn-google:hover { background: #f8f9fa; }
.btn-google img { width: 18px; }

/* Séparateur "OU" */
.divider {
    display: flex; align-items: center; text-align: center; margin: 1.5rem 0; color: var(--text-muted);
}
.divider::before, .divider::after {
    content: ''; flex: 1; border-bottom: 1px solid var(--border);
}
.divider span { padding: 0 10px; font-size: 0.9em; font-weight: bold; }

/* Formulaire */
.form-group { margin-bottom: 1.2rem; }
label { display: block; font-weight: 600; margin-bottom: 0.5rem; font-size: 0.9em; color: var(--text-main); }
.input-icon { position: relative; }
.input-icon i:first-child { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.input-icon input {
    width: 100%; padding: 0.8rem 1rem 0.8rem 40px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 1rem; outline: none; transition: 0.2s;
}
.input-icon input:focus { border-color: var(--sg-blue); box-shadow: 0 0 0 3px rgba(0, 105, 217, 0.1); }
.password-toggle { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); cursor: pointer; color: var(--text-muted); }

.form-actions { display: flex; justify-content: flex-end; margin-bottom: 1.5rem; }
.forgot-link { color: var(--sg-blue); text-decoration: none; font-size: 0.85em; font-weight: 600; }
.forgot-link:hover { text-decoration: underline; }

.btn-primary {
    background: var(--sg-blue); color: white; border: none; padding: 0.8rem;
    width: 100%; border-radius: var(--radius); font-weight: bold; font-size: 1rem; cursor: pointer; transition: 0.2s;
}
.btn-primary:hover { background: #0056b3; }

.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.9em; color: var(--text-muted); }
.auth-footer a { color: var(--sg-orange); text-decoration: none; font-weight: bold; }
.auth-footer a:hover { text-decoration: underline; }

/* Alertes */
.alert { padding: 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.9em; text-align: center; }
.alert-error { background: #f8d7da; color: #dc3545; border: 1px solid #f5c2c7; }
.input-standard { width: 100%; padding: 0.8rem; border: 1px solid var(--border); border-radius: var(--radius); outline: none; } .input-standard:focus { border-color: var(--sg-blue); }

/* ==========================================================================
   MODE SOMBRE - MES SERVICES
   ========================================================================== */
body.dark-mode {
    --bg-page: #121212;
    --bg-card: #1e1e1e;
    --text-main: #ecf0f1;
    --text-muted: #bdc3c7;
    --border: #333333;
}

body.dark-mode .btn-google {
    background: #2a2a2a;
    color: #ecf0f1;
    border-color: #444;
}

body.dark-mode .btn-google:hover {
    background: #333;
}

body.dark-mode input, 
body.dark-mode select {
    background-color: #121212;
    color: #ecf0f1;
}

/* Petite correction pour les inputs standards (select, etc.) */
.input-standard { 
    width: 100%; 
    padding: 0.8rem; 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    outline: none; 
    background-color: transparent;
    color: var(--text-main);
}
.input-standard:focus { border-color: var(--sg-blue); }

/* ==========================================================================
   DASHBOARD MES SERVICES
   ========================================================================== */

/* En-tête */
.ms-header { background: var(--bg-card); box-shadow: 0 2px 10px rgba(0,0,0,0.05); padding: 1rem 0; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border); }
.ms-header-content { max-width: 1000px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; }
.ms-logo { 
    height: 70px; /* Beaucoup plus grand ! */
    width: auto; 
    max-width: 280px; /* S'assure qu'il ne déborde pas sur les petits écrans */
    object-fit: contain;
}
.ms-user-menu { display: flex; align-items: center; gap: 15px; font-weight: bold; color: var(--text-main); }
.btn-logout { color: var(--danger); text-decoration: none; font-size: 1.2rem; transition: 0.2s; }
.btn-logout:hover { color: #c82333; }

/* Conteneur principal */
.ms-container { max-width: 1000px; margin: 2rem auto; padding: 0 20px; }
.ms-welcome { margin-bottom: 2rem; }
.ms-welcome h1 { font-size: 2rem; color: var(--text-main); margin-bottom: 0.5rem; border: none; }

/* Gros Bouton Retour Portail */
.return-portal-btn {
    display: flex; align-items: center; background: linear-gradient(135deg, var(--sg-blue), #0056b3);
    color: white; padding: 1.5rem; border-radius: var(--radius); text-decoration: none;
    box-shadow: var(--shadow-md); margin-bottom: 3rem; transition: transform 0.2s, box-shadow 0.2s;
}
.return-portal-btn:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 105, 217, 0.3); color: white; }
.portal-icon { font-size: 2.5rem; margin-right: 1.5rem; background: rgba(255,255,255,0.2); padding: 1rem; border-radius: 50%; }
.portal-text h3 { margin: 0 0 0.3rem 0; color: white; border: none; font-size: 1.4rem; }
.portal-text p { margin: 0; opacity: 0.9; }
.portal-arrow { margin-left: auto; font-size: 1.5rem; }

/* Grille et Colonnes */
.ms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 768px) { .ms-grid { grid-template-columns: 1fr; } .return-portal-btn { flex-direction: column; text-align: center; } .portal-icon { margin: 0 0 1rem 0; } .portal-arrow { display: none; } }
.section-title { font-size: 1.2rem; color: var(--text-main); margin-bottom: 1rem; border-bottom: 2px solid var(--border); padding-bottom: 0.5rem; }

/* Cartes Services */
.ms-card { background: var(--bg-card); border-radius: var(--radius); padding: 1.5rem; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.service-card { display: flex; gap: 1.5rem; margin-bottom: 1rem; transition: 0.2s; }
.service-card:hover { border-color: var(--sg-blue); box-shadow: var(--shadow-md); }
.service-icon { width: 50px; height: 50px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.service-info h4 { margin: 0 0 0.5rem 0; color: var(--text-main); font-size: 1.1rem; }
.service-info p { font-size: 0.9em; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.4; }

/* Boutons spécifiques MesServices */
.btn-ms { display: inline-block; padding: 0.5rem 1rem; background: var(--sg-blue); color: white; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 0.9em; transition: 0.2s; border: none; cursor: pointer; }
.btn-ms:hover { background: #0056b3; color: white; }
.btn-outline-ms { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline-ms:hover { background: var(--bg-page); border-color: var(--sg-blue); color: var(--sg-blue); }
.btn-danger-ms { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-ms:hover { background: var(--danger); color: white; }

/* Liste des requêtes */
.request-list { list-style: none; padding: 0; margin: 0; }
.request-list li { border-bottom: 1px solid var(--border); padding: 1rem 0; }
.request-list li:last-child { border-bottom: none; padding-bottom: 0; }
.req-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.req-date { font-size: 0.85em; color: var(--text-muted); }
.badge-status { padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.8em; font-weight: bold; }
.bg-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }
.bg-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.bg-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }

/* Adaptations Mode Sombre */
body.dark-mode .ms-header { border-bottom-color: var(--border); }
body.dark-mode .btn-outline-ms { color: var(--text-main); border-color: #555; }
body.dark-mode .service-icon { filter: brightness(0.8); }