/* ==============================================================================
   MY STOCKS - COMPONENTS STYLESHEET
   Cards, Tabelas Densas, Modais, Barras de Nível e Formulários
   ============================================================================== */

/* ==============================================================================
   1. KPI SUMMARY CARDS (INVESTIDOR10 + STOCKS MONITOR INSPIRED)
   ============================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease;
}

.kpi-card:hover {
  border-color: var(--primary-border);
  transform: translateY(-1px);
}

.kpi-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
}

.kpi-sub {
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.kpi-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
}

.badge-up {
  background: var(--success-bg);
  color: var(--success);
}

.badge-down {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-neutral {
  background: var(--neutral-bg);
  color: var(--muted);
}

/* ==============================================================================
   2. HIGH-DENSITY DATA TABLE (STICKY TICKER & HIGH PERFORMANCE)
   ============================================================================== */
.table-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.table-search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--r-md);
  min-width: 220px;
}

.table-search-box input {
  border: none;
  background: transparent;
  width: 100%;
  font-size: 12px;
}

.table-search-box input:focus {
  outline: none;
}

.table-wrapper {
  overflow: auto;
  max-height: calc(100vh - 180px);
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  user-select: none;
  cursor: pointer;
  box-shadow: 0 1px 0 var(--border);
}

.data-table thead th:hover {
  color: var(--text);
}

.data-table th.th-right, .data-table td.td-right {
  text-align: right;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--divider);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  transition: background .12s ease, color .12s ease;
  background: var(--surface);
}

.data-table tbody tr:hover td {
  background: var(--row-hover-bg) !important;
}

/* Coluna Sticky de Ticker */
.sticky-col {
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 10;
  font-weight: 700;
  font-family: var(--font-mono);
  box-shadow: 2px 0 5px rgba(0,0,0,0.05);
  transition: background .12s ease;
}

.data-table thead th.sticky-col,
.data-table th.sticky-col {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 30 !important;
  background: var(--surface-2) !important;
  box-shadow: 2px 1px 0 var(--border);
}

.data-table tbody td.sticky-col,
.data-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 12;
  background: var(--surface);
}

.data-table tbody tr:hover td.sticky-col,
.data-table tbody tr:hover .sticky-col {
  background: var(--row-hover-bg) !important;
}

.ticker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 12px;
  color: var(--text);
}

.ticker-class-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: var(--r-sm);
  background: var(--neutral-bg);
  color: var(--muted);
  text-transform: uppercase;
}

/* Quick Select Chips */
.btn-chip {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-chip:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-hover);
}

.btn-chip.active {
  background: var(--primary);
  color: #000 !important;
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 0 8px rgba(230, 180, 80, 0.35);
}

/* ==============================================================================
   3. PRICE LEVEL BAR (BARRA DE NÍVEL COM PREÇO MÉDIO & TETO)
   ============================================================================== */
.level-bar-wrap {
  width: 140px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.level-bar-track {
  height: 6px;
  background: var(--neutral-bg);
  border-radius: 99px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}

.level-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .3s ease;
}

.level-bar-fill.zone-buy {
  background: var(--zone-best);
}

.level-bar-fill.zone-watch {
  background: var(--zone-watch);
}

.level-bar-fill.zone-alert {
  background: var(--zone-alert);
}

.level-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--faint);
}

/* ==============================================================================
   4. MODALS & BOTTOM SHEETS (UNIVERSAL DIALOGS)
   ============================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  opacity: 0;
  transition: opacity .2s ease;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-box.modal-lg {
  max-width: min(1360px, 95vw);
  width: 95vw;
}

.modal-box.modal-xl {
  max-width: min(1600px, 95vw);
  width: 95vw;
}

.modal-box.modal-sm {
  max-width: 400px;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes modalShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.modal-box.modal-shake {
  animation: modalShake .35s ease;
}

/* Proteção de Privacidade quando o Cofre está Trancado */
body.vault-is-locked .main-content,
body.vault-is-locked #desktop-nav,
body.vault-is-locked .bottom-nav,
body.vault-is-locked .fab-btn {
  filter: blur(14px) brightness(0.6);
  pointer-events: none;
  user-select: none;
  transition: filter .25s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.modal-body {
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* ==============================================================================
   5. FORM CONTROLS & SECURITY WARNING BANNERS
   ============================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s ease, background .15s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface-3);
}

.form-input:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Banner de Alerta Zero-Knowledge */
.alert-banner {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  display: flex;
  gap: 10px;
  line-height: 1.45;
}

.alert-danger {
  background: var(--danger-bg);
  border: 1px solid rgba(217,64,64,.35);
  color: var(--danger);
}

.alert-warning {
  background: var(--warning-bg);
  border: 1px solid rgba(200,144,16,.35);
  color: var(--warning);
}

.alert-info {
  background: var(--info-bg);
  border: 1px solid rgba(61,149,200,.3);
  color: var(--info);
}

/* ==============================================================================
   6. SECURITY LOGS TIMELINE
   ============================================================================== */
.logs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 12px;
}

.log-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.log-dot.INFO { background: var(--success); }
.log-dot.WARNING { background: var(--warning); }
.log-dot.CRITICAL { background: var(--danger); }

.log-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.log-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted);
}

/* ==============================================================================
   7. TELA INICIAL & LOGIN FULLSCREEN (DEEP BLACK SLEEK LANDING)
   ============================================================================== */
.modal-landing-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: #060911 !important;
  background: radial-gradient(circle at 50% 30%, #0c1322 0%, #060911 70%, #020408 100%) !important;
  z-index: 9999 !important;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  overflow-y: auto;
  backdrop-filter: none !important;
}

.modal-landing-fullscreen.open {
  display: flex !important;
}

.landing-login-wrap {
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 20px;
  animation: modalPop .25s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}

.landing-logo-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.landing-logo-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(2, 132, 199, 0.25) 100%);
  border: 1px solid rgba(56, 189, 248, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.2);
  margin-bottom: 4px;
}

.landing-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #f8fafc;
  margin: 0;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-subtitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #38bdf8;
}

.landing-description-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 480px;
}

.landing-description-text {
  font-size: 13px;
  line-height: 1.6;
  color: #94a3b8;
  margin: 0;
}

.landing-pills-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.landing-pill {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 10px;
  border-radius: 20px;
}

.landing-auth-card {
  width: 100%;
  max-width: 380px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  border-radius: var(--r-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  backdrop-filter: blur(8px);
}

.landing-auth-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 14px;
}

.landing-footer {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}
