/* FieldFlip — construction orange + charcoal theme */
:root {
  --ff-orange: #F97316;
  --ff-orange-dark: #EA580C;
  --ff-slate: #1E293B;
  --ff-slate-light: #334155;
  --ff-gray: #94A3B8;
  --ff-light: #F1F5F9;
  --ff-white: #FFFFFF;
  --ff-red: #DC2626;
  --ff-green: #16A34A;
  --ff-border: #CBD5E1;
  --ff-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ff-light);
  color: var(--ff-slate);
  line-height: 1.5;
  min-height: 100vh;
}

.ff-nav {
  background: var(--ff-slate);
  color: var(--ff-white);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.ff-nav-logo {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--ff-orange);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.ff-nav-logo svg { width: 28px; height: 28px; }

.ff-nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ff-nav-links a {
  color: var(--ff-gray);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.ff-nav-links a:hover { color: var(--ff-white); }

.ff-nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ff-nav-plan {
  background: var(--ff-orange);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.ff-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.ff-btn-primary {
  background: var(--ff-orange);
  color: white;
}

.ff-btn-primary:hover { background: var(--ff-orange-dark); }

.ff-btn-secondary {
  background: var(--ff-slate);
  color: white;
}

.ff-btn-secondary:hover { background: var(--ff-slate-light); }

.ff-btn-outline {
  background: transparent;
  color: var(--ff-slate);
  border: 2px solid var(--ff-border);
}

.ff-btn-outline:hover { border-color: var(--ff-orange); color: var(--ff-orange); }

.ff-btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.ff-btn-danger {
  background: var(--ff-red);
  color: white;
}

.ff-btn-danger:hover { background: #B91C1C; }

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

/* ─── Offline banner ──────────────────────────────────────────────────── */
.ff-offline-banner {
  background: var(--ff-orange);
  color: white;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  display: none;
}

.ff-offline-banner.visible { display: block; }

/* ─── Container ───────────────────────────────────────────────────────── */
.ff-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Hero (landing) ─────────────────────────────────────────────────── */
.ff-hero {
  background: var(--ff-slate);
  color: white;
  padding: 80px 24px;
  text-align: center;
}

.ff-hero h1 {
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 16px;
  line-height: 1.1;
}

.ff-hero h1 span { color: var(--ff-orange); }

.ff-hero p {
  font-size: 1.2rem;
  color: var(--ff-gray);
  max-width: 540px;
  margin: 0 auto 32px;
}

.ff-hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.ff-tagline-icon {
  width: 56px;
  height: 56px;
  background: var(--ff-orange);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

/* ─── Features ───────────────────────────────────────────────────────── */
.ff-features {
  padding: 64px 24px;
  background: white;
}

.ff-features h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 40px;
  color: var(--ff-slate);
}

.ff-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  max-width: 800px;
  margin: 0 auto;
}

.ff-feature-card {
  text-align: center;
  padding: 24px;
}

.ff-feature-icon {
  width: 48px;
  height: 48px;
  background: #FFF7ED;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  color: var(--ff-orange);
}

.ff-feature-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.ff-feature-card p {
  font-size: 0.875rem;
  color: var(--ff-gray);
}

/* ─── How it works ────────────────────────────────────────────────────── */
.ff-how {
  padding: 64px 24px;
  background: var(--ff-light);
}

.ff-how h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 40px;
}

.ff-steps {
  display: flex;
  gap: 32px;
  max-width: 800px;
  margin: 0 auto;
  justify-content: center;
  flex-wrap: wrap;
}

.ff-step {
  flex: 1;
  min-width: 180px;
  text-align: center;
}

.ff-step-num {
  width: 48px;
  height: 48px;
  background: var(--ff-orange);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 900;
  margin: 0 auto 12px;
}

.ff-step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.ff-step p { font-size: 0.875rem; color: var(--ff-gray); }

/* ─── Pricing ─────────────────────────────────────────────────────────── */
.ff-pricing {
  padding: 64px 24px;
  background: var(--ff-slate);
  color: white;
}

.ff-pricing h2 {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 40px;
}

.ff-plans {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 900px;
  margin: 0 auto;
}

.ff-plan {
  background: rgba(255,255,255,0.07);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
}

.ff-plan.featured {
  border-color: var(--ff-orange);
  background: rgba(249,115,22,0.1);
}

.ff-plan-name {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ff-gray);
  margin-bottom: 8px;
}

.ff-plan.featured .ff-plan-name { color: var(--ff-orange); }

.ff-plan-price {
  font-size: 2.2rem;
  font-weight: 900;
  color: white;
  margin-bottom: 4px;
}

.ff-plan-price span { font-size: 0.9rem; font-weight: 400; color: var(--ff-gray); }

.ff-plan-desc {
  font-size: 0.85rem;
  color: var(--ff-gray);
  margin: 16px 0;
}

.ff-plan ul {
  list-style: none;
  text-align: left;
  font-size: 0.85rem;
  color: var(--ff-gray);
}

.ff-plan ul li { padding: 4px 0; }

.ff-plan ul li::before { content: '✓ '; color: var(--ff-orange); }

/* ─── Auth forms ──────────────────────────────────────────────────────── */
.ff-auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ff-slate);
  padding: 24px;
}

