/* =================================================
   Tellaw Header Analyzer — tous les sélecteurs scopés
   sous .tellaw-header-analyzer pour éviter tout conflit.
   ================================================= */

/* ---- Racine ---- */
.tellaw-header-analyzer {
    font-family: 'Consolas', 'Monaco', 'Menlo', 'Courier New', monospace;
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 10px;
    border: 1px solid #313244;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    box-sizing: border-box;
}

/* ---- Header ---- */
.tellaw-header-analyzer .tha-header {
    background: #181825;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #313244;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
}

.tellaw-header-analyzer .tha-header-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.tellaw-header-analyzer .tha-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #cba6f7;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.tellaw-header-analyzer .tha-header-hint {
    margin-left: auto;
    font-size: 0.72rem;
    color: #45475a;
}

/* ---- Formulaire ---- */
.tellaw-header-analyzer .tha-form-panel {
    padding: 1rem;
}

.tellaw-header-analyzer .tha-url-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.tellaw-header-analyzer .tha-url-input {
    flex: 1;
    min-width: 0;
    background: #12111d;
    color: #cdd6f4;
    border: 1px solid #313244;
    border-radius: 6px;
    padding: 0.55rem 0.9rem;
    font-family: 'Consolas', 'Monaco', 'Menlo', monospace;
    font-size: 0.85rem;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
    margin: 0;
    box-shadow: none;
    display: block;
}

.tellaw-header-analyzer .tha-url-input:focus {
    border-color: #cba6f7;
    box-shadow: 0 0 0 2px rgba(203,166,247,0.15);
    outline: none;
}

