/* ══════════════════════════════════════════════════════════════
   PADOSHI — Reusable UI Components
   ══════════════════════════════════════════════════════════════ */

/* ── 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-sans);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
  white-space: nowrap;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.btn:active::after {
  opacity: 1;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
  color: white;
}

.btn-primary:active {
  transform: translateY(0);
}

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

.btn-secondary:hover {
  background: var(--bg-tertiary);
  border-color: var(--primary-300);
  color: var(--text-primary);
}

.btn-accent {
  background: var(--gradient-saffron);
  color: white;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(249, 115, 22, 0.45);
  color: white;
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
  color: white;
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-success:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-2) var(--space-3);
}

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

.btn-icon {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  width: 40px;
  height: 40px;
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-md);
  border-radius: var(--radius-xl);
}

.btn-full {
  width: 100%;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn .btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Input Fields ─────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  color: var(--text-primary);
  transition: all var(--duration-normal) var(--ease-default);
}

.form-input:hover {
  border-color: var(--border-default);
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  background: var(--bg-elevated);
}

[data-theme="dark"] .form-input:focus {
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.15);
}

.form-input.error {
  border-color: var(--danger-500);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger-500);
  margin-top: var(--space-1);
}

textarea.form-input {
  min-height: 100px;
  line-height: var(--leading-relaxed);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all var(--duration-normal) var(--ease-default);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-body {
  padding: var(--space-4);
}

.card-header {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border-light);
}

.card-footer {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-light);
}

.card-glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.15);
}

[data-theme="dark"] .card-glass {
  border-color: rgba(255,255,255,0.08);
}

/* ── Avatar ───────────────────────────────────────────────── */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: var(--text-sm);
  font-family: var(--font-display);
  position: relative;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-xs { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-sm { width: 32px; height: 32px; font-size: var(--text-xs); }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 64px; height: 64px; font-size: var(--text-xl); }
.avatar-xl { width: 96px; height: 96px; font-size: var(--text-3xl); }

.avatar-online::after {
  content: '';
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 10px;
  height: 10px;
  background: var(--success-500);
  border: 2px solid var(--bg-secondary);
  border-radius: 50%;
}

.avatar-group {
  display: flex;
}

.avatar-group .avatar {
  margin-left: -8px;
  border: 2px solid var(--bg-secondary);
}

.avatar-group .avatar:first-child {
  margin-left: 0;
}

/* ── Badge ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.4;
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-100);
  color: var(--primary-700);
}

[data-theme="dark"] .badge-primary {
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-300);
}

.badge-accent {
  background: var(--accent-100);
  color: var(--accent-700);
}

[data-theme="dark"] .badge-accent {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-300);
}

.badge-success {
  background: var(--success-100);
  color: var(--success-700);
}

[data-theme="dark"] .badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success-400);
}

.badge-danger {
  background: var(--danger-100);
  color: var(--danger-700);
}

[data-theme="dark"] .badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger-400);
}

.badge-warning {
  background: var(--warning-100);
  color: var(--warning-600);
}

.badge-ghost {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: 2px;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-default);
  border: none;
  background: none;
  text-decoration: none;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.tab.active {
  color: var(--primary-600);
  background: var(--primary-50);
  font-weight: 600;
}

[data-theme="dark"] .tab.active {
  color: var(--primary-300);
  background: rgba(99, 102, 241, 0.12);
}

/* ── Chips / Tags ─────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-full);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  border: 1px solid transparent;
}

.chip:hover {
  background: var(--primary-50);
  color: var(--primary-600);
  border-color: var(--primary-200);
}

.chip.active {
  background: var(--primary-600);
  color: white;
  border-color: var(--primary-600);
}

/* ── Toast / Snackbar ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  pointer-events: all;
  animation: toastIn var(--duration-normal) var(--ease-spring);
  min-width: 280px;
  max-width: 420px;
}

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

.toast-message {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
}

.toast-close {
  cursor: pointer;
  color: var(--text-tertiary);
  padding: var(--space-1);
}

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn var(--duration-normal) var(--ease-default);
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-elevated);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn var(--duration-normal) var(--ease-spring);
}

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

.modal-header h3 {
  font-size: var(--text-lg);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border-light);
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.empty-state-icon svg {
  width: 36px;
  height: 36px;
  color: var(--text-tertiary);
}

.empty-state h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.empty-state p {
  max-width: 320px;
  font-size: var(--text-sm);
}

/* ── Separator ────────────────────────────────────────────── */
.separator {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-4) 0;
}

