/*!
 * Xixou Community Suite — Styles
 * Thème sombre discret, barres horizontales animées + toast.
 */

/* Conteneur générique */
.xcs{
  border:1px solid #202733;
  padding:16px;
  border-radius:12px;
  background:#0b0f14;
  color:#e7e8ec;
}

/* Titres / métas / infos */
.xcs-title{margin:0 0 8px;font-weight:700;line-height:1.2}
.xcs-meta,.xcs-notice,.xcs-ended,.xcs-voted{margin:8px 0;font-size:.92rem;opacity:.9}

/* Formulaire sondage */
.xcs-options{display:grid;gap:8px;margin:12px 0}
.xcs-option{
  display:flex;align-items:center;gap:8px;
  padding:8px;border:1px solid #202733;border-radius:10px;
  background:#0e131b;
}
.xcs-option input{transform:scale(1.1)}
.xcs-btn{
  padding:10px 14px;border-radius:10px;border:0;cursor:pointer;
  background:#3b82f6;color:#0b0f14;font-weight:700;
}
.xcs-btn:disabled{opacity:.7;cursor:not-allowed}
.xcs-msg{margin-top:8px;min-height:1.2em}

/* Résultats */
.xcs-results{display:grid;gap:12px;margin-top:12px}
.xcs-result-line{
  display:grid;
  grid-template-columns:1fr auto 90px; /* label | barre | chiffres */
  gap:10px;align-items:center;
}
.xcs-label{min-width:0}
.xcs-bar{
  position:relative;height:12px;background:#1b2230;border-radius:999px;overflow:hidden;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.03);
}
.xcs-bar span{
  display:block;height:100%;background:#3b82f6;width:0%;
  transition:width .5s ease;
}
.xcs-bar .xcs-pct{
  position:absolute;inset:0;display:flex;align-items:center;justify-content:center;
  font-size:.8rem;opacity:.9;pointer-events:none
}
.xcs-numbers{font-variant-numeric:tabular-nums;opacity:.9}
.xcs-total{margin-top:6px;opacity:.8}

/* Checkbox règlement */
.xcs-terms{margin:12px 0;display:flex;gap:8px;align-items:center}
.xcs-terms a{color:#8ab4ff;text-decoration:underline}

/* Archive cards */
.xcs-archive-item{
  background:#0e131b;border:1px solid #202733;border-radius:10px;padding:12px;
}

/* Toast (pop-up) */
.xcs-toast{
  position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(12px);
  background:#111926;color:#e7e8ec;border:1px solid #263041;border-radius:10px;
  padding:10px 14px;z-index:99999;box-shadow:0 8px 30px rgba(0,0,0,.35);
  opacity:0;transition:opacity .2s ease, transform .2s ease;
}
.xcs-toast.is-in{opacity:1;transform:translateX(-50%) translateY(0)}

/* Flash outline après MAJ (accessibilité visuelle) */
.xcs-flash{outline:2px solid #3b82f6;outline-offset:2px}

/* Petites adaptations responsive */
@media (max-width:600px){
  .xcs-result-line{grid-template-columns:1fr}
  .xcs-numbers{justify-self:end}
}


/* ===== Mobile-friendly overrides (v0.1, 2025-11-06) ===== */
@media (max-width: 768px) {
  .xcs, .xcs * { -webkit-tap-highlight-color: transparent; }

  .xcs-container, .xcs-wrap, .xcs-hub {
    padding-left: 12px;
    padding-right: 12px;
  }

  .xcs-hero-box {
    padding: 14px 16px;
    border-radius: 14px;
  }
  .xcs-hero-title {
    font-size: 1.1rem;
    line-height: 1.25;
  }
  .xcs-hero-sub, .xcs-hint {
    font-size: .95rem;
  }

  /* Cards stack full-width with comfy spacing */
  .xcs-card, .xcs-hub-item, .xcs-archive-item {
    border-radius: 14px;
    padding: 14px;
    margin: 10px 0;
  }

  /* Grids collapse to one column */
  .xcs-grid, .xcs-hub-grid, .xcs-results-grid {
    display: block !important;
  }

  /* Vote choices: text on top, bar below, big tap target */
  .xcs-choice {
    display: block;
    margin: 12px 0;
  }
  .xcs-option {
    display: block;
    padding: 12px;
    border-radius: 12px;
  }
  .xcs-label {
    display: block;
    margin-bottom: 8px;
  }
  .xcs-label-text {
    display: block;
    font-size: 1rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: anywhere;
  }

  /* Results row uses two lines on small screens to avoid cramped numbers */
  .xcs-result {
    display: block;
  }
  .xcs-result-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
  }
  .xcs-result-count, .xcs-result-percent {
    flex: 0 0 auto;
    font-weight: 700;
    white-space: nowrap;
  }
  .xcs-bar {
    height: 18px;
    border-radius: 999px;
  }

  /* Buttons and actions are thumb-friendly */
  .xcs-actions, .xcs-footer-actions {
    position: sticky;
    bottom: 0;
    padding: 10px 0 6px;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(6,10,15,.9) 35%, rgba(6,10,15,1) 100%);
    backdrop-filter: blur(6px);
    margin-top: 8px;
  }
  .xcs-btn, .xcs-button, .xcs-cta {
    min-height: 44px;
    line-height: 44px;
    font-size: 1rem;
    border-radius: 999px;
    width: 100%;
    display: block;
    text-align: center;
  }

  /* Meta rows and badges wrap gracefully */
  .xcs-meta, .xcs-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
  }
  .xcs-badge {
    font-size: .9rem;
    padding: 6px 9px;
    border-radius: 999px;
  }

  /* Reduce excessive shadows/halos on small screens */
  .xcs-halo, .xcs-glow {
    filter: blur(6px) saturate(1.1);
  }

  /* Tables → stack */
  .xcs-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .xcs-table th, .xcs-table td {
    padding: 10px 8px;
    font-size: .95rem;
    white-space: nowrap;
  }
}

