/* Page & Structure globale */
.investment-page {
  background: rgba(5, 11, 20, 0.35);
}

.investment-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 2.2rem 0 3rem;
}

/* En-tête */
.investment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.8rem;
}

.investment-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.investment-header h1 {
  margin: 0;
  font-size: clamp(2rem, 2.7vw, 3rem);
  color: #f8fafc;
}

.investment-button {
  border: 1px solid rgba(125, 211, 252, 0.25);
  background: rgba(14, 165, 233, 0.09);
  color: #e2f3ff;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.investment-button:hover {
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(125, 211, 252, 0.4);
}

/* Cartes de résumé supérieures (3 colonnes) */
.summary-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  margin-bottom: 2rem;
}

.summary-card {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 18px;
  padding: 1.4rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
}

.summary-card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 0.8rem;
  color: #94a3b8;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.summary-card-value {
  font-size: clamp(1.6rem, 2.2vw, 2.3rem);
  font-weight: 800;
  color: #f8fafc;
}

/* Couleurs de variation (Gain vs Perte) */
.text-positive {
  color: #4ade80 !important;
}

.text-negative {
  color: #f87171 !important;
}

/* Filtre du portefeuille */
.portfolio-filter {
  margin-bottom: 1.2rem;
}

.portfolio-filter-label {
  display: block;
  margin-bottom: 0.5rem;
  color: #cbd5e1;
  font-size: 0.85rem;
  font-weight: 700;
}

.portfolio-filter-control {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: min(100%, 430px);
  min-height: 46px;
  box-sizing: border-box;
  padding: 0 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.78);
  color: #94a3b8;
}

.portfolio-filter-control:focus-within {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
  border-color: #38bdf8;
}

.portfolio-filter-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f8fafc;
  font: inherit;
}

.portfolio-filter-input::placeholder {
  color: #64748b;
}

.portfolio-filter-input::-webkit-search-cancel-button {
  cursor: pointer;
}

.portfolio-filter-status {
  min-height: 1.2em;
  margin: 0.5rem 0 0;
  color: #94a3b8;
  font-size: 0.8rem;
}

.stock-card[hidden] {
  display: none;
}

.portfolio-filter-empty {
  margin-top: 1.2rem;
}

/* Grille des cartes d'actions */
.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.2rem;
}

.stock-card {
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 18px;
  padding: 1.4rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stock-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.4);
}

/* Bordure supérieure verte ou rouge selon la plus-value */
.stock-card.card-positive {
  border-top: 4px solid #4ade80;
}

.stock-card.card-negative {
  border-top: 4px solid #f87171;
}

/* Header d'une carte d'action */
.stock-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.4rem;
}

.stock-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 6px 0;
}

.stock-symbol-badge {
  display: inline-block;
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

/* Badges de pourcentage */
.stock-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-positive {
  background-color: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge-negative {
  background-color: rgba(248, 113, 113, 0.15);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.3);
}

/* Données internes */
.stock-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 1.1rem;
  column-gap: 1rem;
  margin-bottom: 1.4rem;
}

.data-group {
  display: flex;
  flex-direction: column;
}

.data-group.align-right {
  text-align: right;
}

.data-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.data-value-large {
  font-size: 1.4rem;
  font-weight: 800;
  color: #f8fafc;
}

.data-value-medium {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e8f0;
}

.data-value-bold {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
}

/* Boutons de revente */
.stock-card-action {
  width: 100%;
}

.btn-sell-card {
  width: 100%;
  padding: 0.75rem;
  background: rgba(30, 41, 59, 0.8);
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-sell-card:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(148, 163, 184, 0.4);
}

/* État vide */
.empty-state {
  border: 1px dashed rgba(148, 163, 184, 0.23);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.32);
  padding: 2.5rem 1rem;
  text-align: center;
}

.empty-state p {
  margin: 0 0 1rem 0;
  color: #cbd5e1;
}

.btn-discover {
  display: inline-block;
  padding: 0.7rem 1.4rem;
  background: rgba(14, 165, 233, 0.15);
  border: 1px solid rgba(125, 211, 252, 0.3);
  color: #7dd3fc;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-discover:hover {
  background: rgba(14, 165, 233, 0.25);
  border-color: rgba(125, 211, 252, 0.5);
}


.sell-controls { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.55rem; margin-top: auto; }
.sell-quantity { width: 100%; box-sizing: border-box; min-height: 40px; padding: 0.55rem 0.7rem; border: 1px solid rgba(148, 163, 184, 0.3); border-radius: 9px; background: rgba(2, 6, 23, 0.55); color: #f8fafc; font: inherit; }
.sell-quantity:focus { outline: 2px solid #38bdf8; outline-offset: 2px; }
.sell-confirm-dialog { position: fixed; width: min(440px, calc(100% - 36px)); max-width: none; padding: 2rem; border: 1px solid rgba(148, 163, 184, 0.2); border-radius: 20px; background: #0f172a; color: #e2e8f0; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55); }
.sell-confirm-dialog::backdrop { background: rgba(2, 6, 23, 0.78); backdrop-filter: blur(5px); }
.sell-dialog-close-form { position: absolute; top: 0.7rem; right: 0.7rem; }
.sell-dialog-close { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: rgba(148, 163, 184, 0.12); color: #cbd5e1; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.sell-dialog-icon { display: grid; width: 2.8rem; height: 2.8rem; place-items: center; margin-bottom: 1rem; border-radius: 12px; background: rgba(248, 113, 113, 0.14); color: #fca5a5; font-size: 1.5rem; }
.sell-confirm-dialog h2 { margin: 0.25rem 0 0.7rem; color: #f8fafc; font-size: 1.4rem; }
.sell-dialog-description { margin: 0; color: #94a3b8; line-height: 1.6; }
.sell-dialog-proceeds { margin: 1rem 0 0; color: #7dd3fc; font-weight: 700; }
.sell-dialog-actions { display: flex; justify-content: flex-end; gap: 0.7rem; margin-top: 1.6rem; }
.sell-dialog-cancel, .sell-dialog-confirm { min-height: 42px; padding: 0.65rem 1rem; border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; }
.sell-dialog-cancel { border: 1px solid rgba(148, 163, 184, 0.25); background: transparent; color: #cbd5e1; }
.sell-dialog-confirm { border: 1px solid #dc2626; background: #dc2626; color: #fff; }
.sell-dialog-confirm:hover:not(:disabled) { background: #b91c1c; }
.sell-dialog-confirm:disabled { cursor: wait; opacity: 0.65; }
.investment-feedback[hidden] { display: none; }
.investment-feedback.is-error { display: block; margin-bottom: 1rem; padding: 0.8rem 1rem; border: 1px solid rgba(248, 113, 113, 0.4); border-radius: 10px; background: rgba(127, 29, 29, 0.22); color: #fecaca; }
@media (max-width: 420px) { .sell-confirm-dialog { padding: 1.5rem; } .sell-dialog-actions { flex-direction: column-reverse; } .sell-dialog-actions button { width: 100%; } }

/* Adaptabilité Mobile */
@media (max-width: 980px) {
  .summary-cards-grid {
    grid-template-columns: 1fr;
  }

  .investment-header {
    flex-direction: column;
    align-items: flex-start;
  }
}