/*
=============================================================
  Fichier    : watchlist.css
  Projet     : Financial Analyzer
  Description: Styles de la page Watchlist et du bouton
               étoile dans l'en-tête du dashboard.
  Auteur     : Claude Marcel
  Version    : 1.0
  Date       : 2026-03-21
  Dépend de  : variables.css, main.css
=============================================================
*/

/* ==================== BOUTON ÉTOILE (DASHBOARD) ==================== */

.btn-watchlist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-watchlist:hover {
  background: var(--bg-hover);
  border-color: var(--accent-primary);
}

.btn-watchlist:active {
  transform: scale(0.92);
}

.btn-watchlist svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-muted);
  fill: none;
  transition: stroke 0.15s, fill 0.15s;
}

/* État actif : ticker dans la watchlist */
.btn-watchlist.is-saved svg {
  stroke: #f59e0b;
  fill: #f59e0b;
}

.btn-watchlist.is-saved:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.1);
}

/* Masqué si l'utilisateur n'est pas connecté */
.btn-watchlist.hidden {
  display: none;
}

/* ==================== PAGE WATCHLIST ==================== */

.watchlist-page {
  padding: 1.5rem;
  max-width: 1000px;
}

/* En-tête de la page */
.watchlist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.watchlist-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.watchlist-title svg {
  width: 22px;
  height: 22px;
  stroke: #f59e0b;
  fill: #f59e0b;
}

.watchlist-count {
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 2px 10px;
  margin-left: 8px;
}

/* Bouton Actualiser prix */
.btn-refresh-watchlist {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}

.btn-refresh-watchlist svg {
  width: 14px;
  height: 14px;
  transition: transform 0.4s;
}

.btn-refresh-watchlist.loading svg {
  animation: spin 0.8s linear infinite;
}

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

/* ==================== TABLEAU WATCHLIST ==================== */

.watchlist-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
}

.watchlist-table {
  width: 100%;
  border-collapse: collapse;
}

.watchlist-table th {
  padding: 10px 16px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.watchlist-table th.right {
  text-align: right;
}

.watchlist-table td {
  padding: 12px 16px;
  font-size: 0.88rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.watchlist-table tr:last-child td {
  border-bottom: none;
}

.watchlist-table tr:hover td {
  background: var(--bg-hover);
}

/* Cellule ticker */
.wl-ticker-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wl-ticker-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  overflow: hidden;
}

.wl-ticker-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.wl-ticker-symbol {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  display: block;
}

.wl-ticker-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* Colonnes prix */
.wl-price {
  font-weight: 600;
  font-size: 0.9rem;
  text-align: right;
}

.wl-change {
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
}

.wl-change.positive { color: var(--success); }
.wl-change.negative { color: var(--danger);  }

/* Bouton Analyser */
.wl-btn-analyze {
  font-size: 0.78rem;
  padding: 5px 12px;
  white-space: nowrap;
}

/* Bouton supprimer */
.wl-btn-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wl-btn-remove:hover {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.wl-btn-remove svg {
  width: 15px;
  height: 15px;
}

/* ==================== ÉTAT VIDE ==================== */

.watchlist-empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
}

.watchlist-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.35;
}

.watchlist-empty-icon svg {
  width: 100%;
  height: 100%;
  stroke: var(--text-muted);
  fill: none;
}

.watchlist-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.watchlist-empty-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==================== ÉTAT CHARGEMENT ==================== */

.wl-skeleton-row td {
  padding: 14px 16px;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .watchlist-page {
    padding: 1rem;
  }

  /* Masquer colonnes secondaires sur mobile */
  .watchlist-table th.hide-mobile,
  .watchlist-table td.hide-mobile {
    display: none;
  }

  .wl-ticker-name {
    max-width: 130px;
  }
}

@media (max-width: 480px) {
  .watchlist-title {
    font-size: 1.2rem;
  }
}
