/* ============================================================
   styles-portfolio.css
   Design language: alineado con strategy_workspace.html
   Tipografía: Space Mono (mono) + DM Sans (sans)
   Escala: compacta y profesional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ── Variables: Light (default) ─────────────────────────────── */
:root {
  --bg-0:      #f0f2f7;
  --bg-1:      #ffffff;
  --bg-2:      #f5f6fa;
  --bg-3:      #eaecf3;
  --border:    rgba(0,0,0,0.08);
  --border-md: rgba(0,0,0,0.13);
  --text-1:    #111520;
  --text-2:    #4a5068;
  --text-3:    #9099b5;
  --accent:    #2d6ef5;
  --accent-2:  #00a873;
  --warn:      #d4890a;
  --danger:    #e0304a;
  --mono:      'Space Mono', monospace;
  --sans:      'DM Sans', sans-serif;
  --radius:    8px;
  --radius-lg: 12px;
}

/* ── Variables: Dark ────────────────────────────────────────── */
body.dark-mode {
  --bg-0:      #0a0e1a;
  --bg-1:      rgba(17, 24, 39, 0.7);
  --bg-2:      rgba(31, 41, 55, 0.6);
  --bg-3:      rgba(255,255,255,0.05);
  --border:    rgba(255,255,255,0.08);
  --border-md: rgba(255,255,255,0.14);
  --text-1:    #f9fafb;
  --text-2:    #a8b0c8;
  --text-3:    #7a82a0;
  --accent:    #3d7aff;
  --accent-2:  #00c98d;
  --warn:      #f5a623;
  --danger:    #ff4d6a;
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.37);
  --glass-glow:   0 0 20px rgba(61,122,255,0.15);
}

/* ── Dark mode: fondo con radial gradients estilo predictor ─── */
body.dark-mode .portfolio-container {
  background-image:
    radial-gradient(circle at 20% 50%, rgba(139, 92, 246, 0.07) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.07) 0%, transparent 50%);
}

/* ── Base ───────────────────────────────────────────────────── */
.portfolio-container {
  font-family: var(--sans);
  padding: 24px 0 40px;
  color: var(--text-1);
}

/* ── Header ─────────────────────────────────────────────────── */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.main-header h1 {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-1);
  margin: 0;
}

.main-header .subtitle {
  font-size: 0.78rem;
  color: var(--text-3);
  margin: 2px 0 0;
}

.header-left {
  display: flex;
  flex-direction: column;
}

/* Stats Bar */
.stats-bar {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  white-space: nowrap;
}

.stat-number {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Filter Controls ────────────────────────────────────────── */
.controls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.filter-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  background: var(--bg-3);
  border-color: var(--border-md);
  color: var(--text-1);
}

.filter-btn.active {
  background: rgba(61,122,255,0.15);
  border-color: rgba(61,122,255,0.4);
  color: var(--accent);
}

/* ── Category Section ───────────────────────────────────────── */
.category-section {
  margin-bottom: 32px;
}

.category-section.hidden {
  display: none;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.category-icon {
  font-size: 1rem;
  line-height: 1;
}

.category-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
}

.category-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-3);
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 20px;
}

/* ── Strategies Grid ─────────────────────────────────────────── */
.strategies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 0 4px;
}

/* ── Strategy Card ───────────────────────────────────────────── */
.strategy-card {
  position: relative;
  padding: 18px 20px;
  background: var(--bg-1);
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

body.dark-mode .strategy-card {
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.strategy-card:hover {
  background: var(--bg-2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

body.dark-mode .strategy-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45), 0 0 20px rgba(61,122,255,0.12);
  border-color: rgba(255,255,255,0.16);
}

.strategy-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.strategy-card.simple::before  { background: #00c98d; }
.strategy-card.medium::before  { background: #f5a623; }
.strategy-card.complex::before { background: #ff4d6a; }

.strategy-card:hover::before {
  opacity: 1;
}

/* Card Header */
.strategy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.strategy-code {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(61,122,255,0.1);
  border: 1px solid rgba(61,122,255,0.2);
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.status-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 6px var(--accent-2);
  animation: pulse 2.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* Card Name */
.strategy-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 10px;
  line-height: 1.4;
}

/* Meta Tags */
.strategy-meta {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.meta-tag {
  font-size: 0.68rem;
  padding: 3px 8px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  white-space: nowrap;
}

/* Risk Tags */
.risk-tag.risk-low    { border-color: rgba(0,201,141,0.3);  color: #00c98d; background: rgba(0,201,141,0.08); }
.risk-tag.risk-medium { border-color: rgba(245,166,35,0.3); color: #f5a623; background: rgba(245,166,35,0.08); }
.risk-tag.risk-high   { border-color: rgba(255,77,106,0.3); color: #ff4d6a; background: rgba(255,77,106,0.08); }

/* Expiration Tag */
.expiration-tag {
  border-color: rgba(61,122,255,0.3);
  color: var(--accent);
  background: rgba(61,122,255,0.08);
}

/* Management Tags */
.management-tag.management-set-forget {
  border-color: rgba(0,201,141,0.3);
  color: #00c98d;
  background: rgba(0,201,141,0.08);
}
.management-tag.management-tp-sl {
  border-color: rgba(245,166,35,0.3);
  color: #f5a623;
  background: rgba(245,166,35,0.08);
}
.management-tag.management-active {
  border-color: rgba(255,77,106,0.3);
  color: #ff4d6a;
  background: rgba(255,77,106,0.08);
}

/* Description */
.strategy-description {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-2);
  margin-bottom: 14px;
  min-height: 48px;
}

/* Footer */
.strategy-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.contributor {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 65%;
}

.complexity-badge {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.complexity-badge.simple  { color: #00c98d; background: rgba(0,201,141,0.1); border: 1px solid rgba(0,201,141,0.25); }
.complexity-badge.medium  { color: #f5a623; background: rgba(245,166,35,0.1); border: 1px solid rgba(245,166,35,0.25); }
.complexity-badge.complex { color: #ff4d6a; background: rgba(255,77,106,0.1); border: 1px solid rgba(255,77,106,0.25); }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 3px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .main-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .stats-bar {
    width: 100%;
  }

  .stat-item {
    flex: 1;
    justify-content: center;
  }

  .strategies-grid {
    grid-template-columns: 1fr;
  }
}
/* ── Badges de actividad en cards ───────────────────────────── */
.post-count-badge {
  font-size: 0.65rem;
  font-family: var(--mono);
  color: var(--text-3);
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 20px;
  white-space: nowrap;
}

.unread-badge {
  font-size: 0.68rem;
  font-weight: 700;
  font-family: var(--mono);
  color: #00c98d;
  background: rgba(0, 201, 141, 0.12);
  border: 1px solid rgba(0, 201, 141, 0.35);
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.03em;
  animation: unread-pulse 2.5s ease-in-out infinite;
  white-space: nowrap;
}

@keyframes unread-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}