/* Card Components */

/* Base Card */
.card {
  background-color: rgba(30, 41, 59, 0.95);
  border-radius: 1rem;
  /*border: 2px solid rgba(6, 182, 212, 0.4);*/
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  transition: all 0.3s ease-out;
  overflow: hidden;
  backdrop-filter: blur(8px);
  will-change: transform;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: rgba(6, 182, 212, 0.8);
  background-color: rgba(30, 41, 59, 0.98);
}

/* Card Sections */
.card-header {
  padding: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.card-header > div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
}

.card-body {
  padding: var(--space-xl);
  flex: 1;
}

.card-footer {
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(6, 182, 212, 0.3);
  display: flex;
  justify-content: left; /* Center the return indicators */
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap; /* allow small timestamp to wrap onto a new line */
}

/* Strategy Cards */
.strategy-card {
  @apply card;
  display: flex;
  flex-direction: column;
  background-color: rgba(30, 41, 59, 0.95);
  /*border: 2px solid rgba(6, 182, 212, 0.4);*/
  border-radius: 1rem;
  transition: all 0.3s ease-out;
  cursor: pointer;
  max-width: 100%;
  position: relative; /* allow absolutely positioned children like bookmark icon */
}

.strategy-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: rgba(6, 182, 212, 0.8);
  background-color: rgba(30, 41, 59, 0.98);
}

.share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  background-color: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto; /* Push to the right */
}

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

.share-btn svg {
  width: 16px;
  height: 16px;
}

/* Bookmark icon in header */
.bookmark-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background-color: transparent;
  color: var(--text-secondary); /* match card border (green) */
  cursor: pointer;
  transition: all 0.2s ease;
}

.bookmark-icon:hover {
  color: var(--text-muted);
}

.bookmark-icon svg {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  fill: transparent; /* default unfilled */
}

.bookmark-icon.active svg {
  stroke: var(--error);
  fill: var(--error); /* fill when active */
}

/* position icon at top-right inside the card */
.strategy-card .bookmark-icon {
  position: absolute;
  top: -3px; /* visually tucked to top border */
  right: 8px; /* close to right border */
  z-index: 2;
}

/* Capturing state */
.strategy-card.capturing {
  transform: none !important;
  box-shadow: none !important;
}

/* Hide certain elements during capture */
.strategy-card.capturing .share-btn,
.strategy-card.capturing .action-btn {
  display: none;
}

/* Card Grid - Fixed for desktop */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: stretch;
}

/* Remove hover effects from strategy cards */
.strategy-card {
  transition: none !important;
  cursor: default;
}

.strategy-card:hover {
  transform: none !important;
  box-shadow: none !important;
  border-color: rgba(148, 163, 184, 0.15) !important; /* keep original border */
  background-color: transparent !important;
}

/* Update the ticker badge and price positioning */
.ticker-badge {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  background-color: rgba(6, 182, 212, 0.15);
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(6, 182, 212, 0.3);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

/* Ticker symbol styling - ensure proper centering */
.ticker-symbol {
  text-align: center;
  width: 100%;
  display: block;
}

/* Price and change row container */
.ticker-price-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Completely reposition the ticker price to be below the ticker */
.ticker-price {
  position: relative;
  top: auto;
  right: auto;
  background-color: rgba(48, 98, 109, 0.95);
  color: #fff;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  padding: 0.15rem 0.4rem;
  border-radius: 0.4rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  display: block;
}

/* Ticker change percentage styling - now inline with price */
.ticker-change {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  padding: 0.1rem 0.3rem;
  border-radius: 0.3rem;
  white-space: nowrap;
  display: block;
  text-align: center;
}

.ticker-change.positive {
  background-color: rgba(34, 197, 94, 0.9);
  color: #fff;
}

.ticker-change.negative {
  background-color: rgba(239, 68, 68, 0.9);
  color: #fff;
}

/* Strategy Badges */
.strategy-badge {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
  white-space: nowrap; /* keep on one line */
}

.badge-call {
  background-color: var(--badge-call-bg);
  color: var(--badge-call-color);
  border-color: var(--badge-call-border);
}

.badge-put {
  background-color: var(--badge-put-bg);
  color: var(--badge-put-color);
  border-color: var(--badge-put-border);
}

.badge-callspread {
  background-color: var(--badge-callspread-bg);
  color: var(--badge-callspread-color);
  border-color: var(--badge-callspread-border);
}

.badge-putspread {
  background-color: var(--badge-putspread-bg);
  color: var(--badge-putspread-color);
  border-color: var(--badge-putspread-border);
}

/* Metrics Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.financial-metrics,
.risk-reward {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.metric {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
  font-weight: var(--font-weight-medium);
}

.metric-value {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.metric-value.highlight {
  color: var(--primary);
}

.metric-value.positive {
  color: var(--success);
}

.metric-value.negative {
  color: var(--error);
}

/* Divider */
.divider {
  height: 1px;
  background-color: var(--border-color);
  margin: var(--space-lg) 0;
}

/* Return Indicators - Fixed width and height */
.return-indicator {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem;
  margin: 0 0.25rem;
  border-radius: 1rem;
  /*box-shadow: 0 2px 8px 0 rgba(6, 182, 212, 0.15);*/
  border: 2px solid;
  transition: all 0.3s ease-out;
  min-width: 140px;
  width: 140px;
  min-height: 80px; /* Fixed height for consistency */
  height: 80px; /* Fixed height */
  text-align: center;
  flex-shrink: 0;
  justify-content: center; /* Center content vertically */
}

.return-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
  margin-bottom: 0.25rem;
  line-height: 1.2;
  word-wrap: break-word; /* Allow wrapping if needed */
}

