/* Cyber HQ shared components + legacy class mapping */

/* Brand logo sizes */
.brand-logo { display: block; object-fit: contain; }
.brand-logo-nav { width: 38px; height: 38px; border-radius: var(--ttm-radius); }
.brand-logo-hero { width: 72px; height: 72px; border-radius: var(--ttm-radius-xl); }
.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--ttm-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

/* Panel titles (uppercase cyber style) */
.ttm-panel-title,
.sidebar-panel-title {
  font-size: var(--font-caption);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ttm-text-tertiary);
  margin-bottom: var(--s2);
}

/* Hero sections */
.ttm-hero,
.store-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--ttm-radius-xl);
  margin-bottom: var(--s3);
  padding: var(--s4) var(--s3);
  border: 1px solid var(--ttm-border);
  background: linear-gradient(135deg, rgba(26, 21, 41, 0.98) 0%, rgba(17, 14, 28, 0.95) 45%, rgba(76, 29, 149, 0.35) 100%);
  box-shadow: var(--ttm-shadow), var(--ttm-glow);
  text-align: center;
}

.ttm-hero::before,
.store-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 15% -20%, rgba(34, 211, 238, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 50% at 90% 20%, rgba(139, 92, 246, 0.22), transparent 50%);
}

.ttm-hero-inner,
.store-hero-inner { position: relative; z-index: 1; }

.ttm-hero h1,
.store-hero h1 {
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, var(--ttm-text-secondary) 50%, var(--ttm-gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ttm-hero-badge,
.store-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--ttm-border);
  color: var(--ttm-cyan);
  margin-bottom: var(--s2);
}

/* Cards */
.ttm-card,
.card,
.sidebar-panel {
  background: linear-gradient(155deg, rgba(26, 21, 41, 0.95), rgba(17, 14, 28, 0.98));
  border: 1px solid var(--ttm-border);
  border-radius: var(--ttm-radius-lg);
  padding: var(--s3);
  margin-bottom: var(--s2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(8px);
}

.card-highlight { border-color: rgba(52, 211, 153, 0.4); }

/* Buttons */
.ttm-btn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--ttm-radius);
  border: none;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:not(:disabled):hover { transform: translateY(-1px); }

.btn-primary,
.ttm-btn--primary {
  background: linear-gradient(135deg, var(--ttm-primary), var(--ttm-primary-hover));
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4), var(--ttm-glow);
}

.btn-success {
  background: linear-gradient(135deg, var(--ttm-success), #059669);
  color: #fff;
  box-shadow: 0 4px 20px rgba(52, 211, 153, 0.3);
}

.btn-danger { background: var(--ttm-danger); color: #fff; }

.btn-ghost,
.ttm-btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ttm-text);
  border: 1px solid var(--ttm-border-subtle);
}

.btn-sm { padding: 7px 14px; font-size: 0.8rem; border-radius: 8px; }
.btn-block { width: 100%; }

.btn-discord {
  background: linear-gradient(135deg, #5865f2, #4752c4);
  color: #fff;
  box-shadow: 0 4px 18px rgba(88, 101, 242, 0.35);
}

/* Chips / tags */
.ttm-chip,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--ttm-border);
  background: var(--ttm-surface-2);
  color: var(--ttm-text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ttm-chip:hover,
.chip:hover {
  border-color: var(--ttm-primary);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.25);
  color: var(--ttm-text);
}

/* Typography utilities */
.page-title {
  font-family: var(--font-display);
  font-size: var(--font-display-size, clamp(1.25rem, 2vw + 0.5rem, 1.625rem));
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--ttm-text);
}

.page-sub {
  font-family: var(--font-thai);
  color: var(--ttm-muted);
  font-size: var(--font-body-size, 0.9375rem);
  margin-bottom: var(--s3);
}

/* Forms */
label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ttm-muted);
  margin-bottom: 6px;
}