/* Ultra-small phones */
@media (max-width: 360px) {
  .xcs-hero-title { font-size: 1rem; }
  .xcs-label-text { font-size: .95rem; }
  .xcs-result-count, .xcs-result-percent { font-size: .95rem; }
}


/* ===== Mobile polish for vote bars + poll delimitation (v0.2, 2025-11-06) ===== */
@media (max-width: 768px) {
  /* Prettier rounded rail with subtle border + padding to avoid flat look */
  .xcs-result-line .xcs-bar,
  .xcs-bar {
    position: relative;
    height: 22px;
    padding: 2px;                 /* inner gutter for the SVG */
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.12));
    border: 1px solid rgba(255,255,255,.08);
    overflow: hidden;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,.06),
      inset 0 -1px 0 rgba(0,0,0,.25);
  }
  .xcs-bar .xcs-svgbar {
    display: block;
    width: 100%;
    height: 18px !important;      /* slightly smaller than container height to reveal rail edge */
  }

  /* Winner glow (if any) appears softer on mobile */
  .xcs-bar.winner,
  .xcs-result-line.winner .xcs-bar {
    box-shadow:
      0 0 0 2px rgba(255,215,120,.10),
      inset 0 1px 0 rgba(255,255,255,.08),
      inset 0 -1px 0 rgba(0,0,0,.25);
    border-color: rgba(255,215,120,.28);
  }

  /* Stronger card delimitation between polls */
  .xcs-card,
  .xcs-archive-item,
  .xcs-hub-item,
  .xcs-poll {
    position: relative;
    border-radius: 16px !important;
    border: 1px solid #202733 !important;
    background: radial-gradient(120% 120% at 50% 0%, rgba(255,215,120,.06), rgba(8,12,18,1) 60%);
    box-shadow:
      0 4px 18px rgba(0,0,0,.35),
      0 0 0 1px rgba(255,255,255,.02);
    padding: 14px !important;
    margin: 14px 0 !important;
  }

  /* Gold accent bar on the left for a clear separation between polls */
  .xcs-card::before,
  .xcs-archive-item::before,
  .xcs-hub-item::before,
  .xcs-poll::before {
    content: "";
    position: absolute;
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, #F7E29A, #CBA542);
    box-shadow: 0 0 8px rgba(255,215,120,.35);
    opacity: .9;
  }

  /* Slightly bigger labels for readability + spacing */
  .xcs-label-text {
    font-size: 1.05rem;
    line-height: 1.35;
    letter-spacing: .1px;
  }

  /* Numbers line sits above the bar for clarity on small screens */
  .xcs-numbers,
  .xcs-result .xcs-numbers {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: 700;
  }
  .xcs-votes, .xcs-pct, .xcs-count {
    white-space: nowrap;
  }
}


