/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  line-height: 1;
  transition: transform var(--dur-fast) var(--ease-out),
              background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

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

.btn-primary {
  background: var(--lfm-blue-800);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 44, 107, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--lfm-blue-700);
}

.btn-secondary {
  background: var(--lfm-blue-50);
  color: var(--lfm-blue-800);
}

.btn-ghost {
  background: transparent;
  color: var(--lfm-blue-700);
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-amber {
  background: var(--accent-amber);
  color: var(--lfm-blue-900);
}

.btn-outline {
  background: transparent;
  color: var(--lfm-blue-800);
  border: 1.5px solid var(--lfm-blue-200);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  padding: 16px 24px;
  font-size: var(--text-lg);
}

.btn-sm {
  padding: 9px 14px;
  font-size: var(--text-sm);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
}

/* === INPUTS === */
.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--gray-700);
  margin-bottom: 6px;
}

.input {
  display: block;
  width: 100%;
  padding: 14px 16px;
  background: white;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--gray-950);
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.input:focus {
  border-color: var(--lfm-blue-500);
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.12);
}

.input.error {
  border-color: var(--error);
}

.input-helper {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 4px;
}

.input-error {
  font-size: var(--text-xs);
  color: var(--error);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-wrap {
  position: relative;
}

.input-wrap .input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-500);
  cursor: pointer;
}

/* OTP input */
.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 24px 0;
}

.otp-cell {
  width: 46px;
  height: 56px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  background: white;
  color: var(--gray-950);
}

.otp-cell:focus {
  border-color: var(--lfm-blue-500);
  box-shadow: 0 0 0 3px rgba(45, 108, 223, 0.12);
}

.otp-cell.filled {
  background: var(--lfm-blue-50);
  border-color: var(--lfm-blue-200);
}

/* === CARDS === */
.card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

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

.card.interactive {
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}

.card.interactive:active {
  transform: scale(0.98);
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-blue { background: var(--lfm-blue-50); color: var(--lfm-blue-800); }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-mint { background: #D1FAE5; color: #065F46; }
.badge-coral { background: #FEE2E2; color: #991B1B; }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-success { background: #D1FAE5; color: var(--success); }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-error { background: #FEE2E2; color: var(--error); }

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-coral);
  display: inline-block;
}

/* === TOGGLE === */
.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}

.toggle-content {
  flex: 1;
  margin-right: 16px;
}

.toggle-label {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--gray-950);
  display: block;
}

.toggle-desc {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

.toggle-switch {
  appearance: none;
  width: 52px;
  height: 32px;
  background: var(--gray-300);
  border-radius: 999px;
  position: relative;
  transition: background var(--dur-base) var(--ease-out);
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  transition: transform var(--dur-base) var(--ease-spring);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.toggle-switch:checked {
  background: var(--success);
}

.toggle-switch:checked::after {
  transform: translateX(20px);
}

/* === TOAST === */
.toast-container {
  position: absolute;
  top: 60px;
  left: 16px;
  right: 16px;
  z-index: var(--z-toast);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-950);
  color: white;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--dur-base) var(--ease-spring);
  pointer-events: auto;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--error); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--lfm-blue-700); }

.toast.leaving {
  animation: toast-out var(--dur-base) var(--ease-out) forwards;
}

@keyframes toast-in {
  from { transform: translateY(-30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes toast-out {
  to { transform: translateY(-30px); opacity: 0; }
}

/* === MODAL === */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 39, 0.6);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: backdrop-in var(--dur-base) var(--ease-out);
}

.modal-backdrop.leaving {
  animation: backdrop-out var(--dur-base) var(--ease-out) forwards;
}

.modal {
  background: white;
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 340px;
  width: 100%;
  animation: modal-in var(--dur-slow) var(--ease-spring);
}

.modal-title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-bottom: 8px;
}

.modal-content {
  font-size: var(--text-sm);
  color: var(--gray-700);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes backdrop-out {
  to { opacity: 0; }
}

@keyframes modal-in {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* === BOTTOM SHEET === */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 14, 39, 0.6);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  animation: backdrop-in var(--dur-base) var(--ease-out);
}

.sheet-backdrop.leaving {
  animation: backdrop-out var(--dur-base) var(--ease-out) forwards;
}

.bottom-sheet {
  width: 100%;
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 16px 16px 32px;
  animation: sheet-in var(--dur-slow) var(--ease-spring);
  max-height: 85%;
  overflow-y: auto;
}

.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--gray-300);
  border-radius: 999px;
  margin: 0 auto 16px;
}

.sheet-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  text-align: center;
  margin-bottom: 16px;
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-backdrop.leaving .bottom-sheet {
  animation: sheet-out var(--dur-base) var(--ease-out) forwards;
}

