/* ============================================================
   COMPONENTS — Buttons, Cards, Badges, Inputs, Tabs
   ============================================================ */

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 9px 18px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-primary:active { transform: scale(0.98); }

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

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

.btn-lg { padding: 13px 24px; font-size: var(--fs-base); border-radius: var(--radius-md); }
.btn-sm { padding: 6px 12px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Google button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.btn-google:hover {
  border-color: #c7d2fe;
  background: #fafafa;
  box-shadow: var(--shadow-sm);
}

/* ── Spinner ── */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
  flex-shrink: 0;
}
.spinner-dark {
  border-color: rgba(0,0,0,0.15);
  border-top-color: var(--text-muted);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* ── Post card ── */
.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
  position: relative;
  overflow: hidden;
}
.post-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-radius: 0;
  background: var(--pillar-traffic);
}
.post-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  border-color: #cbd5e1;
}

.post-card[data-pillar="offer"]::before       { background: var(--pillar-offer); }
.post-card[data-pillar="traffic"]::before     { background: var(--pillar-traffic); }
.post-card[data-pillar="conversion"]::before  { background: var(--pillar-conversion); }
.post-card[data-pillar="delivery"]::before    { background: var(--pillar-delivery); }
.post-card[data-pillar="continuity"]::before  { background: var(--pillar-continuity); }

.post-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.post-body { flex: 1; min-width: 0; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.post-author { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.post-time   { font-size: var(--fs-xs); color: var(--text-light); }

.post-title {
  font-size: var(--fs-base);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-excerpt {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.post-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--text-light);
}

.post-stat {
  display: flex;
  align-items: center;
  gap: 4px;
}
.post-stat svg { width: 13px; height: 13px; }

.post-thumbnail {
  flex-shrink: 0;
  width: 112px;
  height: 68px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-hover);
}
.post-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

/* ── Post media (image / video / doc link) ── */
.post-media-img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 8px 0;
}
.post-media-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 8px 0;
}
.post-media-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.post-media-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--color-primary);
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin: 8px 0;
  text-decoration: none;
}