.ff-auth-card {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--ff-shadow);
}

.ff-auth-card h1 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.ff-auth-card p {
  color: var(--ff-gray);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.ff-form-group {
  margin-bottom: 18px;
}

.ff-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ff-slate);
}

.ff-form-group input,
.ff-form-group select,
.ff-form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--ff-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--ff-light);
  transition: border-color 0.15s;
}

.ff-form-group input:focus,
.ff-form-group select:focus,
.ff-form-group textarea:focus {
  outline: none;
  border-color: var(--ff-orange);
}

.ff-form-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--ff-red);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 18px;
  display: none;
}

.ff-form-error.visible { display: block; }

.ff-auth-link {
  text-align: center;
  font-size: 0.875rem;
  margin-top: 20px;
  color: var(--ff-gray);
}

.ff-auth-link a { color: var(--ff-orange); font-weight: 600; text-decoration: none; }

/* ─── Dashboard ───────────────────────────────────────────────────────── */
.ff-dashboard {
  padding: 32px 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.ff-dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.ff-dashboard-header h1 { font-size: 1.6rem; font-weight: 800; }

.ff-dashboard-actions { display: flex; gap: 10px; align-items: center; }

.ff-capture-count {
  font-size: 0.8rem;
  color: var(--ff-gray);
  font-weight: 500;
}

/* Filters */
.ff-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  align-items: center;
}

.ff-filters input,
.ff-filters select {
  padding: 8px 12px;
  border: 2px solid var(--ff-border);
  border-radius: 8px;
  font-size: 0.875rem;
  background: white;
}

.ff-filters input:focus, .ff-filters select:focus {
  outline: none;
  border-color: var(--ff-orange);
}

/* Ticket table */
.ff-ticket-list {
  background: white;
  border-radius: 12px;
  box-shadow: var(--ff-shadow);
  overflow: hidden;
}

.ff-empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--ff-gray);
}

.ff-empty-state svg {
  width: 64px;
  height: 64px;
  color: var(--ff-border);
  margin-bottom: 16px;
}

.ff-empty-state h2 { font-size: 1.2rem; font-weight: 700; color: var(--ff-slate); margin-bottom: 8px; }
.ff-empty-state p { font-size: 0.9rem; margin-bottom: 24px; }

.ff-table {
  width: 100%;
  border-collapse: collapse;
}

.ff-table th {
  background: var(--ff-slate);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ff-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ff-light);
  font-size: 0.9rem;
  vertical-align: middle;
}

