
:root {
    --primary-color: #1a73e8; /* Bleu Google */
    --background-color: #f8f9fa; /* Gris très clair */
    --text-color: #202124;
    --text-secondary: #5f6368;
    --card-bg: #ffffff;
    --header-bg: #ffffff; /* Header blanc */
    --border-color: #dadce0;
    
    /* Couleurs des Scores Lighthouse */
    --score-good: #1e8e3e;   /* Vert (90-100) */
    --score-medium: #f57c00; /* Orange (50-89) */
    --score-bad: #d93025;    /* Rouge (0-49) */
    --info-color: #17a2b8;
}

body {
    font-family: 'Roboto', 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

main {
    flex: 1;
    /* AJUSTEMENT : Marge supérieure pour séparer du header */
    padding-top: 40px; 
    padding-bottom: 50px;
}

/* Header & Footer */
header {
    background-color: var(--header-bg);
    color: var(--text-color);
    padding: 1rem 0;
    box-shadow: 0 1px 6px rgba(32,33,36,0.28);
    /* Rendre le header fixe (sticky) */
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 500;
}

footer {
    background-color: #e1e4e8;
    color: #5f6368;
    text-align: center;
    padding: 1.5rem 0;
    font-size: 0.9rem;
    margin-top: auto;
}

/* Home Page Form */
.home-container {
    text-align: center;
    padding: 50px 30px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-top: 5vh;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

h1 { color: var(--text-color); font-weight: 700; }
h2 { font-weight: 600; }

form {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

input[type="text"] {
    padding: 15px 20px;
    width: 70%;
    border: 1px solid var(--border-color);
    border-radius: 24px 0 0 24px;
    font-size: 16px;
    outline: none;
}

button {
    padding: 15px 25px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 24px 24px 0;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

button:hover { opacity: 0.9; }
button:disabled { background-color: #6c757d; cursor: not-allowed; }

/* Spinner */
#loading { margin-top: 20px; }
.spinner {
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 10px auto;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* --- Layout Style PageSpeed Insights --- */

.report-header-psi {
    background-color: var(--card-bg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.report-meta {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.report-meta h1 {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 10px;
}

.analyzed-url {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    word-break: break-all;
}

/* Système de Jauges Multiples */
.score-gauges-container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.gauge-wrapper {
    text-align: center;
}

.score-gauge {
    --gauge-size: 100px;
    --gauge-thickness: 10px;
    width: var(--gauge-size);
    height: var(--gauge-size);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 auto 10px auto;
    /* Background défini inline dans le HTML via CSS variables */
    background: conic-gradient(
        var(--gauge-color) calc(var(--gauge-percentage) * 1%),
        #e9ecef calc(var(--gauge-percentage) * 1%) /* Couleur de fond de la piste */
    );
}

.score-gauge::before {
    content: "";
    position: absolute;
    inset: var(--gauge-thickness);
    border-radius: 50%;
    background: var(--card-bg);
}

.score-value {
    position: relative;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gauge-color);
    z-index: 1;
}

.gauge-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Indicateurs Clés (Metrics) --- */
.section-title {
    margin-bottom: 15px;
    font-size: 1.4rem;
    color: var(--text-color);
}

.metrics-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
    border: 1px solid var(--border-color);
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* --- Recommandations (Actions Prioritaires) --- */

.card {
    background: var(--card-bg);
    padding: 25px;
    margin-bottom: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.primary-card {
    border-top: 4px solid var(--primary-color);
}

.card h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

/* Mapping des priorités textuelles aux couleurs */
.priority-Haute { --priority-color: var(--score-bad); }
.priority-Moyenne { --priority-color: var(--score-medium); }
.priority-Faible { --priority-color: var(--info-color); }

.recommendations-list {
    list-style: none;
    padding: 0;
}

/* Style pour l'élément cliquable principal */
.recommendations-list > li {
    border-left: 5px solid var(--priority-color);
    margin-bottom: 10px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    background-color: var(--card-bg);
    /* Le curseur pointer est déplacé sur le reco-header */
    border: 1px solid var(--border-color);
}

.reco-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer; /* Curseur pointer uniquement sur le header */
}

.reco-title {
    font-weight: 600;
    margin-right: 15px;
}

.reco-badge {
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    background-color: var(--priority-color);
    color: white;
}

/* Ajustement contraste pour le badge orange */
.priority-Moyenne .reco-badge {
    color: #333; 
}

.reco-details {
    display: none; /* Caché par défaut, affiché par JS */
    padding: 20px;
    background-color: #f1f3f4; /* Fond légèrement plus sombre pour les détails */
    border-top: 1px solid var(--border-color);
}

.reco-details h4 {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
}

.reco-details h4:first-child { margin-top: 0; }

/* Style pour la liste des éléments non conformes */
.reco-details-list {
    margin-top: 15px;
    font-family: monospace;
    font-size: 0.9em;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 15px;
    list-style-type: disc;
    padding-left: 30px;
    word-break: break-all; /* Assure que les longues URLs/textes passent à la ligne */
    /* Scrollable si la liste est trop longue */
    max-height: 250px;
    overflow-y: auto;
}

/* Réinitialisation des styles pour les éléments de la liste interne */
.reco-details-list li {
    margin-bottom: 8px;
}


/* --- Détails de l'Analyse --- */

/* Détails Schéma */
.schema-types-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.schema-types-list li {
    font-family: monospace;
    padding: 5px 10px;
    background-color: #e8f0fe;
    color: var(--primary-color);
    border-radius: 15px;
    font-size: 0.9rem;
}


/* Alerts & Boutons */
.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.btn-header {
    color: var(--primary-color);
    text-decoration: none;
    padding: 8px 15px;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    transition: background-color 0.3s, color 0.3s;
    font-weight: 500;
}
.btn-header:hover { background-color: var(--primary-color); color: white; }

/* Responsive adjustments */
@media (max-width: 768px) {
    main {
        padding-top: 20px; /* Moins de marge sur mobile */
    }
    form {
        flex-direction: column;
        align-items: center;
    }
    input[type="text"] {
        width: 100%;
        border-radius: 24px;
        margin-bottom: 10px;
    }
    button {
        width: 100%;
        border-radius: 24px;
    }
}
