/* ═══════════════════════════════════════════
   MarketingOS — UI Components
   Buttons, Cards, Badges, Tooltips, Forms
   ═══════════════════════════════════════════ */

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  border: 2px solid transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-lime); color: var(--text-inverse); border-color: var(--accent-lime); }
.btn-primary:hover { box-shadow: var(--shadow-glow-lime); transform: scale(1.02); }
.btn-secondary { background: transparent; color: var(--accent-lime); border-color: var(--accent-lime); }
.btn-secondary:hover { background: var(--accent-lime); color: var(--text-inverse); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; padding: var(--space-2) var(--space-4); }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); background: var(--bg-card); border-color: var(--border); color: var(--text-secondary); }
.btn-icon:hover { color: var(--text-primary); border-color: var(--border-strong); transform: scale(1.05); }
.btn-danger { background: var(--accent-coral); color: white; border-color: var(--accent-coral); }
.btn-danger:hover { box-shadow: var(--shadow-glow-coral); transform: scale(1.02); }
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--text-xs); }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--text-base); border-radius: var(--radius-lg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255,255,255,0.3); transform: scale(0); animation: ripple 0.6s linear; pointer-events: none; }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }

/* ── CARDS ── */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); box-shadow: var(--shadow-sm); transition: all var(--transition-base); }
.card-hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.card-active { border-color: var(--accent-lime); box-shadow: var(--shadow-glow-lime); }
.card-glass { background: rgba(19,19,31,0.6); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--space-6); }
[data-theme="light"] .card-glass { background: rgba(255,255,255,0.7); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.card-title { font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.card-body { color: var(--text-secondary); line-height: var(--leading-relaxed); }
.card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }

/* ── INPUTS ── */
.input { width: 100%; padding: var(--space-3) var(--space-4); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--text-primary); transition: all var(--transition-fast); }
.input:focus { border-color: var(--accent-lime); box-shadow: 0 0 0 3px rgba(189,255,71,0.1); }
.input::placeholder { color: var(--text-muted); }
.textarea { width: 100%; min-height: 120px; padding: var(--space-4); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--text-primary); line-height: var(--leading-relaxed); resize: vertical; transition: all var(--transition-fast); font-family: var(--font-body); }
.textarea:focus { border-color: var(--accent-lime); box-shadow: 0 0 0 3px rgba(189,255,71,0.1); }
.textarea::placeholder { color: var(--text-muted); }
.input-group { display: flex; flex-direction: column; gap: var(--space-2); }
.input-group label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-primary); }
.input-group .helper-text { font-size: var(--text-xs); color: var(--text-muted); }
.input-error .input, .input-error .textarea { border-color: var(--error); animation: headShake 0.5s ease-in-out; }
.input-error .helper-text { color: var(--error); }
.char-count { font-size: var(--text-xs); color: var(--text-muted); font-family: var(--font-mono); text-align: right; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: var(--space-1) var(--space-3); font-size: var(--text-xs); font-weight: var(--weight-semibold); border-radius: var(--radius-full); white-space: nowrap; }
.badge-default { background: var(--bg-card-hover); color: var(--text-secondary); }
.badge-success { background: rgba(77,255,176,0.15); color: var(--success); }
.badge-warning { background: rgba(255,209,102,0.15); color: var(--warning); }
.badge-error { background: rgba(255,92,92,0.15); color: var(--error); }
.badge-info { background: rgba(51,232,255,0.15); color: var(--info); }
.badge-xp { background: linear-gradient(135deg, rgba(123,94,255,0.2), rgba(189,255,71,0.2)); color: var(--accent-lime); font-family: var(--font-mono); font-weight: var(--weight-bold); }
.badge-step { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: var(--weight-bold); background: var(--bg-card-hover); color: var(--text-muted); border: 2px solid var(--border); }
.badge-step.active { background: var(--accent-lime); color: var(--text-inverse); border-color: var(--accent-lime); }
.badge-step.complete { background: var(--success); color: var(--text-inverse); border-color: var(--success); }

/* ── TOOLTIPS ── */
.tooltip-trigger { position: relative; cursor: help; }
.tooltip-content { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%) scale(0.9); background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); min-width: 200px; max-width: 300px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transition: all var(--transition-spring); z-index: var(--z-tooltip); pointer-events: none; font-size: var(--text-sm); color: var(--text-secondary); }
.tooltip-content::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--bg-card); }
.tooltip-trigger:hover .tooltip-content { opacity: 1; visibility: visible; transform: translateX(-50%) scale(1); pointer-events: auto; }

/* ── MODALS ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(7,7,15,0.75); backdrop-filter: blur(8px); z-index: var(--z-modal); display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all var(--transition-base); }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal-center { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: var(--space-8); max-width: 520px; width: 90%; max-height: 80vh; overflow-y: auto; transform: scale(0.9); transition: transform var(--transition-spring); box-shadow: var(--shadow-lg); }
.modal-overlay.open .modal-center { transform: scale(1); }
@media (max-width: 767px) {
  .modal-center { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; max-width: 100%; border-radius: var(--radius-xl) var(--radius-xl) 0 0; transform: translateY(100%); max-height: 90vh; }
  .modal-overlay.open .modal-center { transform: translateY(0); }
}

/* ── TABS ── */
.tabs { display: flex; gap: var(--space-1); background: var(--bg-card); padding: var(--space-1); border-radius: var(--radius-md); border: 1px solid var(--border); overflow-x: auto; }
.tab-btn { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--text-secondary); border-radius: var(--radius-sm); cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; }
.tab-btn:hover { color: var(--text-primary); background: var(--bg-card-hover); }
.tab-btn.active { background: var(--accent-lime); color: var(--text-inverse); }

