/* =============================================================================
   lease-upload.css — AgreeTemplate V2.0 Lease Review Phase LR1
   Upload form for AI-powered lease risk analysis.
   Compatible with WordPress / Elementor page layouts.
   ============================================================================= */

/* ── Design Tokens ───────────────────────────────────────────────────────────
   These values match the AgreeTemplate brand palette used across the product.
   ─────────────────────────────────────────────────────────────────────────── */

/* --lru-primary:      #2563eb  */
/* --lru-primary-dark: #1d4ed8  */
/* --lru-success:      #059669  */
/* --lru-danger:       #dc2626  */
/* --lru-warning:      #d97706  */
/* --lru-bg:           #f8fafc  */
/* --lru-card:         #ffffff  */
/* --lru-text:         #1e293b  */
/* --lru-text-muted:   #64748b  */
/* --lru-border:       #e2e8f0  */

/* ── Mounting Container ───────────────────────────────────────────────────── */

#lr-upload-form,
.lr-upload-form {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: #1e293b;
  line-height: 1.55;
  background: #f8fafc;
  max-width: 1140px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ── Form Card ────────────────────────────────────────────────────────────── */

.lru-form-card {
  max-width: 640px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 36px 40px 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.07);
}

.lru-form-title {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 8px;
  line-height: 1.2;
}

.lru-form-subtitle {
  font-size: 15px;
  color: #64748b;
  margin: 0 0 28px;
}

/* ── Drop Zone ────────────────────────────────────────────────────────────── */

.lru-drop-zone {
  border: 2px dashed #cbd5e1;
  border-radius: 10px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  background: #f8fafc;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  outline: none;
  position: relative;
}