input,
select,
textarea,
.form-control {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--ttm-radius);
  border: 1px solid var(--ttm-border-subtle);
  background: rgba(6, 4, 12, 0.6);
  color: var(--ttm-text);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus {
  outline: none;
  border-color: var(--ttm-primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-green { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; }
.badge-red { background: rgba(248, 113, 113, 0.15); color: #fca5a5; }
.badge-yellow { background: rgba(251, 191, 36, 0.15); color: #fcd34d; }
.badge-blue { background: rgba(139, 92, 246, 0.15); color: #c4b5fd; }

/* Flash messages */
.flash {
  padding: 14px 18px;
  border-radius: var(--ttm-radius);
  margin-bottom: var(--s2);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}

.flash.success { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); color: #6ee7b7; }
.flash.warning { background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.3); color: #fcd34d; }
.flash.error { background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.3); color: #fca5a5; }

/* Grid & layout helpers */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s2); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s2); }

.wrap { max-width: 1280px; margin: 0 auto; }

.key-box {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 16px 18px;
  border-radius: var(--ttm-radius);
  background: rgba(6, 4, 12, 0.8);
  border: 1px dashed var(--ttm-border);
  color: var(--ttm-text-secondary);
  word-break: break-all;
  user-select: all;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s2);
}

.modal {
  background: var(--card);
  border: 1px solid var(--ttm-border);
  border-radius: var(--ttm-radius-xl);
  padding: var(--s3);
  max-width: 480px;
  width: 100%;
  box-shadow: var(--ttm-modal-glow);
}

.modal h3 { font-size: 1.2rem; margin-bottom: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { padding: 11px 10px; text-align: left; border-bottom: 1px solid rgba(51, 65, 85, 0.6); }
th {
  color: var(--ttm-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Stats */
.stat { text-align: center; padding: var(--s3) var(--s2); }
.stat-val {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff, var(--ttm-primary-light));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--ttm-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Utilities */
.text-muted { color: var(--ttm-muted); }
.text-green { color: #6ee7b7; }
.text-center { text-align: center; }
.mt-2 { margin-top: 12px; }
.hidden { display: none !important; }
.spinner { animation: ttm-spin 0.7s linear infinite; }

@keyframes ttm-spin { to { transform: rotate(360deg); } }

/* Radar scanner (Detect Event decorative) */
.ttm-radar {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 1px solid var(--ttm-border);
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
  overflow: hidden;
  flex-shrink: 0;
}

.ttm-radar__grid {
  position: absolute;
  inset: 0;
  background:
    repeating-radial-gradient(circle at center, transparent 0, transparent 18px, rgba(34, 211, 238, 0.08) 19px),
    linear-gradient(rgba(34, 211, 238, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.06) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px, 20px 20px;
}

.ttm-radar__sweep {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(34, 211, 238, 0.35) 30deg, transparent 60deg);
  animation: ttm-radar-sweep 3s linear infinite;
}

.ttm-radar__blip {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ttm-primary-light);
  box-shadow: 0 0 8px var(--ttm-primary-light);
}

@keyframes ttm-radar-sweep {
  to { transform: rotate(360deg); }
}

/* Discord community card */
.discord-community-card {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  padding: 18px 20px;
  border-radius: var(--ttm-radius-lg);
  border: 1px solid rgba(88, 101, 242, 0.35);
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.12), rgba(17, 14, 28, 0.88));
  margin-bottom: var(--s2);
}

.discord-community-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--ttm-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(88, 101, 242, 0.25);
  color: #a5b4fc;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.discord-community-text { flex: 1; min-width: 180px; }
.discord-community-text strong { display: block; margin-bottom: 4px; }
.discord-community-text p { margin: 0; font-size: 0.85rem; color: var(--ttm-muted); line-height: 1.5; }

/* Hide legacy topnav when HQ shell active */
.ttm-hq .topnav { display: none !important; }

@media (max-width: 768px) {
  .page-title { font-size: 1.45rem; }
  .page-sub { font-size: 0.88rem; margin-bottom: var(--s2); }
  .card, .ttm-card { padding: 18px 16px; border-radius: var(--ttm-radius); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; gap: var(--s1); }
  input, select, textarea { font-size: 16px; }
  .btn { min-height: 48px; }
  .btn-sm { min-height: 40px; }
}

@media (hover: none) and (pointer: coarse) {
  .btn:not(:disabled):hover { transform: none; }
}
