@import url("https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;500;700&family=Public+Sans:wght@400;500;600;700&display=swap");
@import url("./tokens.css");

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

body {
  font-family:
    "Public Sans",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--ui-bg);
  color: var(--ui-text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.header {
  text-align: center;
  margin-bottom: 3rem;
}

.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.header .subtitle {
  color: var(--ui-text-muted);
  font-size: 1.125rem;
}

.card {
  background: var(--ui-bg-elevated);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--ui-border);
  padding: 2rem;
  max-width: 480px;
  margin: 0 auto;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-align: center;
}

.card-description {
  color: var(--ui-text-muted);
  text-align: center;
  margin-bottom: 2rem;
}

.input-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  background: white;
  transition: all 0.2s;
  font-family: inherit;
}

.input:focus {
  outline: none;
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 3px rgb(221 112 2 / 0.1);
}

.input::placeholder {
  color: var(--ui-text-muted);
}

.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-right: 3rem;
}

.input-icon-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-tan-100);
  border: none;
  border-radius: var(--radius);
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.input-icon-btn:hover {
  background: var(--color-tan-200);
}

.input-icon-btn:active {
  transform: translateY(-50%) scale(0.95);
}

.input-hint {
  font-size: 0.875rem;
  color: var(--ui-text-muted);
  margin-top: 0.5rem;
  text-align: right;
}

.input-hint-valid {
  color: var(--ui-success);
  font-weight: 500;
}

.input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.input-group .input {
  flex: 1;
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  gap: 0.5rem;
}

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

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

.btn-primary:hover:not(:disabled) {
  background: var(--ui-primary-hover);
}

.btn-secondary {
  background: var(--ui-bg-elevated);
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--ui-surface);
  border-color: var(--ui-border-hover);
}

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

.btn-success:hover:not(:disabled) {
  background: #15803d;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-full {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
}

.btn-group .btn {
  flex: 1;
}

.divider {
  display: flex;
  align-items: center;
  margin: 1.5rem 0;
  color: var(--ui-text-muted);
  font-size: 0.875rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ui-border);
}

.divider span {
  padding: 0 1rem;
}

.status {
  padding: 1rem;
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-top: 1.5rem;
}

.status-info {
  background: var(--ui-bg-elevated);
  color: var(--ui-text);
  border-left: 4px solid var(--ui-primary);
}

.status-success {
  background: #f0fdf4;
  border-left: 4px solid var(--ui-success);
}

.status-error {
  background: #fef2f2;
  border-left: 4px solid var(--ui-error);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.info-box {
  background: var(--color-yellow-50);
  border: 1px solid var(--color-yellow-200);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--ui-text-muted);
}

.logs-section {
  margin-top: 1rem;
}

.logs-section .status {
  margin-top: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

@supports (padding: max(0px)) {
  .header {
    padding-top: max(1rem, env(safe-area-inset-top));
  }

  .toast-container {
    top: max(1.5rem, env(safe-area-inset-top));
    right: max(1.5rem, env(safe-area-inset-right));
  }

  .bottom-sheet {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .page-enter-active,
  .page-leave-active {
    transition: none !important;
  }

  .list-enter-active,
  .list-leave-active {
    transition: none !important;
  }

  .call-spinner {
    animation-duration: 0.8s !important;
    animation-iteration-count: infinite !important;
  }
}

.swipe-backdrop {
  position: fixed;
  inset: 0;
  background: black;
  z-index: -1;
  transition: opacity 0.3s ease;
}

@media (hover: none) {
  .btn:hover:not(:disabled),
  .btn-secondary:hover:not(:disabled) {
    transform: none;
    filter: none;
  }

  .btn:active:not(:disabled),
  .input-icon-btn:active {
    transform: scale(0.98);
    opacity: 0.8;
  }

  .btn-primary:active:not(:disabled) {
    background: var(--ui-primary-hover);
  }
}

@media (hover: hover) {
  .btn:hover:not(:disabled) {
    filter: brightness(1.1);
  }
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 1.75rem;
  }

  .btn-group {
    flex-direction: column;
  }
}
