/* =========================================
   METRO TEHRAN — MAIN STYLESHEET
   ========================================= */

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html {
  font-size: 16px;
  height: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-primary);
  direction: rtl;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  overscroll-behavior: none;
}

input, textarea, button, select {
  font-family: var(--font-family);
  direction: rtl;
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: inherit;
  text-decoration: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  outline: none;
}

/* =========================================
   SCROLLBAR CUSTOMIZATION
   ========================================= */
::-webkit-scrollbar {
  width: 0;
  height: 0;
}

/* =========================================
   APP SHELL
   ========================================= */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  max-width: var(--content-max-width);
  margin: 0 auto;
  background: var(--color-bg-primary);
  overflow: hidden;
}

/* Safe area padding for notched devices */
#app::before {
  content: '';
  display: block;
  height: var(--safe-area-top);
  background: var(--color-bg-primary);
  flex-shrink: 0;
}

/* =========================================
   SPLASH SCREEN
   ========================================= */
#splash {
  position: fixed;
  inset: 0;
  z-index: var(--z-splash);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-primary);
  transition: opacity var(--duration-slower) var(--ease-out),
              transform var(--duration-slower) var(--ease-out);
}

#splash.fade-out {
  opacity: 0;
  transform: scale(1.05);
  pointer-events: none;
}

.splash-logo {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-2xl);
  background: linear-gradient(135deg, var(--line-1) 0%, var(--line-2) 50%, var(--line-5) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-xl);
  animation: splashLogoIn 0.8s var(--ease-spring) forwards;
  transform: scale(0) rotate(-10deg);
}

.splash-logo svg {
  width: 44px;
  height: 44px;
  color: white;
}

.splash-title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  animation: splashTextIn 0.6s 0.3s var(--ease-spring) both;
}

.splash-subtitle {
  font-size: var(--font-size-base);
  color: var(--color-text-tertiary);
  margin-top: var(--space-2);
  animation: splashTextIn 0.6s 0.4s var(--ease-spring) both;
}

.splash-progress {
  position: absolute;
  bottom: calc(var(--space-12) + var(--safe-area-bottom));
  width: 120px;
  height: 3px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  animation: splashTextIn 0.6s 0.5s var(--ease-spring) both;
}

.splash-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--line-1), var(--line-2), var(--line-5));
  background-size: 200% 100%;
  border-radius: var(--radius-full);
  animation: splashProgress 1.8s var(--ease-in-out) forwards,
             gradientShift 2s linear infinite;
}

@keyframes splashLogoIn {
  to { transform: scale(1) rotate(0deg); }
}

@keyframes splashTextIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes splashProgress {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* =========================================
   PAGE CONTAINER
   ========================================= */
#page-container {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.page {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: none;
  z-index: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.page.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 2;
}

.page:not(.active) {
  pointer-events: none !important;
}

.page:not(.active) * {
  pointer-events: none !important;
}

.page.slide-in-right {
  animation: slideInRight var(--duration-slow) var(--ease-apple) forwards;
}

.page.slide-in-left {
  animation: slideInLeft var(--duration-slow) var(--ease-apple) forwards;
}

.page.slide-out-right {
  animation: slideOutRight var(--duration-slow) var(--ease-apple) forwards;
}

.page.slide-out-left {
  animation: slideOutLeft var(--duration-slow) var(--ease-apple) forwards;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0.5; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(-100%); opacity: 0.5; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0.5; }
}

@keyframes slideOutLeft {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(-100%); opacity: 0.5; }
}

/* =========================================
   BOTTOM NAVIGATION
   ========================================= */
#bottom-nav {
  position: relative;
  z-index: var(--z-sticky);
  height: calc(var(--nav-height) + var(--safe-area-bottom));
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--color-border);
  box-shadow: var(--shadow-bottom-nav);
  display: flex;
  align-items: flex-start;
  padding-bottom: var(--safe-area-bottom);
  flex-shrink: 0;
}

.nav-items {
  display: flex;
  width: 100%;
  height: var(--nav-height);
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  position: relative;
  padding: var(--space-2) var(--space-1);
  transition: transform var(--duration-fast) var(--ease-out);
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-icon-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-spring);
}

.nav-item.active .nav-icon-wrap {
  background: var(--color-accent-light);
  transform: scale(1.08) translateY(-1px);
}

.nav-item svg {
  width: 22px;
  height: 22px;
  color: var(--color-text-tertiary);
  transition: color var(--duration-normal) var(--ease-out),
              transform var(--duration-normal) var(--ease-spring);
  stroke-width: 1.75;
}

