/* Apple-inspired Design System */
:root {
  --primary-blue: #007AFF;
  --secondary-blue: #5AC8FA;
  --success-green: #34C759;
  --warning-orange: #FF9500;
  --error-red: #FF3B30;
  --gray-50: #F9F9F9;
  --gray-100: #F2F2F7;
  --gray-200: #E5E5EA;
  --gray-300: #D1D1D6;
  --gray-400: #C7C7CC;
  --gray-500: #AEAEB2;
  --gray-600: #8E8E93;
  --gray-700: #636366;
  --gray-800: #48484A;
  --gray-900: #1C1C1E;
  --white: #FFFFFF;
  --black: #000000;
  
  --border-radius: 12px;
  --border-radius-large: 16px;
  --shadow-small: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--gray-900);
  background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Header */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 0.5rem 0;
  color: var(--gray-900);
  text-align: center;
}

.subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
  text-align: center;
  margin-bottom: 3rem;
  font-weight: 400;
}

/* Form Container */
.form-container {
  background: var(--white);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow-medium);
  margin-bottom: 2rem;
}

/* Form Groups */
.form-group {
  margin-bottom: 2rem;
}

.form-group:last-child {
  margin-bottom: 0;
}

label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
}

/* File Input Styling */
.file-input-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.file-input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.file-input-label {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 4rem;
  padding: 1.5rem;
  background: var(--gray-100);
  border: 2px dashed var(--gray-300);
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1rem;
  color: var(--gray-600);
  text-align: center;
  line-height: 1.4;
}

.file-input-label:hover {
  background: var(--gray-200);
  border-color: var(--primary-blue);
}

.file-input-label.has-file {
  background: rgba(0, 122, 255, 0.1);
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  padding: 1rem 1.5rem;
  flex-direction: column;
  gap: 0.5rem;
}

.file-icon {
  width: 24px;
  height: 24px;
  margin-right: 0.75rem;
  opacity: 0.6;
}

/* Text Input */
.text-input {
  width: 100%;
  padding: 1.25rem 1rem;
  font-size: 1.125rem;
  border: 2px solid var(--gray-200);
  border-radius: var(--border-radius);
  background: var(--white);
  color: var(--gray-900);
  transition: all 0.2s ease;
  font-family: inherit;
}

.text-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.text-input::placeholder {
  color: var(--gray-500);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  padding: 1.25rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--white);
  background: var(--primary-blue);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  letter-spacing: -0.01em;
  box-shadow: var(--shadow-small);
}

.btn-primary:hover {
  background: #0056CC;
  transform: translateY(-1px);
  box-shadow: var(--shadow-medium);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-small);
}

.btn-primary:disabled {
  background: var(--gray-300);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Progress Container */
.progress-container {
  background: var(--white);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow-medium);
  margin-bottom: 2rem;
  display: none;
}

.progress-container.active {
  display: block;
}

.progress-item {
  margin-bottom: 1rem;
}

.progress-item:last-child {
  margin-bottom: 0;
}

.overall-progress {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
}

.page-progress {
  font-size: 1rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

.time-estimate {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-style: italic;
}

/* Results Container */
.results-container {
  background: var(--white);
  border-radius: var(--border-radius-large);
  padding: 2rem;
  box-shadow: var(--shadow-medium);
  display: none;
}

.results-container.active {
  display: block;
}

.results-header {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

.result-item {
  padding: 1.5rem;
  background: var(--gray-50);
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary-blue);
  position: relative;
}

.result-item:last-child {
  margin-bottom: 0;
}

.download-page-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-blue);
  background: var(--white);
  border: 2px solid var(--primary-blue);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.download-page-btn:hover {
  background: var(--primary-blue);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-small);
}

.download-page-btn:active {
  transform: translateY(0);
}

.download-page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.download-icon {
  width: 16px;
  height: 16px;
}

.result-page {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-blue);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-snippet {
  font-size: 1rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.result-snippet strong {
  background: rgba(255, 204, 0, 0.3);
  padding: 0.125rem 0.25rem;
  border-radius: 4px;
  color: var(--gray-900);
  font-weight: 600;
}

.no-results {
  text-align: center;
  color: var(--gray-600);
  font-size: 1.125rem;
  padding: 2rem;
}

/* Loading Animation */
.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-top: 2px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
  margin-right: 0.5rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 640px) {
  .container {
    padding: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .form-container,
  .progress-container,
  .results-container {
    padding: 1.5rem;
  }
  
  .btn-primary {
    padding: 1rem 1.5rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --gray-50: #1C1C1E;
    --gray-100: #2C2C2E;
    --gray-200: #3A3A3C;
    --gray-300: #48484A;
    --gray-400: #636366;
    --gray-500: #8E8E93;
    --gray-600: #AEAEB2;
    --gray-700: #C7C7CC;
    --gray-800: #D1D1D6;
    --gray-900: #F2F2F7;
    --white: #000000;
    --black: #FFFFFF;
  }
  
  body {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
  }
} 