.ff-table tr:last-child td { border-bottom: none; }
.ff-table tr:hover td { background: #FAFAFA; }

.ff-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.ff-sync-badge.online { background: #DCFCE7; color: var(--ff-green); }
.ff-sync-badge.offline { background: #FFEDD5; color: var(--ff-orange); }

.ff-table-actions { display: flex; gap: 6px; }

/* ─── Capture page ────────────────────────────────────────────────────── */
.ff-capture-page {
  min-height: calc(100vh - 65px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
  background: var(--ff-slate);
}

.ff-snap-zone {
  background: white;
  border-radius: 20px;
  padding: 48px;
  text-align: center;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--ff-shadow);
}

.ff-snap-camera-icon {
  width: 80px;
  height: 80px;
  background: #FFF7ED;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  color: var(--ff-orange);
}

.ff-snap-zone h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.ff-snap-zone p { color: var(--ff-gray); font-size: 0.9rem; margin-bottom: 28px; }

.ff-snap-btn {
  background: var(--ff-orange);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 18px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
  transition: background 0.15s;
}

.ff-snap-btn:hover { background: var(--ff-orange-dark); }
.ff-snap-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ff-snap-btn svg { width: 28px; height: 28px; }

/* OCR results form */
.ff-ocr-form {
  background: white;
  border-radius: 20px;
  padding: 36px;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--ff-shadow);
}

.ff-ocr-form h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.ff-ocr-form .ff-subtext {
  color: var(--ff-gray);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.ff-ocr-preview {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 2px solid var(--ff-light);
}

.ff-ocr-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.ff-ocr-grid .ff-form-group { margin-bottom: 0; }

.ff-ocr-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ─── Edit modal ──────────────────────────────────────────────────────── */
.ff-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.ff-modal-overlay.visible { display: flex; }

.ff-modal {
  background: white;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--ff-shadow);
}

.ff-modal h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 20px; }

.ff-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ff-gray);
  float: right;
  margin-top: -4px;
}

.ff-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ─── Settings ────────────────────────────────────────────────────────── */
.ff-settings {
  padding: 32px 24px;
  max-width: 700px;
  margin: 0 auto;
}

.ff-settings h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 28px; }

.ff-settings-section {
  background: white;
  border-radius: 12px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--ff-shadow);
}

.ff-settings-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ff-site-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--ff-light);
}

.ff-site-item:last-child { border-bottom: none; }

.ff-plan-card {
  background: var(--ff-light);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.ff-plan-card.current {
  border: 2px solid var(--ff-orange);
}

.ff-plan-card .plan-name { font-weight: 700; font-size: 1rem; }
.ff-plan-card .plan-desc { font-size: 0.85rem; color: var(--ff-gray); }

/* ─── Capture progress / loading ─────────────────────────────────────── */
.ff-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
}

.ff-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--ff-light);
  border-top-color: var(--ff-orange);
  border-radius: 50%;
  animation: ff-spin 0.8s linear infinite;
}

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

/* ─── Toast notifications ─────────────────────────────────────────────── */
.ff-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ff-toast {
  background: var(--ff-slate);
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--ff-shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: ff-slide-in 0.2s ease-out;
  max-width: 320px;
}

.ff-toast.success { background: var(--ff-green); }
.ff-toast.error { background: var(--ff-red); }
.ff-toast.warning { background: var(--ff-orange); }

@keyframes ff-slide-in {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ─── Footer ─────────────────────────────────────────────────────────── */
.ff-footer {
  background: var(--ff-slate);
  color: var(--ff-gray);
  padding: 32px 24px;
  text-align: center;
  font-size: 0.85rem;
}

.ff-footer a { color: var(--ff-gray); text-decoration: none; }
.ff-footer a:hover { color: white; }

/* ─── Mobile ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .ff-hero h1 { font-size: 2.2rem; }
  .ff-ocr-grid { grid-template-columns: 1fr; }
  .ff-table { font-size: 0.8rem; }
  .ff-table th, .ff-table td { padding: 10px 12px; }
  .ff-dashboard-header { flex-direction: column; align-items: flex-start; }
  .ff-nav-links span { display: none; }
  .ff-plans { grid-template-columns: 1fr; }
}