/* ── PROGRESS BAR ── */
.progress-bar { width: 100%; height: 8px; background: var(--bg-card); border-radius: var(--radius-full); overflow: hidden; border: 1px solid var(--border); }
.progress-bar-fill { height: 100%; border-radius: var(--radius-full); background: linear-gradient(90deg, var(--accent-violet), var(--accent-lime)); transition: width var(--transition-slow); }

/* ── STEP INDICATORS ── */
.step-indicator { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-6); }
.step-dot { width: 32px; height: 32px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: var(--weight-bold); background: var(--bg-card); border: 2px solid var(--border); color: var(--text-muted); transition: all var(--transition-fast); }
.step-dot.active { background: var(--accent-lime); border-color: var(--accent-lime); color: var(--text-inverse); box-shadow: var(--shadow-glow-lime); }
.step-dot.complete { background: var(--success); border-color: var(--success); color: var(--text-inverse); }
.step-connector { flex: 1; height: 2px; background: var(--border); transition: background var(--transition-base); }
.step-connector.complete { background: var(--success); }

/* ── CHAT MESSAGES ── */
.chat-message { display: flex; gap: var(--space-3); animation: fadeSlideUp 0.3s ease-out; }
.chat-message.ai { flex-direction: row; }
.chat-message.user { flex-direction: row-reverse; }
.chat-avatar { width: 32px; height: 32px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-size: 0.875rem; flex-shrink: 0; }
.chat-message.ai .chat-avatar { background: rgba(123,94,255,0.2); border: 1px solid rgba(123,94,255,0.3); }
.chat-message.user .chat-avatar { background: rgba(189,255,71,0.2); border: 1px solid rgba(189,255,71,0.3); }
.chat-bubble { max-width: 85%; padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg); font-size: var(--text-sm); line-height: var(--leading-relaxed); }
.chat-message.ai .chat-bubble { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); }
.chat-message.user .chat-bubble { background: rgba(189,255,71,0.1); border: 1px solid rgba(189,255,71,0.15); color: var(--text-primary); }
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: var(--space-3) var(--space-4); }
.typing-indicator span { width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out; }
.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
@keyframes headShake { 0% { transform: translateX(0); } 12.5% { transform: translateX(-6px); } 37.5% { transform: translateX(6px); } 62.5% { transform: translateX(-4px); } 87.5% { transform: translateX(4px); } 100% { transform: translateX(0); } }

/* ── SCORE CARD ── */
.score-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: var(--space-8); text-align: center; }
.score-card .score-value { font-family: var(--font-display); font-size: var(--text-5xl); font-weight: var(--weight-bold); margin-bottom: var(--space-2); }
.score-card .score-label { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-6); }
.score-dimensions { display: flex; flex-direction: column; gap: var(--space-4); text-align: left; }
.score-dimension { display: flex; flex-direction: column; gap: var(--space-2); }
.score-dimension-header { display: flex; justify-content: space-between; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.score-dimension-bar { height: 8px; background: var(--bg-primary); border-radius: var(--radius-full); overflow: hidden; }
.score-dimension-fill { height: 100%; border-radius: var(--radius-full); transition: width 1s ease-out; }
.score-dimension-fill.good { background: var(--accent-lime); }
.score-dimension-fill.medium { background: var(--warning); }
.score-dimension-fill.low { background: var(--error); }

/* ── DRAG & DROP ── */
.drag-zone { min-height: 80px; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-2); transition: all var(--transition-fast); }
.drag-zone.drag-over { border-color: var(--accent-lime); background: rgba(189,255,71,0.05); }
.drag-zone.correct { border-color: var(--success); background: rgba(77,255,176,0.05); }
.drag-zone.incorrect { border-color: var(--error); animation: headShake 0.5s ease-in-out; }
.drag-card { padding: var(--space-2) var(--space-4); background: var(--bg-card-hover); border: 1px solid var(--border); border-radius: var(--radius-md); font-size: var(--text-sm); cursor: grab; transition: all var(--transition-fast); user-select: none; }
.drag-card:active { cursor: grabbing; transform: scale(1.05); box-shadow: var(--shadow-md); }
.drag-card.selected { border-color: var(--accent-lime); background: rgba(189,255,71,0.1); }

/* ── RANGE SLIDER ── */
.range-slider-group { display: flex; flex-direction: column; gap: var(--space-2); }
.range-slider-labels { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--text-muted); }
.range-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--bg-card); border-radius: var(--radius-full); outline: none; border: 1px solid var(--border); }
.range-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; background: var(--accent-lime); border-radius: 50%; cursor: pointer; box-shadow: var(--shadow-glow-lime); }
.range-slider::-moz-range-thumb { width: 20px; height: 20px; background: var(--accent-lime); border-radius: 50%; cursor: pointer; border: none; }

/* ── SKELETON ── */
.skeleton { background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%); background-size: 600px 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-md); }
.skeleton-text { height: 14px; margin-bottom: var(--space-2); }
.skeleton-title { height: 24px; width: 60%; margin-bottom: var(--space-4); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: var(--space-16) var(--space-8); }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-state h3 { margin-bottom: var(--space-2); color: var(--text-secondary); }
.empty-state p { color: var(--text-muted); max-width: 40ch; margin: 0 auto; }
