/* ─── Base Styles ─────────────────────────────────────────────────────────── */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d2d2d7;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #86868b;
}

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  transform: translateY(30px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

/* ─── Step Dots ──────────────────────────────────────────────────────────── */
.step-dot {
  background-color: #f5f5f7;
  color: #86868b;
  transition: all 0.3s ease;
}

.step-dot.active {
  background-color: #0071e3;
  color: white;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.3);
}

.step-dot.completed {
  background-color: #34c759;
  color: white;
  box-shadow: 0 4px 14px rgba(52, 199, 89, 0.3);
}

/* ─── Step Panels ────────────────────────────────────────────────────────── */
.step-panel {
  animation: fadeSlideIn 0.4s ease forwards;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ─── Upload Area ────────────────────────────────────────────────────────── */
.upload-area {
  transition: all 0.3s ease;
}

.upload-area:hover {
  background-color: #f0f0f3;
}

.upload-area.has-file {
  border-color: #34c759;
  border-style: solid;
  background-color: #f0fdf4;
}

/* ─── Form Status Animations ─────────────────────────────────────────────── */
#form-status {
  animation: fadeSlideIn 0.4s ease forwards;
}

/* ─── Loading Spinner ────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Success Checkmark ──────────────────────────────────────────────────── */
.success-check {
  animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* ─── Button Loading State ───────────────────────────────────────────────── */
.btn-loading {
  pointer-events: none;
  opacity: 0.8;
}

/* ─── Input Focus Glow ───────────────────────────────────────────────────── */
input:focus {
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* ─── Details / FAQ Transitions ──────────────────────────────────────────── */
details[open] summary {
  color: #0071e3;
}

/* ─── Hero dot pattern ───────────────────────────────────────────────────── */
@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* ─── Error Shake ────────────────────────────────────────────────────────── */
@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  20%,
  60% {
    transform: translateX(-6px);
  }

  40%,
  80% {
    transform: translateX(6px);
  }
}

.input-error {
  animation: shake 0.4s ease;
  border-color: #ff3b30 !important;
}

@media (max-width: 640px) {
  .modal-content {
    border-radius: 1.25rem 1.25rem 0 0;
    max-height: 100vh;
    max-height: 100dvh;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .modal-container {
    align-items: flex-end;
    padding: 0;
  }

  /* Compact upload areas on mobile */
  .upload-area {
    padding: 0.5rem !important;
  }

  .upload-area .upload-placeholder svg {
    width: 1rem;
    height: 1rem;
    margin-bottom: 0.125rem;
  }

  .upload-area .upload-placeholder p {
    font-size: 0.625rem;
  }

  /* Limit upload preview height */
  .upload-preview {
    max-height: 5rem !important;
  }

  /* Compact upload field spacing */
  .upload-field {
    margin-bottom: 0.375rem !important;
  }

  .upload-field label {
    font-size: 0.75rem !important;
    margin-bottom: 0.125rem !important;
  }

  .upload-field .text-xs {
    font-size: 0.5625rem !important;
    margin-top: 0.125rem !important;
  }

  /* FIXED action buttons at the very bottom of the screen */
  .step-panel .mt-8,
  .step-panel .mt-8.flex {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: white !important;
    padding: 0.75rem 1.25rem !important;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0)) !important;
    margin: 0 !important;
    z-index: 200 !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12) !important;
    border-radius: 0 !important;
    display: flex !important;
    gap: 0.75rem !important;
  }

  /* Add bottom padding to step panels so content doesn't hide behind fixed buttons */
  .step-panel {
    padding-bottom: 5rem !important;
  }
}

/* ─── Dashboard Tabs ─────────────────────────────────────────────────────── */
.dash-tab {
  background-color: #f5f5f7;
  color: #86868b;
}

.dash-tab.active {
  background-color: #0071e3;
  color: white;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.25);
}

.dash-tab:hover:not(.active) {
  background-color: #e8e8ed;
}

code {
  background-color: #f5f5f7;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: monospace;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
#sidebar {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-btn {
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-btn:hover {
  transform: translateX(-4px);
}

.sidebar-btn:active {
  transform: scale(0.97);
}

/* ─── Page Views ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-view {
  animation: fadeIn 0.3s ease;
}

/* ─── Bottom Navigation ────────────────────────────────────────────────── */
#bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-btn {
  color: #86868b;
  min-width: 48px;
}

.bottom-nav-btn.text-apple-blue {
  color: #0071e3;
}

/* ─── Info Modal ───────────────────────────────────────────────────────── */
#info-modal {
  max-height: 80vh;
  overflow-y: auto;
}

/* ─── Blog Prose ───────────────────────────────────────────────────────── */
.prose h1,
.prose h2,
.prose h3 {
  font-weight: 900;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

.prose h1 {
  font-size: 1.75rem;
}

.prose h2 {
  font-size: 1.5rem;
}

.prose h3 {
  font-size: 1.25rem;
}

.prose p {
  margin-bottom: 1em;
  line-height: 1.8;
}

.prose ul,
.prose ol {
  margin-bottom: 1em;
  padding-right: 1.5em;
}

.prose li {
  margin-bottom: 0.5em;
}

.prose a {
  color: #0071e3;
  text-decoration: underline;
}

.prose img {
  border-radius: 1rem;
  margin: 1.5em 0;
  max-width: 100%;
}

.prose blockquote {
  border-right: 4px solid #0071e3;
  padding-right: 1em;
  margin: 1em 0;
  color: #86868b;
}

/* ─── Line Clamp ───────────────────────────────────────────────────────── */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ─── Desktop: Hide bottom nav ─────────────────────────────────────────── */
@media (min-width: 768px) {
  #bottom-nav {
    display: none !important;
  }
}