.lru-drop-zone:hover,
.lru-drop-zone:focus-visible {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lru-drop-zone.lru-drag-over {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* File already chosen — de-emphasise the drop zone */
.lru-drop-zone.lru-has-file {
  border-color: #059669;
  background: #f0fdf4;
  cursor: default;
  pointer-events: none;
}

/* Drop zone disabled because textarea has content */
.lru-drop-zone.lru-input-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Error state on drop zone */
.lru-drop-zone.lru-input-error {
  border-color: #dc2626;
  background: #fef2f2;
}

.lru-drop-icon {
  color: #94a3b8;
  transition: color 0.2s ease;
  line-height: 0;
}

.lru-drop-zone:hover .lru-drop-icon,
.lru-drop-zone:focus-visible .lru-drop-icon,
.lru-drop-zone.lru-drag-over .lru-drop-icon {
  color: #2563eb;
}

.lru-drop-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.lru-drop-primary {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
}

.lru-drop-secondary {
  font-size: 14px;
  color: #64748b;
}

.lru-drop-link {
  color: #2563eb;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
  pointer-events: all;
}

.lru-drop-link:hover { color: #1d4ed8; }

.lru-drop-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ── File Selected Display ────────────────────────────────────────────────── */

.lru-file-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 14px;
  color: #065f46;
}

.lru-file-icon {
  flex-shrink: 0;
  color: #059669;
}

.lru-file-name {
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lru-file-size {
  color: #6b7280;
  font-size: 12px;
  flex-shrink: 0;
}

.lru-file-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: #6b7280;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}

.lru-file-remove:hover {
  color: #dc2626;
  background: #fee2e2;
}

/* ── OR Divider ───────────────────────────────────────────────────────────── */

.lru-or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lru-or-divider::before,
.lru-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

/* ── Form Fields ──────────────────────────────────────────────────────────── */

.lru-field {
  margin-bottom: 20px;
}

.lru-field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.lru-required {
  color: #ef4444;
  margin-left: 2px;
}

/* ── Textarea ─────────────────────────────────────────────────────────────── */

.lru-textarea {
  width: 100%;
  min-height: 200px;
  max-height: 400px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Courier New', Courier, 'Lucida Console', monospace;
  color: #1e293b;
  background: #f9fafb;
  line-height: 1.6;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.lru-textarea:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lru-textarea.lru-input-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.lru-textarea.lru-input-disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  resize: none;
}

/* ── Select & Text Input ──────────────────────────────────────────────────── */

.lru-select,
.lru-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  color: #1e293b;
  background: #f9fafb;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.lru-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}

.lru-select:focus,
.lru-input:focus {
  outline: none;
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lru-select.lru-input-error,
.lru-input.lru-input-error {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ── Field Helpers ────────────────────────────────────────────────────────── */

.lru-field-hint {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 5px;
}

.lru-field-error {
  font-size: 12px;
  color: #dc2626;
  margin-top: 5px;
  display: none;
}

.lru-field-error.lru-error-visible { display: block; }

/* ── Submit Button ────────────────────────────────────────────────────────── */

.lru-submit-btn {
  display: block;
  width: 100%;
  height: 52px;
  margin-top: 28px;
  padding: 0 24px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  -webkit-appearance: none;
  line-height: 1;
}

.lru-submit-btn:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
  transform: translateY(-1px);
}

.lru-submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.lru-submit-btn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Inline submit-level error (below button) */
.lru-submit-error {
  margin-top: 12px;
  font-size: 13px;
  color: #dc2626;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  display: none;
}

/* ── Trust Badges ─────────────────────────────────────────────────────────── */

.lru-badges {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.lru-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #f1f5f9;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: #475569;
  white-space: nowrap;
}

.lru-badge svg { flex-shrink: 0; color: #64748b; }

/* ── Disclaimer ───────────────────────────────────────────────────────────── */

.lru-disclaimer {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin: 20px 0 0;
  line-height: 1.5;
}

/* ── Loading Overlay ──────────────────────────────────────────────────────── */

.lru-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
}

.lru-overlay.lru-overlay-visible { display: flex; }

/* Prevent body scroll while overlay is open */
.lru-body-lock { overflow: hidden; }

.lru-overlay-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 44px 40px 36px;
  text-align: center;
  width: min(460px, 90vw);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ── CSS Spinner ──────────────────────────────────────────────────────────── */

.lru-spinner {
  width: 56px;
  height: 56px;
  margin-bottom: 24px;
  position: relative;
}

.lru-spinner-ring {
  position: absolute;
  inset: 0;
  border: 4px solid #e2e8f0;
  border-top-color: #2563eb;
  border-radius: 50%;
  -webkit-animation: lru-spin 0.8s linear infinite;
  animation: lru-spin 0.8s linear infinite;
}

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

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

/* ── Overlay Text ─────────────────────────────────────────────────────────── */

.lru-overlay-title {
  font-size: 19px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
  transition: color 0.2s;
}

.lru-overlay-sub {
  font-size: 14px;
  color: #64748b;
  margin-bottom: 24px;
}

/* ── Progress Bar ─────────────────────────────────────────────────────────── */

.lru-progress-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 20px;
}

.lru-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2563eb, #60a5fa);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── Overlay Error ────────────────────────────────────────────────────────── */

.lru-overlay-error {
  width: 100%;
  font-size: 13px;
  color: #dc2626;
  padding: 10px 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  margin-bottom: 16px;
  display: none;
  text-align: left;
}

/* ── Cancel Button ────────────────────────────────────────────────────────── */

.lru-cancel-btn {
  background: none;
  border: 1px solid #e2e8f0;
  color: #64748b;
  border-radius: 8px;
  padding: 9px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 40px;
}

.lru-cancel-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #1e293b;
}

/* ── Responsive — Mobile (<640px) ─────────────────────────────────────────── */

@media (max-width: 640px) {
  #lr-upload-form,
  .lr-upload-form {
    padding: 20px 12px;
  }

  .lru-form-card {
    padding: 24px 20px 20px;
    border-radius: 10px;
  }

  .lru-form-title { font-size: 20px; }
  .lru-form-subtitle { font-size: 14px; }

  .lru-drop-zone { padding: 24px 16px; }
  .lru-drop-primary { font-size: 14px; }
  .lru-drop-secondary { font-size: 13px; }

  .lru-textarea {
    font-size: 14px;
    min-height: 160px;
  }

  .lru-select,
  .lru-input {
    font-size: 16px; /* prevent iOS zoom on focus */
    padding: 12px 14px;
  }

  .lru-select { padding-right: 38px; }

  .lru-submit-btn {
    height: 56px;
    font-size: 16px;
    /* Ensure minimum 44px touch target */
    min-height: 44px;
  }

  .lru-badges { gap: 8px; }
  .lru-badge { font-size: 11px; padding: 5px 10px; }

  .lru-overlay-card {
    padding: 32px 24px 28px;
  }

  .lru-overlay-title { font-size: 17px; }
  .lru-overlay-sub   { font-size: 13px; }
  .lru-spinner       { width: 48px; height: 48px; }

  .lru-cancel-btn {
    min-height: 44px; /* touch-friendly */
    padding: 10px 28px;
  }
}

/* ── Focus visible — keyboard accessibility ───────────────────────────────── */

.lru-drop-zone:focus-visible,
.lru-submit-btn:focus-visible,
.lru-cancel-btn:focus-visible,
.lru-file-remove:focus-visible,
.lru-textarea:focus-visible,
.lru-select:focus-visible,
.lru-input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