.return-value {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  line-height: 1.1;
  word-wrap: break-word; /* Allow wrapping for very long values */
}

.return-high {
  background-color: var(--return-high-bg);
  color: var(--return-high-color);
  border-color: var(--return-high-border);
}

.return-medium {
  background-color: var(--return-medium-bg);
  color: var(--return-medium-color);
  border-color: var(--return-medium-border);
}

.return-low {
  background-color: var(--return-low-bg);
  color: var(--return-low-color);
  border-color: var(--return-low-border);
}

/* Hide analyze/action buttons only within strategy cards */
.strategy-card .analyze-btn,
.strategy-card button.analyze-btn,
.strategy-card a.analyze-btn,
.strategy-card .action-btn,
.strategy-card button.action-btn,
.strategy-card a.action-btn {
  display: none !important;
}

/* Stat Cards */
.stat-card {
  color: var(--primary);
  background-color: var(--bg-card);
  border-radius: 1rem;
  border: 1px solid var(--border-color);
  padding: 0.7rem 1.1rem;
  text-align: center;
  transition: all 0.3s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 56px;
  min-width: 120px;
}

.stat-card .stat-value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  width: 100%;
  text-align: center;
  letter-spacing: 0.01em;
}

.stat-card:hover {
  background-color: rgba(30, 41, 59, 0.93);
  border-color: var(--primary);
  box-shadow: 0 4px 12px 0 rgba(6, 182, 212, 0.15);
  transform: translateY(-2px);
}

.stat-card.highlight {
  color: var(--primary);
  background-color: var(--sidebar-active);
  border: none;
}