/* ── Poll ── */
.post-poll {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.poll-question {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.poll-options { display: flex; flex-direction: column; gap: 6px; }
.poll-opt {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s;
}
.poll-opt:hover { border-color: var(--color-primary); }
.poll-opt-bar {
  position: absolute;
  inset: 0;
  background: var(--bg-active);
  z-index: 0;
  transition: width .3s;
}
.poll-opt-row {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.poll-opt-voted { cursor: pointer; }
.poll-opt-mine { border-color: var(--color-primary); font-weight: 600; }
.poll-total {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: 2px 8px;
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-level {
  background: #ede9fe;
  color: #6d28d9;
}

.badge-pillar {
  padding: 2px 7px;
}

.badge-offer      { background: #fef3c7; color: #b45309; }
.badge-traffic    { background: #dbeafe; color: #1d4ed8; }
.badge-conversion { background: #ede9fe; color: #6d28d9; }
.badge-delivery   { background: #d1fae5; color: #065f46; }
.badge-continuity { background: #fce7f3; color: #9d174d; }

/* ── Avatar ── */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.avatar-sm  { width: 28px; height: 28px; }
.avatar-md  { width: 36px; height: 36px; }
.avatar-lg  { width: 42px; height: 42px; }
.avatar-xl  { width: 52px; height: 52px; }

/* Placeholder avatar */
.avatar-placeholder {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── XP Bar ── */
.xp-bar {
  height: 5px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), #34d399);
  border-radius: 99px;
  transition: width 0.4s ease;
}

/* ── Inputs ── */
.field { margin-bottom: 20px; }

.field label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.input-wrap { position: relative; }

.input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-light);
  pointer-events: none;
}

.input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 42px 12px 40px;
  font-size: var(--fs-base);
  font-family: var(--font-body);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input::placeholder { color: var(--text-light); }
.input:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}
.input.no-icon { padding-left: 14px; }

.toggle-pw {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.toggle-pw:hover { color: var(--text-muted); }

.field-error {
  font-size: var(--fs-xs);
  color: var(--accent-red);
  margin-top: 5px;
  display: none;
}

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

.tab-item {
  padding: 9px 14px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tab-item:hover { color: var(--text); text-decoration: none; }
.tab-item.active { color: var(--color-primary); border-bottom-color: var(--color-primary); font-weight: 600; }

/* ── OR divider ── */
.or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.or-divider::before,
.or-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.or-divider span { font-size: var(--fs-xs); color: var(--text-light); letter-spacing: 0.05em; white-space: nowrap; }

/* ── Alert / Banner ── */
.alert {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-bottom: 16px;
}
.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}
.alert svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Widget title ── */
.widget-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ── Stat items ── */
.stat-row {
  display: flex;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}
.stat-item { flex: 1; text-align: center; }
.stat-item:not(:last-child) { border-right: 1px solid var(--border); }
.stat-value { font-size: var(--fs-md); font-weight: 700; }
.stat-label { font-size: var(--fs-xs); color: var(--text-light); margin-top: 2px; }

/* ── Notification Bell & Dropdown ── */
#notifBadge {
  position: absolute; top: -4px; right: -4px;
  background: #ef4444; color: #fff;
  border-radius: 99px; font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px;
  align-items: center; justify-content: center;
  padding: 0 3px; line-height: 1;
}
#notifDropdown {
  display: none; position: absolute; top: calc(100% + 8px); right: 0;
  width: 340px; background: #fff;
  border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14); z-index: 600; overflow: hidden;
}
.notif-header {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 700;
}
.notif-header-left { display: flex; align-items: center; gap: 8px; }
.notif-unread-count {
  background: #ef4444; color: #fff; border-radius: 99px;
  font-size: 10px; font-weight: 700; padding: 1px 6px;
}
.notif-read-all-btn {
  font-size: 11px; color: var(--color-primary, #0ea5e9);
  background: none; border: none; cursor: pointer; padding: 0;
}
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  display: flex; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; position: relative; transition: background .15s;
}
.notif-item:hover { background: #f8fafc; }
.notif-item.unread { background: #f0f9ff; }
.notif-item-icon {
  width: 36px; height: 36px; border-radius: 50%;
  background: #f1f5f9; display: flex; align-items: center;
  justify-content: center; font-size: 16px; flex-shrink: 0;
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 13px; font-weight: 600; color: #0f172a; margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-item-text {
  font-size: 12px; color: #64748b; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.notif-item-time { font-size: 11px; color: #94a3b8; margin-top: 3px; }
.notif-item-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-primary, #0ea5e9); flex-shrink: 0; align-self: center;
}
.notif-empty {
  padding: 32px 16px; text-align: center;
  color: #94a3b8; font-size: 13px;
}

/* ── Notification Toast Popup ─────────────────────────────── */
.notif-toast {
  position: fixed; right: 16px; z-index: 9999;
  background: #fff; border: 1px solid var(--border);
  border-left: 3px solid #0ea5e9; border-radius: 10px;
  padding: 12px 14px; max-width: 320px; min-width: 260px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14);
  display: flex; align-items: flex-start; gap: 10px;
  animation: notifToastIn .3s ease;
  transition: opacity .4s ease;
}
.notif-toast-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.notif-toast-body { flex: 1; min-width: 0; }
.notif-toast-title {
  font-size: 13px; font-weight: 700; color: #0f172a;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notif-toast-text {
  font-size: 12px; color: #64748b; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notif-toast-close {
  border: none; background: none; cursor: pointer;
  color: #94a3b8; font-size: 18px; line-height: 1;
  flex-shrink: 0; padding: 0; margin-top: -2px;
}
.notif-toast-close:hover { color: #475569; }
@keyframes notifToastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}
