/* Apple Pro Design System Tokens */
:root {
  --primary: #0066cc; /* Apple Action Blue */
  --primary-focus: #0071e3;
  --ink: #1d1d1f; /* SF Pro Body ink */
  --ink-muted: #86868b;
  --canvas-bg: #f5f5f7; /* Apple Parchment background */
  --card-bg: rgba(255, 255, 255, 0.85); /* Frosted Glassmorphism card */
  --divider: #d2d2d7;
  --hairline: #e5e5ea;
  
  --font-display: "SF Pro Display", "SF Pro Text", system-ui, -apple-system, sans-serif;
  --font-text: "SF Pro Text", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-text);
  background-color: var(--canvas-bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 16px;
  overflow-x: hidden;
}

/* Glassmorphism Form Wrapper */
.form-container {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  width: 100%;
  max-width: 480px;
  border-radius: 18px;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
  transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.logo-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.kapot-logo {
  max-height: 80px;
  width: auto;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.15);
}

.form-header {
  text-align: center;
  margin-bottom: 24px;
}

.form-header h1 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.15;
  margin-bottom: 6px;
}

.form-header p {
  font-size: 14px;
  color: var(--ink-muted);
}

/* Input Fields */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  border-radius: 10px;
  border: 1px solid var(--divider);
  background-color: rgba(255, 255, 255, 0.7);
  transition: all 0.2s ease;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

/* Custom File Dropzone */
.dropzone {
  border: 1.5px dashed var(--divider);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background-color: rgba(0, 102, 204, 0.03);
}

.dropzone-icon {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--primary);
}

.dropzone-text {
  font-size: 13px;
  color: var(--ink-muted);
}

.file-preview {
  margin-top: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  display: none;
}

/* Segmented Toggle Control */
.segment-control {
  display: flex;
  background-color: rgba(120, 120, 128, 0.12);
  padding: 2px;
  border-radius: 9px;
  margin-bottom: 14px;
}

.segment-btn {
  flex: 1;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--ink);
}

.segment-btn.active {
  background-color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(0, 0, 0, 0.06);
  font-weight: 600;
}

/* Canvas Area for Drawing Signature */
.canvas-wrapper {
  background-color: #ffffff;
  border: 1px solid var(--divider);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}

.signature-canvas {
  display: block;
  width: 100%;
  height: 160px;
  cursor: crosshair;
  touch-action: none;
}

.canvas-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.btn-clear {
  font-size: 12px;
  color: var(--primary);
  border: none;
  background: none;
  cursor: pointer;
  font-weight: 600;
}

.btn-clear:hover {
  text-decoration: underline;
}

/* Submit Action Button */
.btn-submit {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 12px;
  border: none;
  background-color: var(--primary);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 2px 4px rgba(0, 102, 204, 0.1);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.btn-submit:hover {
  background-color: var(--primary-focus);
  transform: translateY(-1px);
}

.btn-submit:active {
  transform: translateY(1px);
}

.btn-submit:disabled {
  background-color: var(--ink-muted);
  cursor: not-allowed;
  transform: none !important;
}

/* Loader Animation */
.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

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

/* Success Layout Overlay */
.success-overlay {
  display: none;
  text-align: center;
  padding: 40px 10px;
}

.success-icon {
  font-size: 56px;
  color: #34c759; /* Apple Green */
  margin-bottom: 16px;
  animation: scaleUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleUp {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.success-text {
  font-size: 14px;
  color: var(--ink-muted);
  line-height: 1.4;
}
