/* OneUI Design System - Mobile Adapted */

@import url('https://unpkg.com/lucide-static@latest/font/lucide.css');

:root {
  /* Colors */
  --primary: #1259C3;
  --primary-light: #4A8FE7;
  --primary-dark: #0D4494;
  --secondary: #FF6F00;
  --success: #4CAF50;
  --warning: #FF9800;
  --error: #F44336;
  --background: #F7F7F7;
  --surface: #FFFFFF;
  --text-primary: #1C1C1E;
  --text-secondary: #8E8E93;
  --text-tertiary: #AEAEB2;
  --divider: #E5E5EA;

  /* Spacing */
  --page-padding: 20px;
  --card-padding: 16px;
  --item-spacing: 12px;
  --section-spacing: 24px;
  --safe-area-bottom: env(safe-area-inset-bottom, 20px);

  /* Border Radius */
  --radius-card: 24px;
  --radius-button: 12px;
  --radius-input: 12px;
  --radius-chip: 16px;
  --radius-sheet: 24px;

  /* Typography */
  --font-h1: 28px;
  --font-h2: 20px;
  --font-body: 16px;
  --font-caption: 14px;
  --font-small: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  font-size: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overscroll-behavior: none;
}

/* Mobile Full-Screen Container (replaces phone-frame) */
.phone-frame {
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--background);
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  position: relative;
  border: none;
}

.phone-screen {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 20px));
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-area-bottom));
  border-top: 1px solid var(--divider);
  flex-shrink: 0;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  position: relative;
}

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

.nav-item .badge {
  position: absolute;
  top: -4px;
  right: -8px;
  background: var(--error);
  color: white;
  font-size: 10px;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Status Bar - Hidden on real mobile */
.status-bar {
  display: none;
}

/* Navigation Bar */
.nav-bar {
  height: 56px;
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 var(--page-padding);
  border-bottom: 1px solid var(--divider);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-back {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s;
}

.nav-back:hover,
.nav-back:active {
  background: var(--background);
}

.nav-title {
  flex: 1;
  text-align: center;
  font-size: var(--font-body);
  font-weight: 600;
}

/* OneUI Header */
.oneui-header {
  background: var(--surface);
  padding: 60px var(--page-padding) 30px;
  text-align: center;
}

.oneui-header h1 {
  font-size: var(--font-h1);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.oneui-header .subtitle {
  font-size: var(--font-caption);
  color: var(--text-secondary);
}

/* Page Content */
.page-content {
  padding: var(--page-padding);
  padding-bottom: calc(var(--safe-area-bottom) + 80px);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: var(--card-padding);
  margin-bottom: var(--item-spacing);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--item-spacing);
}

.card-title {
  font-size: var(--font-body);
  font-weight: 600;
}

/* Stats Card */
.stats-card {
  display: flex;
  justify-content: space-around;
  text-align: center;
  padding: 24px var(--card-padding);
}

.stat-item {
  flex: 1;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-value.primary {
  color: var(--primary);
}

.stat-value.warning {
  color: var(--warning);
}

.stat-label {
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border-radius: var(--radius-button);
  font-size: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  width: 100%;
}

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

.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--background);
  color: var(--text-primary);
  border: 1px solid var(--divider);
}

.btn-secondary:active {
  background: var(--divider);
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

/* Menu Items */
.menu-item {
  display: flex;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--divider);
  cursor: pointer;
  transition: background 0.2s;
}

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

.menu-item:active {
  background: var(--background);
  margin: 0 -16px;
  padding: 16px;
}

.menu-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 20px;
}

.menu-icon.blue {
  background: rgba(18, 89, 195, 0.1);
}

.menu-icon.orange {
  background: rgba(255, 111, 0, 0.1);
}

.menu-icon.green {
  background: rgba(76, 175, 80, 0.1);
}

.menu-icon.red {
  background: rgba(244, 67, 54, 0.1);
}

.menu-content {
  flex: 1;
}

.menu-title {
  font-size: var(--font-body);
  font-weight: 500;
}

.menu-subtitle {
  font-size: var(--font-small);
  color: var(--text-secondary);
  margin-top: 2px;
}

