/* Base styles and CSS reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: #333;
  background: #f5f5f5;
  overflow-x: hidden;
}

/* Focus styles */
*:focus {
  outline: 2px solid #007aff;
  outline-offset: 2px;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

p {
  margin-bottom: 1rem;
}

.subtitle {
  color: #666;
  font-size: 1rem;
  margin-bottom: 2rem;
}

/* Form elements */
input,
select,
button {
  font-family: inherit;
  font-size: 1rem;
}

input[type='number'],
input[type='text'],
select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  background: white;
  transition: border-color 0.2s ease;
}

input[type='number']:focus,
input[type='text']:focus,
select:focus {
  border-color: #007aff;
}

input.error,
select.error {
  border-color: #ff3b30;
  background-color: #fff5f5;
}

input.error:focus,
select.error:focus {
  border-color: #ff3b30;
}

/* Buttons */
button {
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: #007aff;
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  min-height: 48px;
}

.btn-primary:hover {
  background: #0056cc;
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background: #666;
  color: white;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  width: 100%;
  min-height: 48px;
}

.btn-secondary:hover {
  background: #555;
}

.btn-control {
  background: #f0f0f0;
  border: 2px solid #ddd;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  margin: 0 0.25rem;
}

.btn-control:hover {
  background: #e0e0e0;
}

.btn-control:active {
  transform: scale(0.95);
}

/* Loading spinner */
.loading {
  text-align: center;
  padding: 2rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007aff;
  border-radius: 50%;
  margin: 0 auto 1rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-error {
  color: #ff3b30;
}

.text-success {
  color: #34c759;
}

/* Mobile-first responsive design */
@media (min-width: 768px) {
  .container {
    max-width: 600px;
    margin: 0 auto;
  }

  h1 {
    font-size: 2.5rem;
  }

  .btn-primary,
  .btn-secondary {
    width: auto;
    min-width: 200px;
  }
}