.nav-item.active svg {
  color: var(--color-accent);
  stroke-width: 2;
}

.nav-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  transition: color var(--duration-normal) var(--ease-out);
  white-space: nowrap;
}

.nav-item.active .nav-label {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

.nav-badge {
  position: absolute;
  top: -2px;
  left: 2px;
  width: 8px;
  height: 8px;
  background: var(--color-error);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg-primary);
}

/* =========================================
   PAGE HEADER
   ========================================= */
.page-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid transparent;
  padding: var(--space-4) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--header-height);
  transition: border-color var(--duration-normal) var(--ease-out),
              box-shadow var(--duration-normal) var(--ease-out);
}

.page-header.scrolled {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.page-header-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  flex: 1;
  letter-spacing: -0.01em;
}

.back-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
  transition: background var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.back-btn:active {
  background: var(--color-border);
  transform: scale(0.92);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

/* =========================================
   CARDS
   ========================================= */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  overflow: hidden;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.card:active {
  transform: scale(0.98);
  box-shadow: var(--shadow-xs);
}

.card-pressable {
  cursor: pointer;
}

/* =========================================
   LINE BADGES
   ========================================= */
.line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: white;
  line-height: 1;
  min-width: 24px;
}

.line-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.line-indicator {
  width: 4px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* =========================================
   SEARCH BAR
   ========================================= */
.search-container {
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-primary);
}

.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-bg-secondary);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}

.search-bar:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  background: var(--color-surface);
}

.search-bar svg {
  width: 18px;
  height: 18px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  transition: color var(--duration-fast) var(--ease-out);
}

.search-bar:focus-within svg {
  color: var(--color-accent);
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  font-family: var(--font-family);
  direction: rtl;
  text-align: right;
}

.search-input::placeholder {
  color: var(--color-text-tertiary);
}

.search-clear {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-text-tertiary);
  color: var(--color-bg-primary);
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.search-clear.visible {
  display: flex;
}

.search-clear svg {
  width: 10px;
  height: 10px;
  color: white !important;
}

/* =========================================
   STATION ITEM
   ========================================= */
.station-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-surface);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  position: relative;
}

.station-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: calc(var(--space-4) + 40px);
  left: var(--space-4);
  height: 1px;
  background: var(--color-border);
}

.station-item:last-child::after {
  display: none;
}

.station-item:active {
  background: var(--color-bg-secondary);
}

.station-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.station-info {
  flex: 1;
  min-width: 0;
}

.station-name {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
  line-height: var(--line-height-snug);
}

.station-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: 2px;
  flex-wrap: wrap;
}

.station-meta-text {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
}

.station-chevron {
  width: 20px;
  height: 20px;
  color: var(--color-text-tertiary);
  flex-shrink: 0;
}

/* =========================================
   BOTTOM SHEET
   ========================================= */
.bottom-sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--color-bg-overlay);
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-slow) var(--ease-out);
  backdrop-filter: blur(4px);
}

.bottom-sheet-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: var(--content-max-width);
  z-index: var(--z-modal);
  background: var(--color-surface);
  border-radius: var(--radius-3xl) var(--radius-3xl) 0 0;
  box-shadow: var(--shadow-2xl);
  transition: transform var(--duration-slower) var(--ease-apple);
  padding-bottom: calc(var(--space-6) + var(--safe-area-bottom));
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet.visible {
  transform: translateX(-50%) translateY(0);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
  margin: var(--space-3) auto var(--space-5);
}

.bottom-sheet-header {
  padding: 0 var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bottom-sheet-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

/* =========================================
   SNACKBAR / TOAST
   ========================================= */
#snackbar-container {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-4));
  left: var(--space-4);
  right: var(--space-4);
  max-width: calc(var(--content-max-width) - var(--space-8));
  margin: 0 auto;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.snackbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-text-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  pointer-events: auto;
  animation: snackbarIn var(--duration-slow) var(--ease-spring) forwards;
}

.snackbar.hiding {
  animation: snackbarOut var(--duration-normal) var(--ease-in) forwards;
}

.snackbar-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

@keyframes snackbarIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes snackbarOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* =========================================
   SKELETON LOADER
   ========================================= */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-tertiary) 25%,
    var(--color-border) 50%,
    var(--color-bg-tertiary) 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; }
}

/* =========================================
   BUTTONS
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
  border: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--color-accent);
  color: white;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
}

.btn-secondary {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-md);
  border-radius: var(--radius-2xl);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-lg);
}

.btn svg {
  width: 18px;
  height: 18px;
}

/* =========================================
   CHIPS / TAGS
   ========================================= */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.chip-outline {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text-secondary);
}