.menu-arrow {
  color: var(--text-tertiary);
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--divider);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Progress Steps */
.progress-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--divider);
  margin-bottom: 8px;
  position: relative;
}

.step-dot.active {
  background: var(--primary);
}

.step-dot.completed {
  background: var(--success);
}

.step-line {
  position: absolute;
  top: 50%;
  left: 100%;
  width: calc(100% - 12px);
  height: 2px;
  background: var(--divider);
  transform: translateY(-50%);
}

.step-dot.completed .step-line {
  background: var(--success);
}

.step-label {
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* Friend Card */
.friend-card {
  padding: var(--card-padding);
}

.friend-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.friend-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 12px;
}

.friend-name {
  font-weight: 600;
}

.friend-status {
  font-size: var(--font-small);
  margin-top: 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

.friend-status.success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--success);
}

.friend-status.warning {
  background: rgba(255, 152, 0, 0.1);
  color: var(--warning);
}

.friend-status.pending {
  background: var(--background);
  color: var(--text-secondary);
}

/* Amount Display */
.amount-display {
  text-align: center;
  padding: 32px 0;
}

.amount-value {
  font-size: 48px;
  font-weight: 700;
  color: var(--primary);
}

.amount-value::before {
  content: '¥';
  font-size: 24px;
  vertical-align: top;
  margin-right: 4px;
}

.amount-label {
  font-size: var(--font-caption);
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Invite Code Box */
.invite-code-box {
  background: var(--background);
  border-radius: var(--radius-input);
  padding: 16px;
  text-align: center;
  margin: 16px 0;
}

.invite-code {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--primary);
}

.invite-code-label {
  font-size: var(--font-small);
  color: var(--text-secondary);
  margin-top: 8px;
}

/* Share Buttons */
.share-buttons {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 24px 0;
}

.share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}

.share-btn-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 8px;
}

.share-btn-icon.wechat {
  background: #07C160;
  color: white;
}

.share-btn-icon.moments {
  background: #576B95;
  color: white;
}

.share-btn-icon.copy {
  background: var(--background);
  color: var(--text-primary);
}

.share-btn-label {
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* Rules List */
.rules-list {
  padding: 0;
  list-style: none;
}

.rules-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--divider);
  font-size: var(--font-caption);
  color: var(--text-secondary);
}

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

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

.input-label {
  font-size: var(--font-caption);
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.input {
  width: 100%;
  height: 52px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-input);
  padding: 0 16px;
  font-size: var(--font-body);
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-amount {
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  height: 72px;
}

/* Bottom Fixed Button */
.bottom-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--page-padding);
  padding-bottom: calc(var(--page-padding) + var(--safe-area-bottom));
  background: linear-gradient(transparent, var(--surface) 20%);
  z-index: 90;
}

/* FAB */
.fab {
  position: fixed;
  bottom: calc(100px + var(--safe-area-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--secondary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(255, 111, 0, 0.3);
  cursor: pointer;
  transition: transform 0.2s;
  z-index: 80;
}

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

/* Badge */
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--error);
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Tip Box */
.tip-box {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 152, 0, 0.1);
  border-radius: var(--radius-input);
  margin: 16px 0;
}

.tip-icon {
  margin-right: 12px;
  font-size: 20px;
}

.tip-text {
  font-size: var(--font-caption);
  color: var(--warning);
}

/* Order Card */
.order-card {
  margin-bottom: var(--item-spacing);
}

.order-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.order-id {
  font-size: var(--font-caption);
  color: var(--text-secondary);
}

.order-progress {
  margin: 12px 0;
}

.order-stats {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-small);
  color: var(--text-secondary);
}

/* Bottom Sheet */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 100;
}

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

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 101;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet.active {
  transform: translateY(0);
}

.bottom-sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--divider);
  border-radius: 2px;
  margin: 12px auto;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.3s ease forwards;
}

/* Utility */
.text-center {
  text-align: center;
}

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

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

.text-warning {
  color: var(--warning);
}

.text-error {
  color: var(--error);
}

.text-secondary {
  color: var(--text-secondary);
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}