/* BTC Pattern Scanner — custom styles (Tailwind via CDN) */

:root {
  --accent: #f7931a;
  --surface: #111111;
  --card: #1a1f2e;
}

* {
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior-y: contain;
}

.safe-top {
  padding-top: env(safe-area-inset-top, 0);
}

.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Bottom navigation */
.tab-btn {
  color: #94a3b8;
  transition: color 0.2s, transform 0.15s;
}

.tab-btn:active {
  transform: scale(0.96);
}

.tab-active {
  color: var(--accent) !important;
}

/* Pattern signals */
.signal-buy {
  color: #4ade80;
}

.signal-sell {
  color: #f87171;
}

.signal-neutral {
  color: #94a3b8;
}

.pattern-card {
  transition: box-shadow 0.3s, border-color 0.3s;
}

.pattern-card.ring-buy {
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.45);
  border-color: rgba(74, 222, 128, 0.35);
}

.pattern-card.ring-sell {
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.45);
  border-color: rgba(248, 113, 113, 0.35);
}

.trade-suggestion {
  background: linear-gradient(145deg, #1a1f2e 0%, #12161f 100%);
  transition: border-color 0.35s, box-shadow 0.35s;
}

.trade-suggestion.suggest-buy {
  border-color: rgba(74, 222, 128, 0.55);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.15);
}

.trade-suggestion.suggest-buy #suggestion-short {
  color: #4ade80;
}

.trade-suggestion.suggest-sell {
  border-color: rgba(248, 113, 113, 0.55);
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.15);
}

.trade-suggestion.suggest-sell #suggestion-short {
  color: #f87171;
}

.trade-suggestion.suggest-hold {
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.08);
}

.trade-suggestion.suggest-hold #suggestion-short {
  color: #fbbf24;
}

.pattern-list-item {
  padding: 0.875rem 1rem;
  border-radius: 0.75rem;
  border-width: 1px;
  background: rgba(15, 20, 25, 0.6);
}

.match-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.7rem;
}

.match-row .match-name {
  flex: 1;
  min-width: 0;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-row .match-pct {
  width: 2.25rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.match-bar {
  flex: 0 0 4.5rem;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 9999px;
  overflow: hidden;
}

.match-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.35s ease;
}

.match-bar-fill.bull {
  background: linear-gradient(90deg, #16a34a, #4ade80);
}

.match-bar-fill.bear {
  background: linear-gradient(90deg, #dc2626, #f87171);
}

.match-bar-fill.weak {
  background: linear-gradient(90deg, #475569, #94a3b8);
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 220px;
}

/* Toggle switch */
.toggle {
  appearance: none;
  width: 2.75rem;
  height: 1.5rem;
  background: #334155;
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

.toggle:checked {
  background: var(--accent);
}

.toggle:checked::after {
  transform: translateX(1.25rem);
}

.btn-secondary {
  background: rgba(247, 147, 26, 0.15);
  color: var(--accent);
  border: 1px solid rgba(247, 147, 26, 0.35);
  padding: 0.625rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.2s;
}

.btn-secondary:active {
  background: rgba(247, 147, 26, 0.25);
}

.btn-primary {
  background: var(--accent);
  color: #111;
  border: none;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: opacity 0.2s, transform 0.15s;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.auth-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: #f1f5f9;
  outline: none;
  transition: border-color 0.2s;
}

.auth-input:focus {
  border-color: rgba(247, 147, 26, 0.5);
}

.terms-box {
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 147, 26, 0.4) transparent;
}

body.access-locked #scanner-main {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

/* Terms product page */
.terms-product-body h3 {
  color: #f1f5f9;
  font-size: 0.95rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
}

.terms-product-body h3:first-child {
  margin-top: 0;
}

.terms-product-body p {
  margin-bottom: 0.65rem;
  color: #cbd5e1;
}

.terms-product-body ul {
  margin: 0.5rem 0 0.75rem 1.25rem;
  list-style: disc;
}

.terms-product-body li {
  margin-bottom: 0.35rem;
}

.terms-product-body strong {
  color: #f7931a;
}

.terms-product-body em {
  color: #94a3b8;
}

@media (max-width: 900px) {
  .admin-stats[style*="repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

#alert-toast.toast-visible {
  animation: slideUp 0.35s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* PWA standalone tweaks */
@media (display-mode: standalone) {
  body {
    user-select: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
