/* ============================================================
   COMPONENTS.CSS — Cards, buttons, badges, inputs, modals
   ============================================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--t-default);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  letter-spacing: 0.01em;
}

.btn svg { width: 13px; height: 13px; flex-shrink: 0; }

.btn-primary {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
}
.btn-primary:hover {
  background: #5af0a8;
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-3);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.btn-secondary:hover {
  background: var(--bg-4);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--bg-3);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: rgba(224,80,57,0.2);
}
.btn-danger:hover {
  background: rgba(224,80,57,0.2);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: rgba(61,232,146,0.3);
}
.btn-outline:hover {
  background: var(--accent-dim);
  border-color: rgba(61,232,146,0.5);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: var(--r-sm);
}

.btn-lg {
  padding: 11px 20px;
  font-size: 13px;
  border-radius: var(--r-lg);
}

.btn-icon {
  padding: 7px;
  border-radius: var(--r-md);
}

/* ── Tags / Badges ── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-transform: uppercase;
}

.tag-default {
  background: var(--bg-4);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.tag-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(61,232,146,0.15);
}

.tag-danger {
  background: var(--badge-internal);
  color: var(--badge-internal-text);
  border: 1px solid rgba(224,80,57,0.15);
}

.tag-safe {
  background: var(--badge-safe);
  color: var(--badge-safe-text);
  border: 1px solid rgba(61,232,146,0.15);
}

.tag-info {
  background: var(--info-dim);
  color: var(--info);
  border: 1px solid rgba(57,144,224,0.15);
}

.tag-warning {
  background: var(--warning-dim);
  color: var(--warning);
  border: 1px solid rgba(224,164,57,0.15);
}

/* Vertical color coding */
.tag-fintech  { background: rgba(57,144,224,0.12); color: #6ab3f0; border-color: rgba(57,144,224,0.18); }
.tag-web3     { background: rgba(130,80,224,0.12); color: #a87af0; border-color: rgba(130,80,224,0.18); }
.tag-trading  { background: rgba(224,164,57,0.12); color: #f0c97a; border-color: rgba(224,164,57,0.18); }
.tag-ecom     { background: rgba(57,224,180,0.12); color: #6af0d0; border-color: rgba(57,224,180,0.18); }
.tag-health   { background: rgba(80,224,120,0.12); color: #7af08c; border-color: rgba(80,224,120,0.18); }
.tag-igaming  { background: rgba(224,57,120,0.12); color: #f07aaa; border-color: rgba(224,57,120,0.18); }
.tag-sports   { background: rgba(224,100,57,0.12); color: #f0a07a; border-color: rgba(224,100,57,0.18); }
.tag-saas     { background: rgba(61,232,146,0.12); color: #3de892; border-color: rgba(61,232,146,0.18); }
.tag-other    { background: rgba(140,140,160,0.1); color: #9090a8; border-color: rgba(140,140,160,0.15); }

/* ── Cards ── */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: all var(--t-default);
  position: relative;
}

.card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-body {
  padding: 16px;
}

.card-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-thumbnail {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  overflow: hidden;
}

.card-thumbnail img, .card-thumbnail video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-thumb-placeholder {
  width: 100%;
  height: 140px;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-4));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-tertiary);
}

.card-thumb-placeholder svg { width: 28px; height: 28px; opacity: 0.4; }
.card-thumb-placeholder span { font-size: 10px; font-family: var(--font-mono); letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.4; }

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 4px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 8px 0;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Material list row ── */
.material-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-default);
}

.material-row:hover {
  background: var(--bg-3);
  border-color: var(--border-default);
}

.material-row-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--bg-4);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.material-row-icon svg { width: 15px; height: 15px; }

.material-row-info { flex: 1; min-width: 0; }
.material-row-title { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.material-row-sub { font-size: 11px; color: var(--text-tertiary); margin-top: 2px; font-family: var(--font-mono); }

.material-row-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--t-fast);
}

.material-row:hover .material-row-actions { opacity: 1; }

/* ── Inputs ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.input {
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  transition: all var(--t-default);
  width: 100%;
}

.input::placeholder { color: var(--text-tertiary); }

.input:focus {
  outline: none;
  border-color: rgba(61,232,146,0.4);
  box-shadow: 0 0 0 3px rgba(61,232,146,0.08);
}

textarea.input { min-height: 80px; resize: vertical; line-height: 1.5; }

.select {
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 9px 32px 9px 12px;
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: all var(--t-default);
}

.select:focus {
  outline: none;
  border-color: rgba(61,232,146,0.4);
  box-shadow: 0 0 0 3px rgba(61,232,146,0.08);
}

.select option { background: var(--bg-2); }

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border-default);
  border-radius: var(--r-md);
  padding: 0 12px;
  transition: all var(--t-default);
}

.search-bar:focus-within {
  border-color: rgba(61,232,146,0.4);
  box-shadow: 0 0 0 3px rgba(61,232,146,0.06);
}

.search-bar svg { width: 14px; height: 14px; color: var(--text-tertiary); flex-shrink: 0; }

.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  padding: 9px 0;
}

.search-bar input::placeholder { color: var(--text-tertiary); }

/* ── Filter row ── */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-default);
  background: var(--bg-2);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-default);
  white-space: nowrap;
}