.tellaw-header-analyzer .tha-url-input::placeholder { color: #45475a; }

.tellaw-header-analyzer .tha-form-note {
    font-size: 0.72rem;
    color: #45475a;
    margin: 0.5rem 0 0;
    padding: 0;
    border: none;
    background: none;
    line-height: 1.5;
}

/* ---- Boutons ---- */
.tellaw-header-analyzer .tha-btn {
    padding: 0.55rem 1.1rem;
    border-radius: 5px;
    border: none;
    font-size: 0.82rem;
    font-family: 'Consolas', 'Monaco', 'Menlo', monospace;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    white-space: nowrap;
    margin: 0;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    background: #313244;
    color: #cdd6f4;
    flex-shrink: 0;
}

.tellaw-header-analyzer .tha-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.tellaw-header-analyzer .tha-btn-primary {
    background: #cba6f7;
    color: #1e1e2e;
    font-weight: 700;
}

.tellaw-header-analyzer .tha-btn-primary:not(:disabled):hover {
    background: #b589f2;
    color: #1e1e2e;
}

/* ---- Chargement ---- */
.tellaw-header-analyzer .tha-loading {
    padding: 1.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #6c7086;
    font-size: 0.85rem;
    border-top: 1px solid #313244;
}

.tellaw-header-analyzer .tha-spinner {
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid #313244;
    border-top-color: #cba6f7;
    border-radius: 50%;
    animation: tellaw-ha-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ---- Erreur ---- */
.tellaw-header-analyzer .tha-error-panel {
    padding: 0.85rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: rgba(243,139,168,0.06);
    border-top: 1px solid #313244;
    color: #f38ba8;
    font-size: 0.83rem;
    line-height: 1.55;
}

.tellaw-header-analyzer .tha-error-icon { flex-shrink: 0; }

/* ---- Résultats ---- */
.tellaw-header-analyzer .tha-results {
    border-top: 1px solid #313244;
}

/* ---- Summary ---- */
.tellaw-header-analyzer .tha-summary {
    background: #181825;
    border-bottom: 1px solid #313244;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.tellaw-header-analyzer .tha-grade-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}

.tellaw-header-analyzer .tha-grade-box {
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #45475a;
    transition: background 0.3s;
}

.tellaw-header-analyzer .tha-grade-letter {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1e1e2e;
    line-height: 1;
}

/* Couleurs de grade */
.tellaw-header-analyzer .tha-grade-box.grade-a-plus { background: #a6e3a1; }
.tellaw-header-analyzer .tha-grade-box.grade-a      { background: #a6e3a1; }
.tellaw-header-analyzer .tha-grade-box.grade-b      { background: #89b4fa; }
.tellaw-header-analyzer .tha-grade-box.grade-c      { background: #f9e2af; }
.tellaw-header-analyzer .tha-grade-box.grade-d      { background: #fab387; }
.tellaw-header-analyzer .tha-grade-box.grade-f      { background: #f38ba8; }

.tellaw-header-analyzer .tha-grade-score {
    font-size: 0.75rem;
    color: #6c7086;
    display: flex;
    align-items: baseline;
    gap: 0.05rem;
}

.tellaw-header-analyzer .tha-score-val {
    font-size: 0.88rem;
    font-weight: 700;
    color: #cdd6f4;
}

.tellaw-header-analyzer .tha-score-max { color: #45475a; }

.tellaw-header-analyzer .tha-meta-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tellaw-header-analyzer .tha-meta-url {
    font-size: 0.83rem;
    color: #cba6f7;
    word-break: break-all;
    margin: 0;
    line-height: 1.4;
}

.tellaw-header-analyzer .tha-meta-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.tellaw-header-analyzer .tha-badge {
    font-size: 0.72rem;
    padding: 0.18rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    margin: 0;
    border: 1px solid transparent;
    line-height: 1.5;
}

.tellaw-header-analyzer .tha-badge-ok      { background: rgba(166,227,161,0.12); color: #a6e3a1; border-color: rgba(166,227,161,0.3); }
.tellaw-header-analyzer .tha-badge-warn    { background: rgba(250,179,135,0.12); color: #fab387; border-color: rgba(250,179,135,0.3); }
.tellaw-header-analyzer .tha-badge-error   { background: rgba(243,139,168,0.12); color: #f38ba8; border-color: rgba(243,139,168,0.3); }
.tellaw-header-analyzer .tha-badge-info    { background: rgba(137,180,250,0.12); color: #89b4fa; border-color: rgba(137,180,250,0.3); }
.tellaw-header-analyzer .tha-badge-neutral { background: rgba(108,112,134,0.12); color: #6c7086; border-color: rgba(108,112,134,0.3); }

/* ---- Sections ---- */
.tellaw-header-analyzer .tha-section {
    border-top: 1px solid #313244;
}

.tellaw-header-analyzer .tha-section-title {
    padding: 0.55rem 1.25rem;
    font-size: 0.71rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #585b70;
    background: #181825;
    border-bottom: 1px solid #313244;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tellaw-header-analyzer .tha-collapsible {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.tellaw-header-analyzer .tha-collapsible:hover { color: #cdd6f4; }

.tellaw-header-analyzer .tha-caret {
    margin-left: auto;
    font-size: 0.6rem;
    color: #45475a;
}

.tellaw-header-analyzer .tha-count-badge {
    background: #313244;
    color: #6c7086;
    font-size: 0.65rem;
    padding: 0.08rem 0.38rem;
    border-radius: 10px;
    font-weight: 700;
}

/* ---- Rule cards ---- */
.tellaw-header-analyzer .tha-rules-list {
    padding: 0.75rem 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tellaw-header-analyzer .tha-rule-card {
    border-radius: 6px;
    padding: 0.65rem 0.85rem;
    border: 1px solid #313244;
    background: #12111d;
}

.tellaw-header-analyzer .tha-rule-good    { border-color: rgba(166,227,161,0.22); }
.tellaw-header-analyzer .tha-rule-warn    { border-color: rgba(250,179,135,0.22); }
.tellaw-header-analyzer .tha-rule-missing { border-color: rgba(243,139,168,0.22); }
.tellaw-header-analyzer .tha-rule-na      { opacity: 0.55; }

.tellaw-header-analyzer .tha-rule-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.tellaw-header-analyzer .tha-icon {
    font-size: 0.78rem;
    font-weight: 800;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
    line-height: 1;
}

.tellaw-header-analyzer .tha-icon-good    { color: #a6e3a1; }
.tellaw-header-analyzer .tha-icon-warn    { color: #fab387; }
.tellaw-header-analyzer .tha-icon-missing { color: #f38ba8; }
.tellaw-header-analyzer .tha-icon-na      { color: #45475a; }

.tellaw-header-analyzer .tha-rule-label {
    font-size: 0.83rem;
    font-weight: 600;
    color: #cdd6f4;
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
}

.tellaw-header-analyzer .tha-rule-abbr {
    font-size: 0.66rem;
    color: #45475a;
    background: #313244;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    flex-shrink: 0;
}

.tellaw-header-analyzer .tha-rule-pts {
    font-size: 0.72rem;
    color: #6c7086;
    white-space: nowrap;
    flex-shrink: 0;
}

.tellaw-header-analyzer .tha-pts-na { color: #45475a; }

.tellaw-header-analyzer .tha-rule-detail {
    font-size: 0.78rem;
    color: #6c7086;
    margin: 0 0 0 1.55rem;
    line-height: 1.45;
    padding: 0;
    border: none;
    background: none;
}

.tellaw-header-analyzer .tha-rule-value {
    margin: 0.3rem 0 0 1.55rem;
    overflow-x: auto;
}

.tellaw-header-analyzer .tha-rule-value code {
    font-size: 0.72rem;
    color: #cba6f7;
    background: none;
    padding: 0;
    border: none;
    box-shadow: none;
    word-break: break-all;
    white-space: normal;
    font-family: 'Consolas', 'Monaco', monospace;
}

.tellaw-header-analyzer .tha-rule-advice {
    margin: 0.4rem 0 0 1.55rem;
    font-size: 0.77rem;
    color: #89b4fa;
    line-height: 1.55;
    padding: 0.38rem 0.65rem;
    background: rgba(137,180,250,0.06);
    border-left: 2px solid rgba(137,180,250,0.25);
    border-radius: 0 3px 3px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

/* ---- Headers list ---- */
.tellaw-header-analyzer .tha-headers-body {
    padding: 0.5rem 1.25rem 0.85rem;
    max-height: 280px;
    overflow-y: auto;
}

.tellaw-header-analyzer .tha-headers-body::-webkit-scrollbar       { width: 5px; }
.tellaw-header-analyzer .tha-headers-body::-webkit-scrollbar-track { background: #181825; }
.tellaw-header-analyzer .tha-headers-body::-webkit-scrollbar-thumb { background: #45475a; border-radius: 3px; }
.tellaw-header-analyzer .tha-headers-body::-webkit-scrollbar-thumb:hover { background: #585b70; }

.tellaw-header-analyzer .tha-headers-list {
    display: flex;
    flex-direction: column;
}

.tellaw-header-analyzer .tha-hdr-row {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.78rem;
    line-height: 1.55;
    padding: 0.2rem 0;
    border-bottom: 1px solid #181825;
    flex-wrap: wrap;
}

.tellaw-header-analyzer .tha-hdr-row:last-child { border-bottom: none; }

.tellaw-header-analyzer .tha-hdr-key {
    color: #89dceb;
    width: 200px;
    min-width: 200px;
    flex-shrink: 0;
    word-break: break-word;
}

.tellaw-header-analyzer .tha-hdr-val {
    color: #a6adc8;
    word-break: break-word;
    flex: 1;
}

.tellaw-header-analyzer .tha-hdr-warn {
    color: #fab387;
    font-size: 0.72rem;
    margin-left: 0.3rem;
    font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 620px) {
    .tellaw-header-analyzer .tha-url-row     { flex-direction: column; }
    .tellaw-header-analyzer .tha-btn         { width: 100%; justify-content: center; }
    .tellaw-header-analyzer .tha-summary     { flex-direction: column; align-items: flex-start; }
    .tellaw-header-analyzer .tha-hdr-key     { width: auto; min-width: 0; }
    .tellaw-header-analyzer .tha-hdr-row     { flex-direction: column; gap: 0; }
    .tellaw-header-analyzer .tha-header-hint { display: none; }
}
