/* ═══════════════════════════════════════════════════════════════════════════
   Lease Review Page — Styles
   Consistent with web_assets/bg/styles.css design language
   ═══════════════════════════════════════════════════════════════════════════ */

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0a0a2e 0%, #1a1a4e 50%, #0a0a2e 100%);
  color: #fff;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Screens ───────────────────────────────────────────────────────────── */
.screen {
  display: none;
  min-height: 100vh;
}

.screen.active {
  display: flex;
}

/* ── Centered Screens (loading, error, success) ────────────────────────── */
.container {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

/* ── Logo ──────────────────────────────────────────────────────────────── */
.logo-box {
  width: 80px;
  height: 80px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
  margin-bottom: 16px;
}

.logo-box.small {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.logo-letter {
  font-size: 40px;
  font-weight: 700;
  color: #6C63FF;
  line-height: 1;
}

.logo-box.small .logo-letter {
  font-size: 24px;
}

.brand-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 6px;
  color: #fff;
  margin-bottom: 32px;
}

.brand-sub {
  font-size: 12px;
  letter-spacing: 4px;
  color: rgba(255, 255, 255, 0.5);
  display: block;
  margin-top: 4px;
}

/* ── Spinner ───────────────────────────────────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: #6C63FF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 24px auto;
}

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

.loading-text {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
}

/* ── Icons ─────────────────────────────────────────────────────────────── */
.success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  border: 3px solid #10B981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #10B981;
  margin: 24px auto;
}

.edit-success-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(59, 130, 246, 0.15);
  border: 3px solid #3B82F6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #3B82F6;
  margin: 24px auto;
}

.error-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 3px solid #EF4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #EF4444;
  margin: 24px auto;
}

h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 12px;
}

p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  line-height: 1.6;
}

.success-detail {
  margin-top: 20px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.success-detail p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Review Screen — Full Page Layout
   ═══════════════════════════════════════════════════════════════════════════ */

#screen-review {
  flex-direction: column;
}

.review-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
}

/* ── Review Header ─────────────────────────────────────────────────────── */
.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-text h1 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 2px;
  color: #fff;
}

.header-text .subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  color: #A5A0FF;
}

.badge-icon {
  font-size: 14px;
}

/* ── Info Banner ───────────────────────────────────────────────────────── */
.info-banner {
  padding: 14px 24px;
  background: rgba(59, 130, 246, 0.08);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
}

.info-banner p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
}

.info-banner strong {
  color: #fff;
}

/* ── PDF Viewer ────────────────────────────────────────────────────────── */
.pdf-viewer-container {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  padding-bottom: 100px; /* Space for sticky footer */
}

.pdf-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
}

.pdf-loading p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
}

.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pdf-pages canvas {
  display: block;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  background: #fff;
  image-rendering: auto;
  -webkit-font-smoothing: antialiased;
}

.pdf-page-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  margin-top: 4px;
  margin-bottom: 8px;
}

.pdf-page-placeholder {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

.pdf-page-loading {
  padding: 40px;
}

.spinner.small {
  width: 28px;
  height: 28px;
  border-width: 2px;
}

/* ── Sticky Footer ─────────────────────────────────────────────────────── */
.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(10, 10, 46, 0.95);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 12px;
  z-index: 20;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */
.btn-primary {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  flex: 1;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-approve {
  background: linear-gradient(135deg, #10B981, #059669);
  color: #fff;
}

.btn-approve:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
}

.btn-edit {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-edit:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-icon {
  font-size: 18px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Edit Panel — Overlay
   ═══════════════════════════════════════════════════════════════════════════ */

.edit-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.edit-panel-content {
  width: 100%;
  max-width: 600px;
  background: #1a1a4e;
  padding: 28px 24px;
  padding-top: calc(28px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: fadeIn 0.2s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.edit-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.edit-panel-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 0;
}

.edit-panel-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.edit-panel-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.edit-panel-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 16px;
  line-height: 1.5;
}

.edit-textarea {
  width: 100%;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  min-height: 120px;
  max-height: 40vh;
  transition: border-color 0.2s;
}

.edit-textarea::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.edit-textarea:focus {
  outline: none;
  border-color: #6C63FF;
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

.edit-char-count {
  text-align: right;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 6px;
}

.edit-panel-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.edit-panel-actions .btn-primary {
  background: linear-gradient(135deg, #3B82F6, #2563EB);
  color: #fff;
}

.edit-panel-actions .btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4);
}

.edit-panel-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* ── Confirm Dialog ────────────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.confirm-dialog {
  width: 90%;
  max-width: 400px;
  background: #1a1a4e;
  border-radius: 20px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.confirm-dialog h3 {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 8px;
}

.confirm-dialog p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 24px;
}

.confirm-actions {
  display: flex;
  gap: 12px;
}

/* ── Processing Overlay ────────────────────────────────────────────────── */
.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 46, 0.9);
  backdrop-filter: blur(10px);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.processing-overlay p {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .review-header {
    padding: 12px 16px;
  }

  .header-badge {
    display: none;
  }

  .header-text h1 {
    font-size: 14px;
  }

  .info-banner {
    padding: 12px 16px;
  }

  .pdf-viewer-container {
    padding: 12px;
  }

  .sticky-footer {
    padding: 12px 16px;
    flex-direction: column;
  }

  .sticky-footer .btn-primary,
  .sticky-footer .btn-secondary {
    width: 100%;
  }

  .btn-primary,
  .btn-secondary {
    font-size: 14px;
    padding: 12px 20px;
  }

  .edit-panel-content {
    padding: 24px 16px;
  }
}