/* Stats Row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
  justify-content: center;
}

/* Loading State */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  color: var(--text-secondary);
  gap: var(--space-lg);
}

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border: 3px solid rgba(6, 182, 212, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

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

/* Timestamp */
.timestamp {
  color: #666;
  font-size: 0.9rem;
  text-align: right;
  margin-bottom: 1rem;
  margin-top: -0.5rem;
}

/* Responsive Adjustments */
@media (max-width: 1200px) {
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: var(--space-lg);
  }

  .return-indicator {
    min-width: 130px;
    width: 130px;
    min-height: 75px;
    height: 75px;
  }
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(1, minmax(308px, 420px));
    justify-content: center; /* keep card centered and not too wide */
    gap: 0.75rem;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding: 0.75rem 1rem;
  }

  .metrics-grid,
  .financial-metrics,
  .risk-reward {
    gap: 0.5rem;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  /* Reduce hover effects on mobile */
  .card:hover,
  .strategy-card:hover {
    transform: translateY(-2px);
  }

  .return-indicator {
    min-width: 120px;
    width: 120px;
    padding: 0.6rem 0.8rem;
    min-height: 70px;
    height: 70px;
  }

  .return-value {
    font-size: 1.3rem;
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(1, minmax(308px, 420px));
    justify-content: center;
    gap: 0.75rem;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding: 0.5rem 0.75rem;
  }

  /* Friendlier header layout on small screens */
  .strategy-card .card-header {
    flex-direction: row; /* keep in one line when possible */
    align-items: center;
    gap: 0.75rem;
  }

  .strategy-card .card-header > div:last-child {
    width: auto;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .strategy-card .share-btn {
    margin-left: auto; /* keep badge on same row and push share to right */
  }

  .metrics-grid,
  .financial-metrics,
  .risk-reward {
    gap: 0.5rem;
  }

  .return-value {
    font-size: 1.2rem;
  }

  .return-indicator {
    min-width: 110px;
    width: 110px;
    padding: 0.5rem 0.7rem;
    min-height: 65px;
    height: 65px;
  }
}

@media (max-width: 480px) {
  .card-grid {
    grid-template-columns: repeat(1, minmax(308px, 420px));
    justify-content: center;
    gap: 0.75rem;
  }

  .card-header,
  .card-body,
  .card-footer {
    padding: 0.5rem;
  }

  .return-indicator {
    padding: 0.4rem 0.6rem;
    min-width: 100px;
    width: 100px;
    min-height: 60px;
    height: 60px;
  }

  /* Tighten badge and header spacing further on very small screens */
  .strategy-card .card-header {
    gap: 0.5rem;
  }

  .strategy-badge {
    font-size: var(--font-size-xs);
    padding: 0.3rem 0.6rem;
  }

  .return-value {
    font-size: 1.1rem;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .card,
  .strategy-card,
  .return-indicator,
  .stat-card {
    transition: none;
  }

  .card:hover,
  .strategy-card:hover,
  .return-indicator:hover,
  .stat-card:hover {
    transform: none;
  }
}

/* ----------------------------------------------------
   Redesign Overrides (scoped to .strategy-card)
   Goal: visually match tmp/options_cards_redesign.html
   without changing markup
----------------------------------------------------- */

/* Card container */
.strategy-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 0.75rem;
  overflow: hidden; /* ensure header corners are rounded */
}

/* Header styling */
.strategy-card .card-header {
  background: linear-gradient(135deg, rgba(99, 241, 205, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  padding: 2rem 1rem 0.8rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

/* Ticker section inline with price/change */
.strategy-card .ticker-badge {
  background: transparent;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem; /* 12px */
}

.strategy-card .ticker-symbol {
  display: inline-block;
  width: auto;
  text-align: left;
  font-size: 1.25rem; /* 20px */
  font-weight: var(--font-weight-bold);
  color: #f1f5f9;
}

.strategy-card .ticker-price-row {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem; /* 6px */
}

.strategy-card .ticker-price {
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
  color: #cbd5e1;
  font-size: 1rem; /* 16px */
  font-weight: 600;
}

.strategy-card .ticker-change {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  padding: 0.25rem 0.5rem; /* 4px 8px */
  border-radius: 0.375rem; /* 6px */
  font-size: 0.8125rem; /* ~13px */
  font-weight: 600;
  display: inline-flex;
  align-items: center;
}

.strategy-card .ticker-change.negative {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

/* Strategy badge sizing */
.strategy-card .strategy-badge {
  font-size: 0.7rem;
  border-radius: 0.375rem;
  padding: 0.375rem 0.5rem;
  letter-spacing: 0.5px;
}

/* Body spacing */
.strategy-card .card-body {
  padding: 1.25rem; /* 20px */
}

.strategy-card .metrics-grid {
  gap: 1rem; /* 16px */
  margin-bottom: 1rem;
}

.strategy-card .financial-metrics,
.strategy-card .risk-reward {
  gap: 0.75rem; /* 12px */
  margin-top: 1rem;
}

/* Box the financial/risk items similar to redesign */
.strategy-card .financial-metrics .metric,
.strategy-card .risk-reward .metric {
  background: rgba(15, 23, 42, 0.6);
  padding: 0.625rem 0.75rem; /* 10px 12px */
  border-radius: 0.5rem; /* 8px */
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.strategy-card .metric-label {
  font-size: 0.6875rem; /* 11px */
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.strategy-card .metric-value {
  font-size: 1rem; /* 16px */
  font-weight: 600;
}

.strategy-card .divider {
  background: rgba(148, 163, 184, 0.1);
  margin: 1rem 0; /* 16px */
}

/* Footer returns section */
.strategy-card .card-footer {
  padding: 0.9rem 1.25rem;
  gap: 0.625rem;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.strategy-card .card-footer .return-indicators-row {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.strategy-card .card-footer .bookmark-timestamp {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 0.5rem;
}

.strategy-card .return-indicator {
  /*background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(217, 119, 6, 0.15) 100%);*/
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 0.5rem; /* 8px */
  padding: 0.75rem; /* 12px */
  min-width: 0 !important;
  width: auto !important;
  min-height: 0 !important;
  height: auto !important;
  flex: 1 1 0;
}

.strategy-card .return-label {
  font-size: 0.6875rem; /* 11px */
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-bottom: 0.375rem; /* 6px */
}

.strategy-card .return-value {
  font-size: 1.375rem; /* 22px */
  font-weight: 700;
}

.strategy-card .return-high {
  /*background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.15) 100%);*/
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(16, 185, 129, 0.3);
}


.strategy-card .return-low {
  /*background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.15) 100%);*/
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(239, 68, 68, 0.3);
}