/* ===== Encadrement fort des sondages + barres adoucies (v0.3, 2025-11-06) ===== */
.xcs-card,
.xcs-archive-item,
.xcs-hub-item,
.xcs-poll {
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.08);
  background:
    radial-gradient(140% 120% at 50% 0%, rgba(255,225,150,.05), rgba(8,12,18,1) 60%),
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.25));
  box-shadow:
    0 10px 30px rgba(0,0,0,.35),
    0 0 0 1px rgba(255,255,255,.02);
  padding: 18px;
  margin: 18px 0;
  position: relative;
  overflow: hidden;
}
/* Filet doré discret + coin supérieur gauche “bookmark” pour séparer visuellement */
.xcs-card::before,
.xcs-archive-item::before,
.xcs-hub-item::before,
.xcs-poll::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  background: linear-gradient(180deg, #F4E19C, #C99F3C);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255,215,120,.25);
}
.xcs-card::after,
.xcs-archive-item::after,
.xcs-hub-item::after,
.xcs-poll::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 26%;
  height: 6px;
  background: linear-gradient(90deg, rgba(255,215,120,.55), rgba(255,215,120,0));
  border-bottom-right-radius: 999px;
  opacity: .6;
}

/* Barres de votes (desktop + mobile) — look plus doux et parfaitement arrondi */
.xcs-bar {
  position: relative;
  height: 22px;
  padding: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.14));
  border: 1px solid rgba(255,255,255,.08);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    inset 0 -1px 0 rgba(0,0,0,.25);
}
.xcs-bar .xcs-svgbar {
  display: block;
  width: 100%;
  height: 18px !important;
}

/* Variante vainqueur : halo léger, pas agressif */
.xcs-result-line.winner .xcs-bar,
.xcs-bar.winner {
  border-color: rgba(255,215,120,.28);
  box-shadow:
    0 0 0 2px rgba(255,215,120,.10),
    inset 0 1px 0 rgba(255,255,255,.08),
    inset 0 -1px 0 rgba(0,0,0,.25);
}

/* Ligne des nombres au-dessus de la barre */
.xcs-numbers {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 700;
}

/* Responsive affinements */
@media (max-width: 768px) {
  .xcs-card,
  .xcs-archive-item,
  .xcs-hub-item,
  .xcs-poll {
    border-radius: 16px;
    margin: 14px 0;
    padding: 14px;
  }
  .xcs-bar { height: 22px; padding: 2px; }
  .xcs-bar .xcs-svgbar { height: 18px !important; }
  .xcs-label-text { font-size: 1.05rem; line-height: 1.35; }
}


/* ===== v0.4 — Bar thinness + smooth roundness (2025-11-06) ===== */
.xcs-bar {
  height: 18px;
  padding: 1px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.12));
  border: 1px solid rgba(255,255,255,.08);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    inset 0 -1px 0 rgba(0,0,0,.22);
}
.xcs-bar .xcs-svgbar { height: 16px !important; }

@media (max-width: 768px) {
  .xcs-bar { height: 16px; padding: 1px; }
  .xcs-bar .xcs-svgbar { height: 14px !important; }
}

/* Reduce visual aggressiveness for winner */
.xcs-result-line.winner .xcs-bar,
.xcs-bar.winner {
  border-color: rgba(255,215,120,.22);
  box-shadow:
    0 0 0 1px rgba(255,215,120,.10),
    inset 0 1px 0 rgba(255,255,255,.06),
    inset 0 -1px 0 rgba(0,0,0,.22);
}


/* Stronger separation between polls on mobile */
@media (max-width: 768px) {
  .xcs-card, .xcs-archive-item, .xcs-hub-item, .xcs-poll {
    box-shadow:
      0 10px 24px rgba(0,0,0,.35),
      0 0 0 1px rgba(255,255,255,.03);
    margin: 16px 0;
    padding: 16px;
  }
  .xcs-card::before, .xcs-archive-item::before, .xcs-hub-item::before, .xcs-poll::before {
    width: 4px;
    left: -1px;
  }
}
