:root {
  --background: #f8fafc; /* Lighter background for a cleaner premium look */
  --foreground: #1e293b;
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --surface: #ffffff;
  --border: #e2e8f0;
  --error: #ef4444;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 10px 30px -5px rgba(0,0,0,0.05), 0 4px 10px -5px rgba(0,0,0,0.02);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0f172a;
    --foreground: #f8fafc;
    --primary: #38bdf8;
    --primary-hover: #7dd3fc;
    --surface: #1e293b;
    --border: #334155;
    --shadow-md: 0 10px 30px -5px rgba(0,0,0,0.3);
  }
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-geist-sans), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
  
  /* Native app feel behaviors */
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none; /* Prevent accidental text selection */
  -webkit-user-select: none;
  
  /* Support for iOS safe areas */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Re-enable text selection on inputs and textareas */
input, textarea, [contenteditable="true"] {
  user-select: auto;
  -webkit-user-select: auto;
}

*, *::before, *::after {
  box-sizing: inherit;
}

/* Utilities */
.container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1rem;
}

/* iOS Style Grouped List (Table View) */
.ios-list {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.ios-list-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px; /* Minimum iOS touch target size */
}

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

.ios-list-item-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.ios-list-item-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--foreground);
}

.ios-list-item-subtitle {
  font-size: 0.9rem;
  color: var(--foreground);
  opacity: 0.7;
}

/* Native Segmented Control */
.segmented-control {
  display: flex;
  background: var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  margin-bottom: 1.5rem;
}

.segmented-control-btn {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.segmented-control-btn.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  width: 100%;
}

/* New Premium Auth Styles */
.auth-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--background);
  position: relative;
  overflow: hidden;
  align-items: center;
  justify-content: center;
}

.auth-wrapper {
  position: relative;
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  flex: 1;
  z-index: 10;
  padding: 2rem 1.5rem;
  justify-content: center;
}

@media (min-width: 768px) {
  .auth-wrapper {
    flex: none;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 3rem 2.5rem;
    margin: 2rem;
    border: 1px solid var(--border);
  }
}

/* Safe area padding for bottom buttons */
.auth-form-bottom {
  margin-top: auto;
  padding-bottom: calc(max(2rem, env(safe-area-inset-bottom)) + 1rem);
}

@media (min-width: 768px) {
  .auth-form-bottom {
    margin-top: 2rem;
    padding-bottom: 0;
  }
}

.auth-card {
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .auth-card {
    flex: none;
  }
}

.auth-header {
  margin-top: 2rem;
  margin-bottom: 2.5rem;
  text-align: left;
}

@media (min-width: 768px) {
  .auth-header {
    margin-top: 0;
  }
}

.auth-logo {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--foreground);
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  color: var(--foreground);
  opacity: 0.6;
  font-size: 1.1rem;
  margin: 0;
}

.auth-tabs {
  display: flex;
  background: var(--border);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 2.5rem;
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--foreground);
  opacity: 0.6;
  border-radius: calc(var(--radius-md) - 3px);
  cursor: pointer;
  transition: var(--transition);
  min-height: 44px; /* Touch target */
}

.auth-tab.active {
  background: var(--surface);
  opacity: 1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  color: var(--foreground);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  flex: 1;
}

.input-wrapper {
  position: relative;
}

.input {
  width: 100%;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--foreground);
  font-size: 1.05rem;
  outline: none;
  transition: var(--transition);
  min-height: 48px; /* Bigger touch target */
}

.input::placeholder {
  color: var(--foreground);
  opacity: 0.4;
}

.input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

.btn {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: center;
  align-items: center;
}

.auth-submit-btn {
  width: 100%;
  margin-top: 1rem;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.btn:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

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

.error-text {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: -0.5rem;
  text-align: center;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.75rem;
  border-radius: var(--radius-md);
}

/* Spinner for loading state */
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
}

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

/* Decorative background elements */
.auth-decoration {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  z-index: 1;
  opacity: 0.6;
}

.auth-decoration-1 {
  width: 300px;
  height: 300px;
  background: var(--primary);
  top: -100px;
  right: -150px;
  animation: float 10s ease-in-out infinite alternate;
}

.auth-decoration-2 {
  width: 400px;
  height: 400px;
  background: #38bdf8;
  bottom: -150px;
  left: -200px;
  animation: float 12s ease-in-out infinite alternate-reverse;
}

@keyframes float {
  0% { transform: translate(0, 0); }
  100% { transform: translate(30px, 50px); }
}

.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 600;
}
