/**
 * @package     T2Area
 * @subpackage  com_t2area
 * @copyright   Copyright (C) 2024. All rights reserved.
 * @license     GNU General Public License version 2 or later
 *
 * Head-to-Head Styles
 * Fichier: media/com_t2area/css/headtohead.css
 */

/* ==========================================================================
   Hero & Form
   ========================================================================== */

.h2h-hero {
  background: linear-gradient(135deg, var(--color-primary-darker, #0f172a), var(--color-primary, #1f3c88));
  color: #fff;
  padding: 4rem 0;
}

.h2h-hero__content {
  max-width: none;
  margin: 0;
  text-align: center;
}

.h2h-hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: .3em;
  font-size: .9rem;
  opacity: .85;
  margin: 0;
}

.h2h-hero__title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin: .5rem 0;
  color: #fff;
}

.h2h-hero__subtitle {
  font-size: 1.1rem;
  opacity: .9;
  margin-bottom: 2rem;
}

.h2h-form {
  background: rgba(255, 255, 255, .08);
  border-radius: 32px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(8px);
}

.h2h-gender-toggle {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 0.35rem;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.h2h-gender-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.h2h-gender-toggle label {
  cursor: pointer;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.2s ease, color 0.2s ease;
}

.h2h-gender-toggle input:checked + label {
  background: #fff;
  color: #0f172a;
}

.h2h-form__fields {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  gap: 1rem;
  align-items: end;
}

.h2h-form__field label {
  display: block;
  text-align: left;
  margin-bottom: .35rem;
  font-weight: 600;
  letter-spacing: .05em;
}

.h2h-form__field input[type="text"] {
  width: 100%;
  padding: .85rem 1rem;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  color: #111;
}

.h2h-form__vs {
  font-weight: 800;
  letter-spacing: 0.2em;
  font-size: 0.9rem;
  opacity: 0.8;
  padding: 0 0.35rem 0.75rem;
}

.h2h-preview {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.h2h-preview .card-item {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 1rem;
}

.h2h-preview .card-a {
  border-color: rgba(99, 102, 241, 0.5);
}

.h2h-preview .card-b {
  border-color: rgba(239, 71, 111, 0.5);
}

.h2h-preview .author {
  display: flex;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.h2h-preview__avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.h2h-preview__empty {
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.7;
  padding: 1.5rem 0;
}

.h2h-form__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (max-width: 40em) {
  .h2h-form__fields {
    grid-template-columns: 1fr;
  }

  .h2h-form__vs {
    justify-self: center;
    padding: 0;
  }

  .h2h-preview {
    grid-template-columns: 1fr;
  }
}

.h2h-button {
  border-radius: 999px;
  padding: 0.95rem 2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.h2h-button--primary {
  background: var(--color-accent, #ef476f);
  border: none;
  color: #fff;
  box-shadow: 0 15px 35px rgba(239, 71, 111, 0.35);
}

.h2h-button--ghost {
  border: 1px solid rgba(255, 255, 255, .6);
  color: #fff;
  text-decoration: none;
}

/* ==========================================================================
   Comparison Layout
   ========================================================================== */

.h2h-comparison {
  max-width: 1200px;
  margin: -3rem auto 2.5rem;
  padding: 0 1.5rem;
}

.h2h-comparison__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.h2h-player-card,
.h2h-scorecard {
  background: #fff;
  border-radius: 28px;
  padding: 2rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.h2h-player-card {
  background: linear-gradient(145deg, #101d52, #182b6f);
  color: #fff;
}

.h2h-player-card--b {
  background: linear-gradient(145deg, #611835, #882c52);
}

.h2h-player-card__header {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.h2h-player-card__avatar {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  background-size: cover;
  background-position: center;
  background-color: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.25);
}

.h2h-player-card__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  opacity: 0.7;
  margin: 0;
}

.h2h-player-card__meta {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

.h2h-player-card__stats {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.h2h-player-card__stats li {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 0.85rem;
  text-align: center;
}

.h2h-player-card__stats span {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}

.h2h-player-card__stats strong {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
}

.h2h-scorecard {
  background: linear-gradient(145deg, #f7fafc, #ffffff);
  border: 1px solid rgba(15, 23, 42, 0.08);
  text-align: center;
}

.h2h-scorecard__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: #64748b;
  margin: 0;
}

.h2h-scorecard__record {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: 1.5rem;
  align-items: center;
  margin: 1.5rem 0;
}

.h2h-scorecard__side {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.h2h-scorecard__value {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  color: #0f172a;
}

.h2h-scorecard__versus {
  font-size: 0.9rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: #94a3b8;
}

.h2h-scorecard__meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-size: 0.95rem;
  color: #475569;
}

.h2h-scorecard__latest {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
}

.h2h-scorecard__latest strong {
  display: block;
  color: #0f172a;
  margin-top: 0.35rem;
}

/* ==========================================================================
   Insight Metrics
   ========================================================================== */

.h2h-key-metrics {
  margin: 2.5rem calc(50% - 50vw) 0;
  width: 100vw;
  background: #fff;
  border-radius: 0;
  padding: 2.5rem 0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(15, 23, 42, 0.04);
}

.h2h-key-metrics__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.h2h-key-metrics h3 {
  margin: 0 0 1.5rem;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: #94a3b8;
}

.h2h-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.h2h-metric {
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 20px;
  padding: 1.25rem;
}

.h2h-metric__label {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 1rem;
}

.h2h-metric__values {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.h2h-metric__value {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.h2h-metric__athlete {
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.h2h-metric__value strong {
  font-size: 1.4rem;
  color: #0f172a;
}

.h2h-metric__value small {
  color: #64748b;
}

/* ==========================================================================
   Timeline
   ========================================================================== */

.h2h-timeline {
  max-width: 1200px;
  margin: 3rem auto 4rem;
  padding: 0 1.5rem;
}

.h2h-timeline__header {
  text-align: center;
  margin-bottom: 2rem;
}

.h2h-timeline__year-block {
  margin-bottom: 1.75rem;
}

.h2h-timeline__year {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.h2h-timeline__items {
  display: grid;
  gap: 1rem;
}

.h2h-timeline__item {
  background: #fff;
  border-radius: 22px;
  padding: 1.5rem;
  box-shadow: 0 15px 40px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(15, 23, 42, 0.05);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  align-items: center;
}

.h2h-timeline__item.is-winner-a {
  border-left: 4px solid #1f3c88;
}

.h2h-timeline__item.is-winner-b {
  border-left: 4px solid #ef476f;
}

.h2h-timeline__event h4 {
  margin: 0;
  font-size: 1.15rem;
  color: #0f172a;
}

.h2h-timeline__event span {
  color: #64748b;
  font-size: 0.9rem;
}

.h2h-timeline__scores {
  display: flex;
  gap: 1rem;
}

.h2h-timeline__competitor {
  flex: 1;
  text-align: center;
}

.h2h-timeline__name {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #94a3b8;
}

.h2h-timeline__rank {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
  color: #0f172a;
}

.h2h-timeline__time {
  display: block;
  font-size: 0.95rem;
  color: #475569;
}

.h2h-timeline__link {
  font-size: 0.85rem;
  color: var(--color-primary, #1f3c88);
  text-decoration: none;
  font-weight: 600;
}

.h2h-timeline__empty {
  text-align: center;
  color: #94a3b8;
  padding: 2rem;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  border-radius: 20px;
}

.h2h-empty {
  max-width: 640px;
  margin: 3rem auto;
  text-align: center;
  color: #64748b;
}

.h2h-form__hint {
  margin: 1.5rem auto 0;
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
}

/* ==========================================================================
   Form Field & Autocomplete
   ========================================================================== */

/* Positionnement relatif pour le champ parent */
[data-h2h-field] {
  position: relative;
}

/* Style pour l'input en état de recherche */
[data-h2h-autocomplete]:focus {
  outline: none;
  border-color: var(--h2h-primary-color, #2196f3);
}

/* Liste autocomplete */
.h2h-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: none;
}

/* Message d'information dans l'autocomplete */
.h2h-autocomplete__info {
  padding: 12px 16px;
  color: #666666;
  font-size: 14px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  background: #fafafa;
}

/* Message d'erreur */
.h2h-autocomplete__error {
  color: #d32f2f;
  background: #ffebee;
}

/* Item de l'autocomplete */
.h2h-autocomplete__item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s ease;
}

.h2h-autocomplete__item:last-child {
  border-bottom: none;
}

/* États hover et actif */
.h2h-autocomplete__item:hover,
.h2h-autocomplete__item.h2h-autocomplete__active {
  background-color: #f5f5f5;
}

/* Nom de l'athlète */
.h2h-autocomplete__name {
  font-weight: 600;
  font-size: 15px;
  color: #333333;
  margin-bottom: 4px;
  line-height: 1.4;
}

/* Mise en surbrillance du texte recherché */
.h2h-autocomplete__name mark {
  background-color: #ffd54f;
  color: inherit;
  font-weight: 700;
  padding: 0 2px;
  border-radius: 2px;
}

/* Métadonnées (club, nationalité) */
.h2h-autocomplete__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: #666666;
  line-height: 1.4;
}

.h2h-autocomplete__meta span {
  display: inline-flex;
  align-items: center;
}

.h2h-autocomplete__meta span:not(:last-child)::after {
  content: "•";
  margin-left: 8px;
  color: #cccccc;
}

/* ==========================================================================
   Animations
   ========================================================================== */

/* Animation d'apparition */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.h2h-autocomplete[style*="display: block"] {
  animation: slideDown 0.2s ease-out;
}

/* ==========================================================================
   Scrollbar personnalisée (Webkit uniquement)
   ========================================================================== */

.h2h-autocomplete::-webkit-scrollbar {
  width: 8px;
}

.h2h-autocomplete::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.h2h-autocomplete::-webkit-scrollbar-thumb {
  background: #cccccc;
  border-radius: 4px;
}

.h2h-autocomplete::-webkit-scrollbar-thumb:hover {
  background: #999999;
}

/* ==========================================================================
   Compatibilité UIKit
   ========================================================================== */

/* Ajustements pour les inputs UIKit si nécessaire */
.uk-form-controls [data-h2h-autocomplete] {
  width: 100%;
}

/* Évite les conflits avec les styles de formulaire UIKit */
.h2h-form .uk-input[data-h2h-autocomplete]:focus {
  border-color: var(--h2h-primary-color, #2196f3);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
  .h2h-autocomplete {
    max-height: 240px;
    font-size: 14px;
  }
  
  .h2h-autocomplete__item {
    padding: 10px 14px;
  }
  
  .h2h-autocomplete__name {
    font-size: 14px;
  }
  
  .h2h-autocomplete__meta {
    font-size: 12px;
    gap: 6px;
  }
}

/* ==========================================================================
   États d'accessibilité
   ========================================================================== */

/* Focus visible pour l'accessibilité */
.h2h-autocomplete__item:focus-visible {
  outline: 2px solid var(--h2h-primary-color, #2196f3);
  outline-offset: -2px;
}

/* Indication de chargement optionnelle */
.h2h-autocomplete__info.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid #e0e0e0;
  border-top-color: var(--h2h-primary-color, #2196f3);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

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

/* ==========================================================================
   Variantes de thème (optionnel)
   ========================================================================== */

/* Mode sombre (si votre site le supporte) */
@media (prefers-color-scheme: dark) {
  .h2h-autocomplete {
    background: #2a2a2a;
    border-color: #444444;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  .h2h-autocomplete__info {
    color: #cccccc;
    background: #1f1f1f;
    border-color: #444444;
  }
  
  .h2h-autocomplete__item {
    border-color: #444444;
  }
  
  .h2h-autocomplete__item:hover,
  .h2h-autocomplete__item.h2h-autocomplete__active {
    background-color: #333333;
  }
  
  .h2h-autocomplete__name {
    color: #ffffff;
  }
  
  .h2h-autocomplete__meta {
    color: #999999;
  }
  
  .h2h-autocomplete__name mark {
    background-color: #ff9800;
    color: #000000;
  }
}

/* ==========================================================================
   Print styles
   ========================================================================== */

@media print {
  .h2h-autocomplete {
    display: none !important;
  }
}
