/* ============================================================
   HISTORIQUE QUINTÉ+ — tqh-*
============================================================ */

/* Wrapper */
.tqh-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 60px;
    font-family: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── En-tête stats ── */
.tqh-header { margin: 28px 0 24px; }
.tqh-header-title { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.tqh-header-icon { font-size: 2rem; }
.tqh-title { font-size: 1.8rem; font-weight: 900; color: #0f172a; margin: 0 0 4px; }
.tqh-sub   { font-size: .9rem; color: #64748b; margin: 0; }
.tqh-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media(max-width:700px){ .tqh-stats { grid-template-columns: repeat(2,1fr); } }
@media(max-width:400px){ .tqh-stats { grid-template-columns: 1fr 1fr; } }
.tqh-stat {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 18px 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.tqh-stat-icon { display: block; font-size: 1.5rem; margin-bottom: 8px; }
.tqh-stat-val  { display: block; font-size: 1.6rem; font-weight: 900; color: #0f172a; margin-bottom: 4px; }
.tqh-stat-lbl  { display: block; font-size: .78rem; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* ── Sélecteur mois/année ── */
.tqh-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 14px 28px;
    border-radius: 14px;
    background: linear-gradient(135deg, #ffe8e8 0%, #fff5f5 100%);
    border: 1px solid #fecaca;
    margin-bottom: 20px;
}
.tqh-nav-arrow {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    color: #dc2626;
    text-decoration: none;
    font-weight: 700;
    transition: all .15s;
}
.tqh-nav-arrow:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.tqh-nav-label { font-size: 1.2rem; font-weight: 800; color: #0f172a; }
.tqh-year-form { display: inline; }
.tqh-year-sel {
    padding: 6px 10px; border-radius: 8px;
    border: 1px solid #fca5a5; background: #fff;
    font-size: .88rem; font-weight: 700; color: #0f172a;
    cursor: pointer;
}

/* ── Calendrier ── */
.tqh-cal { background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; overflow: hidden; }
.tqh-cal-head {
    display: grid;
    grid-template-columns: repeat(7,1fr);
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}
.tqh-cal-dh {
    padding: 10px;
    text-align: center;
    font-size: .8rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.tqh-cal-grid {
    display: grid;
    grid-template-columns: repeat(7,1fr);
}
.tqh-cal-cell {
    min-height: 96px;
    border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
    padding: 6px 6px 8px;
    position: relative;
}
.tqh-cal-cell:nth-child(7n) { border-right: none; }
.tqh-cal-empty { background: #fafafa; }
.tqh-cal-empty-day { background: #fff; }
.tqh-cal-today { background: #fffbeb; border: 2px solid #f59e0b !important; }
.tqh-cal-day-num {
    font-size: .85rem;
    font-weight: 700;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}
.tqh-cal-check { color: #22c55e; font-size: .8rem; }
.tqh-cal-content {
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-decoration: none;
    transition: opacity .15s;
}
.tqh-cal-content:hover { opacity: .85; }
.tqh-cal-hippo {
    font-size: .72rem;
    font-weight: 800;
    color: #004D25;
    line-height: 1.2;
}
.tqh-cal-libelle {
    font-size: .65rem;
    color: #475569;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tqh-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: .65rem;
    font-weight: 800;
    margin-top: 3px;
    width: fit-content;
}
.tqh-badge--green { background: #dcfce7; color: #166534; }
.tqh-badge--red   { background: #fee2e2; color: #dc2626; }

@media(max-width:640px){
    .tqh-cal-cell { min-height: 70px; }
    .tqh-cal-libelle { display: none; }
}

/* ── Vue détail ── */
.tqh-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 700;
    color: #475569;
    text-decoration: none;
    margin-bottom: 20px;
    transition: all .15s;
}
.tqh-back:hover { background: #f0fdf4; border-color: #bbf7d0; color: #004D25; }

.tqh-detail-hd {
    background: #004D25;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 16px;
    color: #fff;
}
.tqh-detail-date { font-size: 1.3rem; font-weight: 900; margin: 0 0 8px; color: #fff; }
.tqh-detail-meta { display: flex; gap: 16px; flex-wrap: wrap; font-size: .85rem; color: rgba(255,255,255,.8); }

.tqh-day-stats {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 12px;
    margin-bottom: 20px;
}
@media(max-width:540px){ .tqh-day-stats { grid-template-columns: 1fr 1fr; } }
.tqh-day-stat {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 16px;
    text-align: center;
}
.tqh-day-stat-lbl { display: block; font-size: .75rem; color: #64748b; margin-bottom: 6px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.tqh-day-stat-val { display: block; font-size: 1.4rem; font-weight: 900; color: #0f172a; }
.tqh-green { color: #16a34a; }
.tqh-red   { color: #dc2626; }

/* Sections */
.tqh-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}
.tqh-section-hd {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: .95rem;
    font-weight: 800;
}
.tqh-section-hd img { height: 24px; }
.tqh-section--arrival .tqh-section-hd { background: #f0fdf4; border-color: #bbf7d0; }

/* Grille chevaux sélection */
.tqh-horses {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 8px;
    padding: 16px;
}
@media(max-width:640px){ .tqh-horses { grid-template-columns: repeat(2,1fr); } }
@media(max-width:360px){ .tqh-horses { grid-template-columns: 1fr; } }

.tqh-horse {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    background: #f8fafc;
    position: relative;
}
.tqh-horse--placed {
    border-color: #86efac;
    background: linear-gradient(135deg,#f0fdf4,#fff);
}
.tqh-horse-num {
    width: 40px; height: 40px;
    border-radius: 10px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 1.1rem;
    font-weight: 900;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 6px;
    line-height: 1;
}
.tqh-horse-num sub { font-size: .55em; margin-left: 2px; }
.tqh-horse-num--green { background: #004D25; color: #fff; }
.tqh-horse-info { display: flex; flex-direction: column; gap: 2px; }
.tqh-horse-nom { font-size: .72rem; font-weight: 800; color: #0f172a; line-height: 1.3; }
.tqh-horse-role { font-size: .62rem; color: #94a3b8; font-weight: 600; }
.tqh-horse-iris {
    position: absolute;
    top: 4px; right: 4px;
    background: #004D25;
    color: #fff;
    font-size: .55rem;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 4px;
}

/* Cadenas */
.tqh-lock {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg,#004D25,#1a6e35);
    margin: 0;
    flex-wrap: wrap;
}
.tqh-lock-iris {
    width: 52px; height: 52px; border-radius: 50%;
    object-fit: cover; opacity: .7; flex-shrink: 0;
}
.tqh-lock-padlock { background: rgba(255,255,255,.2); border-radius: 50%; padding: 6px; }
.tqh-lock-title { font-size: .9rem; font-weight: 800; color: #fff; margin: 0 0 8px; }
.tqh-lock-btn {
    display: inline-block;
    padding: 7px 16px; border-radius: 8px;
    font-size: .82rem; font-weight: 700;
    text-decoration: none; margin-right: 8px;
    background: #fff; color: #004D25 !important;
    transition: opacity .15s;
}
.tqh-lock-btn--orange { background: #FF9800; color: #fff !important; }
.tqh-lock-btn:hover { opacity: .88; }

/* Avant course */
.tqh-pre-race {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 28px 20px; text-align: center;
}
.tqh-pre-race p { font-size: .9rem; color: #475569; margin: 0; }
.tqh-abo-cta {
    display: inline-block;
    background: #D97706; color: #fff !important;
    padding: 10px 22px; border-radius: 8px;
    font-size: .85rem; font-weight: 700;
    text-decoration: none; transition: opacity .15s;
}
.tqh-abo-cta:hover { opacity: .88; }

/* Cheval JSP */
.tqh-jsp-card {
    display: flex; align-items: center; gap: 16px;
    padding: 16px 20px;
    border-radius: 0;
}
.tqh-jsp-card--placed { background: linear-gradient(135deg,#f0fdf4,#fff); }
.tqh-jsp-card--np     { background: #fff; }
.tqh-jsp-num {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem; font-weight: 900;
    flex-shrink: 0;
}
.tqh-jsp-num--placed { background: #004D25; color: #fff; }
.tqh-jsp-num--np     { background: #dc2626; color: #fff; }
.tqh-jsp-info { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.tqh-jsp-nom  { font-size: .95rem; font-weight: 800; color: #0f172a; }
.tqh-jsp-cote { font-size: .8rem; color: #64748b; }
.tqh-jsp-result {
    padding: 5px 12px; border-radius: 6px;
    font-size: .82rem; font-weight: 800;
}

/* Arrivée officielle */
.tqh-arrival-top5 {
    display: flex; gap: 10px; flex-wrap: wrap;
    padding: 16px 20px;
}
.tqh-arr-horse {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    min-width: 52px;
}
.tqh-arr-horse--iris .tqh-arr-num { background: #004D25; color: #fff; }
.tqh-arr-ord   { font-size: .7rem; color: #94a3b8; font-weight: 700; }
.tqh-arr-num   {
    width: 44px; height: 44px; border-radius: 10px;
    background: #f1f5f9; color: #475569;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; font-weight: 900;
}
.tqh-arr-label { font-size: .6rem; color: #004D25; font-weight: 800; }

.tqh-arrival-full {
    border-top: 1px solid #e2e8f0;
    padding: 12px 20px;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.tqh-arrival-full-lbl { font-size: .78rem; color: #64748b; font-weight: 700; flex-shrink: 0; }
.tqh-arrival-full-nums { display: flex; flex-wrap: wrap; gap: 6px; }
.tqh-arr-num-sm {
    width: 32px; height: 32px; border-radius: 8px;
    background: #f1f5f9; color: #475569;
    display: flex; align-items: center; justify-content: center;
    font-size: .82rem; font-weight: 800;
}
.tqh-arr-num-sm--iris { background: #004D25; color: #fff; }

.tqh-error { padding: 40px; text-align: center; color: #dc2626; font-weight: 700; }


/* ── JSP cheval dans cellule calendrier ── */
.tqh-cal-jsp {
    font-size: .64rem;
    color: #D97706;
    font-weight: 700;
    font-style: italic;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Cellule verrouillée (avant course) ── */
.tqh-horse--locked {
    border: 1px dashed #e2e8f0;
    background: linear-gradient(135deg, #004D25 0%, #1a6e35 100%);
    position: relative;
}
.tqh-horse-lock-wrap {
    position: relative;
    width: 44px; height: 44px;
    flex-shrink: 0;
    margin: 0 auto 6px;
}
.tqh-horse-lock-iris {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    opacity: .65;
    display: block;
}
.tqh-horse-lock-pad {
    position: absolute;
    bottom: -3px; right: -3px;
    background: rgba(0,0,0,.4);
    border-radius: 50%;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
}
.tqh-horse--locked .tqh-horse-info { align-items: center; }
.tqh-horse-nom--blur { color: rgba(255,255,255,.3); letter-spacing: .1em; }
.tqh-horse--locked .tqh-horse-role { color: rgba(255,255,255,.5); }

/* ── Invite abonnement sous grille verrouillée ── */
.tqh-sub-invite {
    text-align: center;
    padding: 16px 20px 20px;
    border-top: 1px solid #e2e8f0;
}
.tqh-sub-invite p { font-size: .88rem; color: #64748b; margin: 0 0 12px; }
