/**
 * IQ-SIGNAL-HUB — UI Components (v4)
 * Canonical Reference: docs/MASTER_SPEC.md Section 5.4
 */

/* 1. Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  transition: all var(--transition-speed) ease;
  min-height: var(--touch-target-min);
  text-decoration: none;
}

.btn-primary {
  background: var(--grad-gold);
  color: #070B14;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  box-shadow: 0 6px 22px rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--surface-3);
  border-color: var(--border-gold);
}

.btn-danger {
  background: var(--grad-danger);
  color: #FFFFFF;
  box-shadow: var(--glow-danger);
}

.btn-danger:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background-color: var(--surface-2);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Spinner for Loading State */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* 2. Cards */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-gold);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--font-size-h3);
  font-weight: 700;
  color: var(--text);
}

/* 3. StatCard (KPI Display) */
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-label {
  font-size: var(--font-size-label);
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: var(--font-size-kpi);
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
}

.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
}

.stat-trend.positive { color: var(--success); }
.stat-trend.negative { color: var(--danger); }
.stat-trend.neutral { color: var(--text-dim); }

/* 4. StatusBadges (Multi-Source Verification: Icon + Text + Color) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid rgba(244, 63, 94, 0.3); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-neutral { background: var(--surface-3);  color: var(--text-muted); border: 1px solid var(--border); }

/* Prominent SIMULATED Ribbon (Rule R5) */
.badge-simulated {
  background: repeating-linear-gradient(
    45deg,
    #F59E0B,
    #F59E0B 10px,
    #D97706 10px,
    #D97706 20px
  );
  color: #070B14;
  font-weight: 900;
  padding: 4px 14px;
  letter-spacing: 1px;
  border: 2px solid #FDE68A;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
}

/* Source Badges */
.badge-source-api { background: rgba(56, 189, 248, 0.15); color: #38BDF8; border: 1px solid rgba(56, 189, 248, 0.4); }
.badge-source-tg  { background: rgba(34, 197, 94, 0.15);  color: #22C55E; border: 1px solid rgba(34, 197, 94, 0.4); }

/* Symbol Chip */
.symbol-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font-family);
  direction: ltr;
}

/* 5. LiveDot Pulsing Animation */
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.live-dot.active {
  background-color: var(--success);
}

.live-dot.active::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid var(--success);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.4); opacity: 0; }
}

/* 6. DataTable */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
}

.data-table th {
  background-color: var(--surface-2);
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 700;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  min-height: var(--table-row-height-min);
  font-size: 16px;
}

.data-table tbody tr:hover {
  background-color: var(--surface-2);
}

/* 7. Modal & Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(7, 11, 20, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-dialog {
  background-color: var(--surface);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  padding: 32px;
  box-shadow: var(--shadow-dropdown), var(--glow-gold);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* 8. Toasts */
.toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  width: calc(100% - 48px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  box-shadow: var(--shadow-dropdown);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.25s ease-out;
}

.toast-success { border-color: var(--success); border-left-width: 4px; }
.toast-error   { border-color: var(--danger);  border-left-width: 4px; }
.toast-warning { border-color: var(--warning); border-left-width: 4px; }
.toast-info    { border-color: var(--info);    border-left-width: 4px; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 9. Skeleton Placeholder */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 25%,
    var(--surface-3) 50%,
    var(--surface-2) 75%
  );
  background-size: 200% 100%;
  animation: skeletonLoading 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 10. Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 64px 24px;
  gap: 16px;
}

.empty-icon {
  width: 64px;
  height: 64px;
  color: var(--text-dim);
}