.chip-filled {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
}

.chip.selected {
  background: var(--color-accent-light);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* =========================================
   EMPTY STATE
   ========================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  gap: var(--space-4);
  animation: fadeIn var(--duration-slow) var(--ease-out) forwards;
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-2xl);
  background: var(--color-bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
}

.empty-state-icon svg {
  width: 36px;
  height: 36px;
}

.empty-state-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

.empty-state-text {
  font-size: var(--font-size-base);
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  max-width: 240px;
}

/* =========================================
   SECTION HEADER
   ========================================= */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-4) var(--space-3);
}

.section-title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.section-action {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-accent);
  cursor: pointer;
}

/* =========================================
   DIVIDER
   ========================================= */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: 0;
}

.divider-thick {
  height: 8px;
  background: var(--color-bg-secondary);
}

/* =========================================
   TOGGLE SWITCH
   ========================================= */
.toggle {
  position: relative;
  width: 50px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--duration-normal) var(--ease-out);
}

.toggle input:checked + .toggle-track {
  background: var(--color-accent);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-normal) var(--ease-spring);
  pointer-events: none;
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(-22px);
}

/* =========================================
   RIPPLE EFFECT
   ========================================= */
.ripple-container {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.25);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}

/* =========================================
   UTILITY CLASSES
   ========================================= */
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-error { color: var(--color-error); }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-md { font-size: var(--font-size-md); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }

.font-regular { font-weight: var(--font-weight-regular); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }

.p-4 { padding: var(--space-4); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mb-4 { margin-bottom: var(--space-4); }
.mx-4 { margin-left: var(--space-4); margin-right: var(--space-4); }
.px-5 { padding-left: var(--space-5); padding-right: var(--space-5); }

.w-full { width: 100%; }
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }

.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.animate-fade-in { animation: fadeIn var(--duration-slow) var(--ease-out) forwards; }
.animate-scale-in { animation: scaleIn var(--duration-normal) var(--ease-spring) forwards; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-pulse { animation: pulse 2s ease-in-out infinite; }

/* Persian numbers helper */
.persian-num {
  font-feature-settings: 'kern' 1;
}

/* =========================================
   LOADING INDICATOR
   ========================================= */
.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* =========================================
   ALERT BANNER
   ========================================= */
.alert-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
}

.alert-banner.info {
  background: var(--color-info-light);
  color: var(--color-info);
}

.alert-banner.warning {
  background: var(--color-warning-light);
  color: #92400E;
}

[data-theme="dark"] .alert-banner.warning {
  color: var(--color-warning);
}

.alert-banner.success {
  background: var(--color-success-light);
  color: #065F46;
}

[data-theme="dark"] .alert-banner.success {
  color: var(--color-success);
}

.alert-banner.error {
  background: var(--color-error-light);
  color: #991B1B;
}

[data-theme="dark"] .alert-banner.error {
  color: var(--color-error);
}

.alert-banner svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* =========================================
   FAB (Floating Action Button)
   ========================================= */
.fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-area-bottom) + var(--space-4));
  left: var(--space-4);
  width: 56px;
  height: 56px;
  border-radius: var(--radius-xl);
  background: var(--color-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-float);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-spring),
              box-shadow var(--duration-fast) var(--ease-out);
  z-index: var(--z-raised);
}

.fab:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-md);
}

.fab svg {
  width: 24px;
  height: 24px;
}

/* =========================================
   HORIZONTAL SCROLL CONTAINER
   ========================================= */
.h-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-4);
}

.h-scroll::-webkit-scrollbar { display: none; }

/* =========================================
   SETTINGS ROW
   ========================================= */
.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  cursor: pointer;
  background: var(--color-surface);
  transition: background var(--duration-fast) var(--ease-out);
}

.settings-row:active {
  background: var(--color-bg-secondary);
}

.settings-row-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-row-content {
  flex: 1;
  min-width: 0;
}

.settings-row-label {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
}

.settings-row-description {
  font-size: var(--font-size-xs);
  color: var(--color-text-tertiary);
  margin-top: 1px;
}

.settings-row-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.settings-row-action svg {
  width: 16px;
  height: 16px;
}

/* ── Line Badges (shared) ── */
.transfer-line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  color: white;
  font-size: 11px;
  font-weight: var(--font-weight-extrabold);
  line-height: 1;
  flex-shrink: 0;
  vertical-align: middle;
}

.transfer-line-badge.is-icon {
  width: 22px;
  padding: 0;
  font-size: 12px;
}
