@import url("variables.css");

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

.page--fade-in {
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-md);
}

.header__title {
  font-size: 17px;
  font-weight: 600;
}

.header__back {
  position: absolute;
  left: var(--space-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--color-primary-light);
  cursor: pointer;
  color: var(--color-primary-dark);
  border-radius: var(--radius-full);
  font-size: 18px;
  transition: background 0.15s, transform 0.15s;
}

.header__back:active {
  background: var(--color-primary-light);
  transform: scale(0.95);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 var(--space-lg);
  border: none;
  border-radius: var(--radius-xl);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s, background 0.15s;
}

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

.btn--primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

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

.btn--block {
  width: 100%;
}

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

.btn--shine::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transform: skewX(-20deg);
  animation: btnShine 3s ease-in-out infinite;
}

@keyframes btnShine {
  0%, 100% { left: -100%; }
  50% { left: 150%; }
}

.footer-cta {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  padding: var(--space-md) 20px;
  padding-bottom: calc(var(--space-md) + var(--safe-bottom));
  background: linear-gradient(to top, rgba(255, 255, 255, 0.98) 70%, transparent);
  z-index: 50;
}

.footer-cta--glass {
  background: linear-gradient(to top, rgba(240, 245, 242, 0.95) 60%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  z-index: 9999;
  pointer-events: none;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
  }
}

.access-denied {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  text-align: center;
}

.access-denied__icon {
  font-size: 64px;
  margin-bottom: var(--space-lg);
}

.access-denied__title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.access-denied__desc {
  color: var(--color-text-secondary);
  font-size: 14px;
}

.required {
  color: var(--color-danger);
  margin-left: 2px;
}

.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

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

.picker-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 201;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: var(--safe-bottom);
}

.picker-overlay.is-open .picker-sheet {
  transform: translateY(0);
}

.picker-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-border);
}

.picker-sheet__title {
  font-weight: 600;
}

.picker-sheet__cancel,
.picker-sheet__confirm {
  border: none;
  background: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
}

.picker-sheet__cancel {
  color: var(--color-text-muted);
}

.picker-sheet__confirm {
  color: var(--color-primary);
  font-weight: 600;
}

.picker-sheet__list {
  max-height: 50vh;
  overflow-y: auto;
}

.picker-item {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.15s;
}

.picker-item:active,
.picker-item.is-selected {
  background: var(--color-primary-light);
  color: var(--color-primary);
}
