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

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.5;
  min-height: 100vh;
}

/* Container */
.container {
  max-width: 480px;
  margin: 0 auto;
  background-color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  padding: 24px 20px;
  text-align: center;
  border-bottom: 1px solid #eee;
}

.logo {
  max-width: 180px;
  height: auto;
  margin-bottom: 12px;
}

.tagline {
  font-size: 0.875rem;
  color: #666;
  letter-spacing: 0.5px;
}

/* Main Content */
main {
  flex: 1;
  padding: 24px 20px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 28px;
}

/* Form Sections */
.form-section {
  margin-bottom: 24px;
}

.form-section label {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: #444;
  margin-bottom: 10px;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: #4a9c5d;
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 10px;
  flex-shrink: 0;
}

/* Form Inputs */
select,
input[type="number"],
input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background-color: #fff;
  color: #333;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

select:focus,
input[type="number"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: #4a9c5d;
  box-shadow: 0 0 0 3px rgba(74, 156, 93, 0.15);
}

/* Amount Input */
.amount-input-wrapper {
  position: relative;
}

.amount-input-wrapper input {
  padding-right: 40px;
}

.currency {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: #666;
  font-weight: 500;
}

.amount-words {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #666;
  font-style: italic;
  min-height: 1.3em;
}

/* Signature Area */
.signature-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#signatureCanvas {
  width: 100%;
  height: 200px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  background-color: #fafafa;
  touch-action: none;
  cursor: crosshair;
}

#signatureCanvas.active {
  border-color: #4a9c5d;
}

/* Buttons */
.btn-primary {
  width: 100%;
  padding: 16px 24px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: #4a9c5d;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
  background-color: #3d8a4e;
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-secondary {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #666;
  background-color: #f0f0f0;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary:hover {
  background-color: #e0e0e0;
}

/* Loading State */
.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Form Actions */
.form-actions {
  margin-top: 32px;
}

/* Status Message */
.status-message {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
}

.status-message.success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.status-message.error {
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

.status-message a {
  color: inherit;
  font-weight: 600;
}

/* Footer */
footer {
  padding: 20px;
  border-top: 1px solid #eee;
}

.trust-indicators {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
  .container {
    max-width: 100%;
  }

  header {
    padding: 20px 16px;
  }

  main {
    padding: 20px 16px;
  }

  footer {
    padding: 16px;
  }

  select,
  input[type="number"],
  input[type="date"] {
    font-size: 16px; /* Prevents zoom on iOS */
  }
}