.separator-or {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  margin: var(--space-6) 0;
}

.separator-or::before,
.separator-or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* ── Skeleton Loader ──────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-avatar {
  border-radius: var(--radius-full);
}

.skeleton-image {
  aspect-ratio: 16/9;
}

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-dropdown);
  padding: var(--space-1);
  animation: dropdownIn var(--duration-fast) var(--ease-spring);
}

.dropdown-menu.hidden {
  display: none;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
  width: 100%;
  text-align: left;
  border: none;
  background: none;
}

.dropdown-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.dropdown-item.danger {
  color: var(--danger-500);
}

.dropdown-item.danger:hover {
  background: var(--danger-50);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-1) 0;
}

/* ── Toggle Switch ────────────────────────────────────────── */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease-bounce);
}

.toggle input:checked + .toggle-slider {
  background: var(--primary-600);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

[data-theme="dark"] .toggle-slider {
  background: var(--gray-700);
}

/* ── Notification Dot ─────────────────────────────────────── */
.notif-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: var(--danger-500);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--danger-500);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-secondary);
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-default);
}

/* ── OTP Input ────────────────────────────────────────────── */
.otp-inputs {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
}

.otp-input {
  width: 52px;
  height: 56px;
  text-align: center;
  font-size: var(--text-2xl);
  font-weight: 700;
  font-family: var(--font-display);
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  transition: all var(--duration-normal) var(--ease-default);
}

.otp-input:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.otp-input.filled {
  border-color: var(--primary-500);
  background: var(--primary-50);
}

[data-theme="dark"] .otp-input.filled {
  background: rgba(99, 102, 241, 0.1);
}

/* ── Image Upload ─────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-default);
}

.upload-zone:hover {
  border-color: var(--primary-400);
  background: var(--primary-50);
}

[data-theme="dark"] .upload-zone:hover {
  background: rgba(99, 102, 241, 0.05);
}

.upload-zone svg {
  width: 40px;
  height: 40px;
  color: var(--text-tertiary);
  margin: 0 auto var(--space-3);
}

.upload-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.upload-preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.upload-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,0.6);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
}

/* ── Verified Badge ────────────────────────────────────────── */
.verified-badge {
  font-size: 12px;
  cursor: help;
  margin-left: 2px;
  display: inline-block;
  line-height: 1;
}

.verified-badge.small {
  font-size: 8px;
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--bg-secondary);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Severity Indicators ──────────────────────────────────── */
.severity-low      { color: var(--info-500); }
.severity-medium   { color: var(--warning-500); }
.severity-high     { color: var(--saffron-500); }
.severity-critical { color: var(--danger-500); }

.severity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.severity-dot.low      { background: var(--info-500); }
.severity-dot.medium   { background: var(--warning-500); }
.severity-dot.high     { background: var(--saffron-500); }
.severity-dot.critical { background: var(--danger-500); animation: pulse 2s infinite; }

/* ── Price Tag ────────────────────────────────────────────── */
.price {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
}

.price-currency {
  font-size: 0.75em;
  color: var(--text-secondary);
}

.price-free {
  color: var(--success-600);
  font-weight: 600;
}

.price-negotiable {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: 400;
}

/* ── Reaction Buttons ─────────────────────────────────────── */
.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--duration-fast);
  background: none;
  border: none;
}

.reaction-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.reaction-btn.active {
  color: var(--primary-600);
}

.reaction-btn.active.liked {
  color: var(--danger-500);
}

.reaction-btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--duration-fast) var(--ease-bounce);
}

.reaction-btn:active svg {
  transform: scale(1.3);
}

/* ── FAB (Floating Action Button) ─────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-4));
  right: var(--space-4);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--gradient-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
  cursor: pointer;
  z-index: var(--z-sticky);
  transition: all var(--duration-normal) var(--ease-default);
  border: none;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
}

.fab:active {
  transform: scale(0.95);
}

.fab svg {
  width: 24px;
  height: 24px;
}

@media (min-width: 768px) {
  .fab {
    bottom: var(--space-8);
    right: var(--space-8);
  }
}

@media (min-width: 1200px) {
  .fab {
    right: calc(50% - 600px + var(--space-8) * 2);
  }
}