@keyframes sheet-out {
  to { transform: translateY(100%); }
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 12px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur-fast);
}

.sheet-item:hover {
  background: var(--gray-100);
}

.sheet-item.danger {
  color: var(--error);
}

.sheet-item.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.sheet-item svg {
  flex-shrink: 0;
}

/* === TAB BAR === */
.tabbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 84px;
  padding-bottom: 16px;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--gray-100);
  display: flex;
  z-index: var(--z-tabbar);
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px 0;
  color: var(--gray-500);
  font-size: 10px;
  font-weight: 500;
  position: relative;
  transition: color var(--dur-fast);
}

.tab-item.active {
  color: var(--lfm-blue-700);
}

.tab-item .tab-dot {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lfm-blue-700);
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.tab-item.active .tab-dot {
  opacity: 1;
}

.tab-badge {
  position: absolute;
  top: 4px;
  right: 50%;
  transform: translateX(18px);
  background: var(--accent-amber);
  color: var(--lfm-blue-900);
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}

/* === HEADERS === */
.app-header {
  display: flex;
  align-items: center;
  padding: 8px 20px 16px;
  background: white;
  z-index: var(--z-header);
}

.app-header-title {
  flex: 1;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  text-align: center;
}

.app-header-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background var(--dur-fast);
  color: var(--lfm-blue-800);
}

.app-header-back:hover {
  background: var(--gray-100);
}

.app-header-action {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--lfm-blue-800);
}

.app-header-action:hover {
  background: var(--gray-100);
}

.app-header.transparent {
  background: transparent;
  color: white;
}

.app-header.transparent .app-header-back,
.app-header.transparent .app-header-action {
  color: white;
}

/* === WEBVIEW HEADER === */
.webview-bar {
  background: #f5f5f7;
  padding: 58px 16px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--gray-300);
}

.webview-url {
  flex: 1;
  background: white;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--gray-700);
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: -apple-system, sans-serif;
}

.webview-url .lock {
  color: var(--success);
  font-size: 11px;
}

.webview-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-700);
}

/* === CHIPS === */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--gray-100);
  color: var(--gray-700);
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: all var(--dur-fast);
  white-space: nowrap;
}

.chip:hover {
  background: var(--lfm-blue-50);
  color: var(--lfm-blue-800);
}

.chip.active {
  background: var(--lfm-blue-800);
  color: white;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0;
}

/* === STATS === */
.stat-row {
  display: flex;
  gap: 12px;
}

.stat-card {
  flex: 1;
  background: rgba(255,255,255,0.1);
  padding: 12px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-label {
  font-size: var(--text-xs);
  opacity: 0.7;
  display: block;
  margin-bottom: 4px;
}

.stat-value {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums;
}

/* === LIST ITEMS (settings style) === */
.list-group {
  background: white;
  border-radius: var(--radius-xl);
  overflow: hidden;
  margin-bottom: 16px;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--dur-fast);
}

.list-item:last-child {
  border-bottom: none;
}

.list-item:hover {
  background: var(--gray-50);
}

.list-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--lfm-blue-50);
  color: var(--lfm-blue-800);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.list-item-content {
  flex: 1;
  min-width: 0;
}

.list-item-title {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  color: var(--gray-950);
}

.list-item-subtitle {
  font-size: var(--text-xs);
  color: var(--gray-500);
  margin-top: 2px;
}

.list-item-chevron {
  color: var(--gray-300);
  flex-shrink: 0;
}

.list-item.danger .list-item-title {
  color: var(--error);
}

.list-item.danger .list-item-icon {
  background: #FEE2E2;
  color: var(--error);
}

/* === LOADER === */
.loader-dots {
  display: inline-flex;
  gap: 6px;
}

.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: dot-bounce 1.2s infinite var(--ease-out);
}

.loader-dots span:nth-child(2) { animation-delay: 0.15s; }
.loader-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-8px); opacity: 1; }
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-300);
  border-top-color: var(--lfm-blue-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === SKELETON === */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 0%, var(--gray-200, #e9eef5) 50%, var(--gray-100) 100%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === Avatar === */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-amber);
  color: var(--lfm-blue-900);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.avatar.lg {
  width: 64px;
  height: 64px;
  font-size: 22px;
}

.avatar.sm {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.avatar.blue {
  background: var(--lfm-blue-700);
  color: white;
}

/* === Progress Bar === */
.progress {
  width: 100%;
  height: 4px;
  background: var(--gray-100);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--lfm-blue-700);
  transition: width var(--dur-slow) var(--ease-out);
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--gray-500);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  color: var(--gray-300);
}

.empty-state h3 {
  color: var(--gray-700);
  font-size: var(--text-lg);
  margin-bottom: 8px;
}

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