/* Common CSS - Base styles, reset, variables, and utilities */

/* ========================================
   CSS Reset and Normalize
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  /* Prevent horizontal scrolling (Requirement 5.5, 6.4) */
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #ffffff;
  /* Prevent horizontal scrolling (Requirement 5.5, 6.4) */
  overflow-x: hidden;
  width: 100%;
}

img {
  border: 0;
  vertical-align: top;
  max-width: 100%;
}

button {
  border: none;
  outline: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

input {
  border: none;
  outline: none;
  font-family: inherit;
}

/* ========================================
   CSS Variables
   ======================================== */

:root {
  /* Colors */
  --color-primary: #FED331;
  --color-primary-dark: #FBAE25;
  --color-secondary: #EC5E74;
  --color-text-primary: rgba(0, 0, 0, 0.9);
  --color-text-secondary: rgba(0, 0, 0, 0.6);
  --color-text-tertiary: rgba(0, 0, 0, 0.4);
  --color-link: #576B95;
  --color-border: #DADADA;
  --color-border-active: #FED231;
  --color-bg-active: #FFF5E5;
  --color-white: #ffffff;
  --color-mask: rgba(0, 0, 0, 0);
  --color-price-old: rgba(141, 66, 43, 0.63);
  
  /* Spacing (converted from rpx to vw: rpx * 0.1333) */
  --spacing-xs: 1.33vw;    /* 10rpx */
  --spacing-sm: 2.13vw;    /* 16rpx */
  --spacing-md: 3.2vw;     /* 24rpx */
  --spacing-lg: 4.27vw;    /* 32rpx */
  --spacing-xl: 6.4vw;     /* 48rpx */
  --spacing-xxl: 8.53vw;   /* 64rpx */
  
  /* Font sizes (converted from rpx to vw) */
  --font-xs: 3.07vw;       /* 23rpx */
  --font-sm: 3.2vw;        /* 24rpx */
  --font-md: 3.47vw;       /* 26rpx */
  --font-base: 3.73vw;     /* 28rpx */
  --font-lg: 4vw;          /* 30rpx */
  --font-xl: 4.27vw;       /* 32rpx */
  --font-xxl: 4.53vw;      /* 34rpx */
  --font-xxxl: 5.87vw;     /* 44rpx */
  --font-huge: 6.4vw;      /* 48rpx */
  --font-giant: 7.47vw;    /* 56rpx */
  
  /* Border radius */
  --radius-sm: 2.13vw;     /* 16rpx */
  --radius-lg: 13.33vw;    /* 100rpx */
  
  /* Z-index layers */
  --z-mask: 998;
  --z-footer: 999;
  --z-popup: 1000;
  
  /* Transitions */
  --transition-fast: 0.3s ease;
  --transition-normal: 0.5s ease;
  --transition-slow: 0.8s ease;
}

/* ========================================
   Utility Classes
   ======================================== */

/* Display utilities */
.hidden {
  display: none !important;
}

.show {
  display: block !important;
}

.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Text utilities */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-bold {
  font-weight: bold;
}

/* Color utilities */
.text-primary {
  color: var(--color-text-primary);
}

.text-secondary {
  color: var(--color-text-secondary);
}

.text-white {
  color: var(--color-white);
}

/* Position utilities */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

/* Overflow utilities */
.overflow-hidden {
  overflow: hidden;
}

/* Width utilities */
.w-full {
  width: 100%;
}

/* Transition utilities */
.transition {
  transition: var(--transition-normal);
}

.transition-fast {
  transition: var(--transition-fast);
}

.transition-slow {
  transition: var(--transition-slow);
}

/* Safe area utilities (Requirements 5.4, 10.3) */
/* These utilities help with safe area inset handling on devices with notches */
.safe-area-bottom {
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-top {
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top);
}

.safe-area-left {
  padding-left: constant(safe-area-inset-left);
  padding-left: env(safe-area-inset-left);
}

.safe-area-right {
  padding-right: constant(safe-area-inset-right);
  padding-right: env(safe-area-inset-right);
}
