/**
 * Estilos canónicos de la Calculadora de Opciones Black-Scholes y Griegas
 * Fijate Tools • Derivatives Studio
 */

:root {
  --bg-body: #0a0e17;
  --bg-card: #121826;
  --bg-card-subtle: #182234;
  --bg-card-hover: #1f2c42;
  --border-color: #26334d;
  --border-focus: #3b82f6;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent: #ff8507;
  --accent-glow: rgba(255, 133, 7, 0.18);
  --call-color: #10b981;
  --call-glow: rgba(16, 185, 129, 0.15);
  --put-color: #f59e0b;
  --put-glow: rgba(245, 158, 11, 0.15);
  --payoff-line: #38bdf8;
  --expiry-line: #94a3b8;
  --zero-line: #ef4444;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #f43f5e;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --font-mono: 'JetBrains Mono', monospace;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-card-hover: #e2e8f0;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --accent: #ea580c;
  --accent-glow: rgba(234, 88, 12, 0.12);
  --call-color: #059669;
  --call-glow: rgba(5, 150, 105, 0.12);
  --put-color: #d97706;
  --put-glow: rgba(217, 119, 6, 0.12);
  --payoff-line: #0284c7;
  --expiry-line: #64748b;
  --zero-line: #dc2626;
  --green: #059669;
  --yellow: #d97706;
  --red: #e11d48;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-wrapper.tool-layout {
  max-width: 1360px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
  width: 100%;
  flex: 1;
}

.tool-with-sidebar {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Presets Bar */
.card-presets {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.presets-header {
  margin-bottom: 0.65rem;
}

.presets-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.presets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-preset {
  background: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
}

.btn-preset:hover {
  border-color: var(--accent);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.btn-preset.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Card Inputs BSM */
.card-bsm-inputs {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.section-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.bsm-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 900px) {
  .bsm-inputs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .bsm-inputs-grid {
    grid-template-columns: 1fr;
  }
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 2.75rem 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.95rem;
  min-height: 40px;
  outline: none;
}

.form-input:focus {
  border-color: var(--border-focus);
}

.input-suffix {
  position: absolute;
  right: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.form-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text-main);
  font-size: 0.88rem;
  min-height: 40px;
  outline: none;
}

/* Tarjetas Precios CALL vs PUT */
.cards-prices-comparison {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .cards-prices-comparison {
    grid-template-columns: 1fr;
  }
}

.card-option-price {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-call {
  border-top: 4px solid var(--call-color);
}

.card-put {
  border-top: 4px solid var(--put-color);
}

.price-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-type-badge {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
}

.badge-call {
  background: var(--call-glow);
  color: var(--call-color);
  border: 1px solid var(--call-color);
}

.badge-put {
  background: var(--put-glow);
  color: var(--put-color);
  border: 1px solid var(--put-color);
}

.moneyness-tag {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.price-hero {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}

.price-currency {
  font-size: 1.4rem;
  color: var(--text-muted);
}

.price-val {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
}

.price-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.breakdown-label {
  color: var(--text-muted);
}

/* Tabla de Griegas */
.card-greeks {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-responsive-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.greeks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  text-align: left;
}

.greeks-table th, .greeks-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
}

.greeks-table th {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-weight: 600;
}

.greek-sym {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
}

.greek-explanation {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.font-mono {
  font-family: var(--font-mono);
}

.font-bold {
  font-weight: 700;
}

/* Constructor de Estrategias y Payoff */
.card-strategy-stage {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.strategy-selector-wrapper {
  min-width: 260px;
}

.strategy-svg-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow: hidden;
}

#payoff-svg {
  width: 100%;
  height: auto;
  min-height: 380px;
  display: block;
}

.strategy-metrics-footer {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

@media (max-width: 900px) {
  .strategy-metrics-footer {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.metric-box strong {
  font-size: 0.95rem;
  color: var(--text-main);
}

/* Paridad Put-Call */
.card-parity-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.badge-parity-ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid var(--green);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
}

.parity-values-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .parity-values-grid {
    grid-template-columns: 1fr;
  }
}

.parity-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.parity-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.parity-cell strong {
  font-size: 1rem;
  color: var(--text-main);
}

/* Modales */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 1rem;
}

.modal-dialog-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 40px;
}