.filter-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-3);
}

.filter-chip.active {
  background: var(--accent-dim);
  border-color: rgba(61,232,146,0.25);
  color: var(--accent);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6,6,8,0.85);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--t-default);
}

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

.modal {
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.6);
  animation: modalIn 200ms ease both;
}

.modal-lg { max-width: 840px; }
.modal-xl { max-width: 1100px; }

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

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--t-fast);
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
}

.modal-close:hover { background: var(--bg-4); color: var(--text-primary); }

.modal-body { padding: 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Stat widget ── */
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 18px;
  transition: all var(--t-default);
}

.stat-card:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
}

.empty-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--r-xl);
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.empty-icon svg { width: 22px; height: 22px; }

.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.empty-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  max-width: 280px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
}

.tab {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-default);
  margin-bottom: -1px;
  white-space: nowrap;
}

.tab:hover { color: var(--text-secondary); }

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  animation: slideIn 200ms ease both;
  max-width: 320px;
}

.toast-success { border-left: 3px solid var(--accent); }
.toast-error   { border-left: 3px solid var(--danger); }

/* ── Pill counter ── */
.count-pill {
  background: var(--bg-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-full);
  padding: 2px 7px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

/* ── Horizontal divider with label ── */
.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}

.divider-label span {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.divider-label::before,
.divider-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Loader ── */
.loader {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

/* ── Quick action strip ── */
.quick-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ── Visibility dot ── */
.vis-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vis-dot.internal { background: var(--danger); }
.vis-dot.safe { background: var(--accent); }

/* ── Form grid ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid .span-2 { grid-column: 1 / -1; }

/* ── Copy feedback ── */
.copied-flash {
  animation: pulse 600ms ease;
}

/* ── Vertical section divider ── */
.vertical-section {
  margin-bottom: 40px;
}

.vertical-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.vertical-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.vertical-section-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.vertical-section-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

/* ── Preview image modal ── */
.preview-img {
  width: 100%;
  max-height: 60vh;
  object-fit: contain;
  border-radius: var(--r-md);
  background: var(--bg-1);
}

/* ── Grid layouts ── */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* ── Masonry for creatives ── */
.masonry-grid {
  columns: 3;
  column-gap: 12px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 12px;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  background: var(--bg-3);
  border: 1px solid var(--border-subtle);
  transition: all var(--t-default);
}

.masonry-item:hover {
  border-color: var(--border-strong);
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
  z-index: 2;
}

.masonry-item img, .masonry-item video {
  width: 100%;
  display: block;
  border-radius: var(--r-md);
  transition: transform var(--t-slow);
}

.masonry-item:hover img { transform: scale(1.03); }

.masonry-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(6,6,8,0.85) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--t-default);
  border-radius: var(--r-md);
  display: flex;
  align-items: flex-end;
  padding: 12px;
}

.masonry-item:hover .masonry-overlay { opacity: 1; }

.masonry-info { display: flex; flex-direction: column; gap: 4px; }
.masonry-title { font-size: 12px; font-weight: 600; color: var(--text-primary); }
.masonry-sub { font-size: 10px; color: var(--text-secondary); font-family: var(--font-mono); }
