/* =============================================
   BankQR Component Styles
   VOS Design Skill: 44px touch targets,
   rounded corners, iOS-native feel
   ============================================= */

/* =============================================
   Cards
   ============================================= */

.card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  box-shadow: var(--shadow-xs);
}

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

.card-pressable:active {
  transform: scale(0.98);
  box-shadow: none;
}

/* =============================================
   Buttons
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--touch-min);
  padding: var(--sp-3) var(--sp-5);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast);
  text-decoration: none;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

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

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
  min-height: 52px;
  font-size: var(--fs-md);
}

.btn-primary:active {
  background: #1a2230;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-color-strong);
}

.btn-text {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--sp-2) var(--sp-3);
  min-height: 36px;
}

.btn-danger-text {
  background: transparent;
  color: var(--text-danger);
  padding: var(--sp-2) var(--sp-3);
  min-height: 36px;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: var(--touch-min);
  height: var(--touch-min);
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-primary);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================================
   Bottom Navigation
   ============================================= */

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 0.5px solid var(--border-color);
  padding-bottom: var(--safe-bottom);
  box-shadow: var(--shadow-nav);
}

.bottom-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: var(--nav-height);
  max-width: 500px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 4px 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 10px;
  font-weight: var(--fw-medium);
  font-family: var(--font-family);
  transition: color var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.nav-item.active {
  color: var(--text-primary);
}

.nav-item__icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item__icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.nav-fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--fab-size);
  height: var(--fab-size);
  border-radius: 50%;
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
  border: none;
  margin-top: -20px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}

.nav-fab:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-md);
}

.nav-fab svg {
  width: 26px;
  height: 26px;
}

/* =============================================
   Chips / Tags
   ============================================= */

.chip-row {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding: var(--sp-1) 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 36px;
  padding: 0 var(--sp-4);
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}

.chip.active {
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
  border-color: var(--accent-primary);
}

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

/* =============================================
   Transaction List Item
   ============================================= */

.tx-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  min-height: 60px;
  border-bottom: 0.5px solid var(--border-color);
  cursor: pointer;
}

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

.tx-item__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-l2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.tx-item__body {
  flex: 1;
  min-width: 0;
}

.tx-item__name {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-item__meta {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.tx-item__amount {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tx-item__amount.expense {
  color: var(--text-primary);
}

.tx-item__amount.income {
  color: var(--text-success);
}

.tx-item__time {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  text-align: right;
}

/* =============================================
   Search Bar
   ============================================= */

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-surface-l2);
  border-radius: var(--radius-md);
  padding: 0 var(--sp-3);
  min-height: var(--touch-min);
}

.search-bar__icon {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.search-bar__icon svg {
  width: 18px;
  height: 18px;
}

.search-bar__input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-family);
  font-size: var(--fs-base);
  color: var(--text-primary);
  outline: none;
  min-height: var(--touch-min);
}

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

.search-bar__clear {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text-tertiary);
  color: var(--bg-surface);
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

.search-bar__clear.visible {
  display: flex;
}

/* =============================================
   Segmented Control
   ============================================= */

.segmented {
  display: flex;
  background: var(--bg-surface-l2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.segmented__item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 var(--sp-3);
  border-radius: var(--radius-xs);
  background: transparent;
  border: none;
  font-family: var(--font-family);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}

.segmented__item.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-sm);
}

/* =============================================
   Settings List
   ============================================= */

.settings-group {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--touch-min);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 0.5px solid var(--border-color);
  cursor: pointer;
  transition: background var(--duration-fast);
  -webkit-tap-highlight-color: transparent;
}

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

.settings-item:active {
  background: var(--bg-surface-l2);
}

.settings-item__label {
  font-size: var(--fs-base);
  font-weight: var(--fw-normal);
  color: var(--text-primary);
}

.settings-item__sublabel {
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-top: 1px;
}

.settings-item__value {
  font-size: var(--fs-base);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.settings-item__chevron {
  color: var(--text-tertiary);
}

/* =============================================
   Toast
   ============================================= */

.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  background: var(--text-primary);
  color: var(--text-on-dark);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  transform: translateY(-20px) scale(0.95);
  transition: all var(--duration-normal) var(--ease-spring);
  pointer-events: auto;
  max-width: calc(100vw - 48px);
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast.success {
  background: var(--accent-success);
}

.toast.error {
  background: var(--accent-danger);
}

/* =============================================
   Bottom Sheet
   ============================================= */

.sheet-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal), visibility var(--duration-normal);
}

.sheet-overlay.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 201;
  background: var(--bg-surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--sp-4);
  padding-bottom: calc(var(--sp-6) + var(--safe-bottom));
  max-height: 92dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform var(--duration-slow) var(--ease-out);
}

.sheet.open {
  transform: translateY(0);
}

.sheet__handle {
  width: 36px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--border-color-strong);
  margin: 0 auto var(--sp-4);
}

/* =============================================
   Skeleton Loading
   ============================================= */

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-surface-l2) 25%,
    var(--bg-surface) 50%,
    var(--bg-surface-l2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

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

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
  width: 80%;
}

.skeleton-title {
  height: 24px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

/* =============================================
   Empty State
   ============================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}

.empty-state__icon {
  font-size: 48px;
  margin-bottom: var(--sp-4);
  opacity: 0.3;
}

.empty-state__text {
  font-size: var(--fs-base);
  color: var(--text-tertiary);
}

/* =============================================
   Toggle Switch
   ============================================= */

.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

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

.toggle__track {
  position: absolute;
  inset: 0;
  background: var(--bg-surface-l2);
  border-radius: 16px;
  transition: background var(--duration-fast);
  cursor: pointer;
}

.toggle input:checked + .toggle__track {
  background: var(--accent-primary);
}

.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--duration-fast) var(--ease-out);
  pointer-events: none;
}

.toggle input:checked ~ .toggle__thumb {
  transform: translateX(20px);
}

/* =============================================
   Badge
   ============================================= */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
}

.badge-default {
  background: var(--accent-primary);
  color: var(--accent-primary-fg);
}
