/* Reset and Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f5f5f7;
  --color-bg-elevated: #ffffff;
  --color-border: #d1d1d6;
  --color-text: #1d1d1f;
  --color-text-muted: #6e6e73;
  --color-accent: #b83a2f;
  --color-accent-hover: #9a2f25;
  --color-error: #ef4444;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Tests Link - Top Right */
.tests-link {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  z-index: 1000;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  color: white;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 4px;
  transition: background 0.2s;
}

.tests-link:hover {
  background: var(--color-accent-hover);
}

/* Background Elements - Simplified for light theme */
.page-wrapper {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-gradient,
.bg-grid,
.bg-noise {
  display: none;
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

/* Header */
.header {
  margin-bottom: 3rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--color-text);
}

.logo-icon {
  color: var(--color-accent);
  font-size: 1.25rem;
}

/* Hero Section */
.hero {
  margin-bottom: 3rem;
}

.badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--color-accent);
  border-radius: 2rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: white;
  margin-bottom: 1.5rem;
}

.title {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--color-text);
}

.title-line {
  display: block;
}

.title-accent {
  color: var(--color-text);
}

.subtitle {
  font-size: 1.125rem;
  color: var(--color-text);
  max-width: 700px;
  line-height: 1.7;
}

/* Form Container */
.form-container {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

/* Form Grid - 2 columns for first 4 fields */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Form */
.form-group {
  margin-bottom: 0;
}

.form-label {
  display: none;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 1.25rem 1.5rem;
  background: white;
  border: 1px solid var(--color-border);
  border-radius: 0;
  font-size: 1.125rem;
  color: var(--color-text);
  font-family: var(--font-sans);
  transition: border-color 0.2s;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text);
  opacity: 1;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-text);
}

.form-input.error,
.form-textarea.error {
  border-color: var(--color-error);
}

.form-textarea {
  resize: vertical;
  min-height: 200px;
  font-family: var(--font-sans);
}

.form-error {
  display: block;
  font-size: 0.875rem;
  color: var(--color-error);
  margin-top: 0.5rem;
  min-height: 1.25rem;
}

/* Submit Button */
.submit-button {
  padding: 1.25rem 2.5rem;
  background: var(--color-accent);
  border: none;
  border-radius: 0;
  font-size: 1.125rem;
  font-weight: 400;
  font-style: italic;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--font-sans);
  position: relative;
  margin-top: 1.5rem;
}

.submit-button:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.submit-button:active:not(:disabled) {
  transform: translateY(1px);
}

.submit-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.submit-button.loading .button-text {
  opacity: 0;
}

.submit-button.loading .button-loading {
  display: flex;
}

.button-loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  color: white;
}

/* Success Message */
.success-message {
  text-align: center;
  padding: 3rem 2rem;
  background: white;
  border: 1px solid var(--color-border);
}

.success-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  background: rgba(16, 185, 129, 0.1);
  border: 2px solid #10b981;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-icon svg {
  width: 2rem;
  height: 2rem;
  color: #10b981;
}

.success-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.success-text {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.success-id {
  font-size: 0.75rem;
  font-family: monospace;
  color: var(--color-text-muted);
  background: var(--color-bg);
  padding: 0.5rem 1rem;
  border-radius: 0.25rem;
  display: inline-block;
  word-break: break-all;
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 3rem 2rem;
  background: white;
  border: 1px solid var(--color-border);
}

.error-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.5rem;
  background: rgba(239, 68, 68, 0.1);
  border: 2px solid var(--color-error);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-error);
}

.error-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.error-text {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin-bottom: 1.5rem;
}

.retry-button {
  padding: 0.875rem 2rem;
  background: var(--color-accent);
  border: none;
  border-radius: 0;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: background 0.2s;
  font-family: var(--font-sans);
}

.retry-button:hover {
  background: var(--color-accent-hover);
}

/* Footer */
.footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.footer-links {
  margin-top: 0.5rem;
}

.footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--color-accent);
}

.divider {
  margin: 0 0.5rem;
  opacity: 0.5;
}

/* Stats Bar - Fixed at bottom - Terminal style */
.stats-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #e8e8eb;
  color: #000;
  border-top: 1px solid var(--color-border);
  height: 33vh;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  font-family: 'Courier New', Courier, monospace;
  overflow: hidden;
}

.stats-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

.stats-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
}

.stats-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #000;
}

.stats-count {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-accent);
  background: white;
  padding: 0.125rem 0.5rem;
  border-radius: 2px;
  min-width: 2rem;
  text-align: center;
  border: 1px solid var(--color-border);
}

.stats-recent {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.75rem;
  min-height: 0;
}

.stats-entries {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding-right: 0.5rem;
  min-height: 0;
}

.stats-entries::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.stats-entries::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

.stats-entries::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.7rem;
  background: white;
  border: 1px solid var(--color-border);
}

.stats-table thead {
  position: sticky;
  top: 0;
  background: #d8d8db;
  z-index: 10;
}

.stats-table th {
  text-align: left;
  padding: 0.375rem 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.65rem;
  border-bottom: 2px solid var(--color-border);
  color: #000;
  white-space: nowrap;
}

.stats-table td {
  padding: 0.375rem 0.5rem;
  border-bottom: 1px solid var(--color-border);
  color: #000;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.stats-table tbody tr:hover {
  background: #f5f5f7;
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-loading {
  color: #000;
  font-style: italic;
  font-size: 0.7rem;
}

/* Add padding to body to prevent content from being hidden behind stats bar */
body {
  padding-bottom: 33vh;
}

/* Responsive */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .title {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .container {
    padding: 2rem 1.5rem;
  }

  .stats-container {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .stats-recent {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .stats-entries {
    width: 100%;
  }
}
