/* options-trading.css — iter21AT
 *
 * Styles for the Admin > Options Trading section.
 * Uses existing CSS variables from admin.css (--bg-primary, --bg-secondary,
 * --text-primary, --text-muted, --border-color, --accent) with sensible
 * fallbacks for the dark theme.
 */

/* Sub-nav (7 sub-tabs) */
.opt-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--border-color, #1f2937);
  margin: 12px 0 16px 0;
}

.opt-subnav-btn {
  padding: 8px 14px;
  background: transparent;
  color: var(--text-muted, #9ca3af);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  font-family: inherit;
}

.opt-subnav-btn:hover {
  color: var(--text-primary, #e5e7eb);
  background: var(--bg-secondary, #111827);
}

.opt-subnav-btn.active {
  color: var(--accent, #60a5fa);
  border-bottom-color: var(--accent, #60a5fa);
}

/* Panels */
.opt-panel {
  min-height: 200px;
  padding: 4px 0;
}

.opt-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted, #9ca3af);
  font-size: 14px;
  font-style: italic;
  background: var(--bg-secondary, #111827);
  border: 1px dashed var(--border-color, #1f2937);
  border-radius: 6px;
}

.opt-loading {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted, #9ca3af);
  font-size: 14px;
}

.opt-error {
  padding: 12px 16px;
  background: rgba(127, 29, 29, 0.2);
  border: 1px solid #b91c1c;
  color: #fca5a5;
  border-radius: 6px;
  font-size: 13px;
}

/* Cards */
.opt-card {
  padding: 10px 12px;
  background: var(--bg-secondary, #111827);
  border: 1px solid var(--border-color, #1f2937);
  border-radius: 6px;
}

.opt-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

/* Forms */
.opt-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--bg-secondary, #111827);
  border: 1px solid var(--border-color, #1f2937);
  border-radius: 6px;
}

.opt-form label {
  display: block;
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.opt-form input,
.opt-form select {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-primary, #0a0e1a);
  color: var(--text-primary, #e5e7eb);
  border: 1px solid var(--border-color, #1f2937);
  border-radius: 4px;
  font-size: 12px;
  box-sizing: border-box;
  font-family: inherit;
}

.opt-form input:focus,
.opt-form select:focus {
  outline: none;
  border-color: var(--accent, #60a5fa);
}

/* Chain table — 3-column calls/strike/puts layout */
.opt-chain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.opt-chain-table th {
  padding: 6px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border-color, #1f2937);
  color: var(--text-muted, #9ca3af);
  font-weight: 600;
  background: var(--bg-secondary, #111827);
  position: sticky;
  top: 0;
  z-index: 1;
}

.opt-chain-table td {
  padding: 4px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(31, 41, 55, 0.3);
}

.opt-chain-table tr:hover {
  background: rgba(96, 165, 250, 0.05);
}

/* IV environment color cues */
.opt-env-low      { color: #34d399; border-color: #34d399; }
.opt-env-normal   { color: #60a5fa; border-color: #60a5fa; }
.opt-env-high     { color: #fbbf24; border-color: #fbbf24; }
.opt-env-extreme  { color: #f87171; border-color: #f87171; }

/* IVR / IVP badges */
.opt-ivr-low      { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.opt-ivr-mid      { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.opt-ivr-high     { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.opt-ivr-extreme  { background: rgba(248, 113, 113, 0.15); color: #f87171; }

/* Recommendation cards */
.opt-recommendation {
  padding: 12px 16px;
  border-left: 4px solid var(--accent, #60a5fa);
  background: rgba(96, 165, 250, 0.05);
  border-radius: 4px;
  margin-bottom: 16px;
}

/* Dedicated Options page ticker search
 * Lives inside the Options Trading section header (NOT relocated to the
 * global nav). The global nav search retains its original behavior. */
.opt-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-secondary, #111827);
  border: 1px solid var(--border-color, #1f2937);
  border-radius: 6px;
  padding: 4px 6px;
  transition: border-color 0.15s ease;
}

.opt-search-wrap:focus-within {
  border-color: var(--accent, #60a5fa);
}

.opt-search-input {
  flex: 1;
  padding: 6px 8px;
  background: transparent;
  color: var(--text-primary, #e5e7eb);
  border: none;
  outline: none;
  font-size: 13px;
  font-family: inherit;
  min-width: 0;
}

.opt-search-input::placeholder {
  color: var(--text-muted, #9ca3af);
}

.opt-search-clear,
.opt-search-btn {
  background: transparent;
  border: none;
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.1s ease;
}

.opt-search-clear {
  font-size: 18px;
  line-height: 1;
}

.opt-search-clear:hover,
.opt-search-btn:hover {
  background: rgba(96, 165, 250, 0.1);
  color: var(--accent, #60a5fa);
}

.opt-search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-secondary, #111827);
  border: 1px solid var(--border-color, #1f2937);
  border-radius: 6px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.opt-search-suggestion {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-color, #1f2937);
  transition: background 0.1s ease;
}

.opt-search-suggestion:hover,
.opt-search-suggestion:focus {
  background: rgba(96, 165, 250, 0.1);
}

.opt-search-suggestion:last-child {
  border-bottom: none;
}

/* Options header row: title on left, search on right */
.opt-header-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .opt-header-row > .opt-search-wrap {
    flex: 1 1 100% !important;
    max-width: 100% !important;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .opt-subnav-btn {
    padding: 6px 10px;
    font-size: 12px;
  }
  .opt-cards {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
  .opt-chain-table {
    font-size: 11px;
  }
  .opt-chain-table th,
  .opt-chain-table td {
    padding: 4px 6px;
  }
}
