/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Custom select arrow with proper spacing */
select {
  appearance: none;
  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%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

/* Print styles — compact, readable consignment detail */
@page { margin: 0.4in; }

/* 2-column "Special Catalog" — flows entries into two columns (screen + print) */
.catalog-columns { column-count: 2; column-gap: 24px; }
.catalog-columns .catalog-col-entry { break-inside: avoid; border-bottom: 1px solid #cbd5e1; padding: 6px 0; }

/* Catalog print/preview pages render on the gray app body. On SCREEN, give the
   .catalog-print wrapper the same white "paper" card the rest of the app uses
   (matches shadow-sm + ring-1 ring-slate-950/5) so it doesn't float on the gray.
   Print is unaffected — the @media print block below flattens .catalog-print. */
@media screen {
  .catalog-print {
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05), 0 0 0 1px rgb(2 6 23 / 0.05);
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
  }
}

@media print {
  nav { display: none !important; }
  .no-print { display: none !important; }

  body {
    background: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Compact spacing — target: 1 page per consignment.
     Font sizes bumped 2026-05-30 (Clara): older buyers print these and the
     8–9px sizing was too small to read. Now ~25% larger across the board. */
  .print-compact { padding: 0 !important; max-width: none !important; }
  .print-compact h1 { font-size: 18px !important; margin-bottom: 2px !important; }
  .print-compact h2 { font-size: 11px !important; page-break-after: avoid; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b !important; }
  .print-compact dt { font-size: 10px !important; line-height: 1.2 !important; }
  .print-compact dd { font-size: 11px !important; line-height: 1.3 !important; margin-top: 0 !important; }
  .print-compact dl { row-gap: 2px !important; column-gap: 10px !important; grid-template-columns: repeat(4, 1fr) !important; }
  /* Strip card chrome — sections become borderless rows separated by a thin rule */
  .print-compact .print-section {
    padding: 4px 0 !important;
    margin-bottom: 0 !important;
    border: none !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    page-break-inside: avoid;
  }
  .print-compact .print-section:last-of-type { border-bottom: none !important; }
  .print-compact .print-section > div:first-child { margin-bottom: 2px !important; }
  /* Collapse the gap between detail sections */
  .print-compact .space-y-6 > * + * { margin-top: 0 !important; }
  /* Suppress section header icons */
  .print-compact .print-section svg { display: none !important; }
  /* Compress page header */
  .print-compact .mb-8 { margin-bottom: 4px !important; }
  .print-compact .mb-6 { margin-bottom: 2px !important; }
  .print-compact .mb-4 { margin-bottom: 2px !important; }
  .print-compact .mb-3 { margin-bottom: 1px !important; }
  .print-compact .mb-2 { margin-bottom: 1px !important; }
  .print-compact .gap-y-4 { row-gap: 1px !important; }
  .print-compact .gap-y-1 { row-gap: 0 !important; }
  .print-compact .py-8, .print-compact .sm\:py-12 { padding-top: 0 !important; padding-bottom: 0 !important; }
  /* Strip pill badge styling — render as plain inline text to save space */
  .print-compact span.rounded-full {
    background: transparent !important;
    padding: 0 2px !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    font-size: 10px !important;
    display: inline !important;
  }
  /* Tighten flex-wrap pill containers (vaccinations, certifications) */
  .print-compact .flex.flex-wrap { gap: 0 4px !important; }
  /* Strip sub-section separators to save vertical space */
  .print-compact .border-t.border-slate-100 { border-top: none !important; padding-top: 0 !important; margin-top: 0 !important; }
  /* Keep the logo strip separator — carve out from the broad border-t rule above */
  .print-compact .logo-strip { border-top: 1px solid #e2e8f0 !important; padding-top: 4px !important; margin-top: 4px !important; }
  /* Compress the seller confirmation sub-section in financials */
  .print-compact .sm\:col-span-2 { padding-top: 0 !important; margin-top: 0 !important; }

  /* Show print-only elements, hide interactive details */
  .print-only { display: block !important; }

  /* Per-lot printing: siblings get print-hide class via Stimulus controller */
  .print-hide { display: none !important; }

  /* Catalog bulk print: each consignment sheet (and rep group) starts a new page.
     page-break-before is the legacy alias for non-Chromium / older print engines. */
  .print-page-break { page-break-before: always; break-before: page; }
  /* Bulk-print sheet + rep headings stay legible — override the generic h2 squash above */
  .print-compact .catalog-print-title { font-size: 14px !important; text-transform: none !important; letter-spacing: normal !important; color: #0f172a !important; page-break-after: avoid; }

  /* CattleLogRep catalog (print.html.erb): condensed entries, ~3 per page,
     each kept whole. Tuned to the legacy CattleLogRep PDF — distinctly
     larger body, max-weight on labels/headers, and a hard black rule
     between lots so a reader can scan from across the room.

     Force Helvetica/Arial throughout so font-weight: 900 actually renders
     as black (Inter caps at 800 in many browsers; system Helvetica goes
     blacker and matches the legacy look). */
  .catalog-print, .catalog-print * { font-family: Helvetica, Arial, sans-serif !important; }
  .catalog-print { padding: 0 !important; max-width: none !important; }
  .catalog-print .catalog-banner { page-break-after: avoid; }
  .catalog-print .catalog-entry { page-break-inside: avoid; font-size: 14px !important; line-height: 1.25 !important; color: #000 !important; }
  .catalog-print .catalog-entry .text-base { font-size: 18px !important; }
  /* Maximum weight on every Tailwind .font-bold descendant — labels
     (Location:, Breed: …), the lot/consignor/base-wt header, and the
     head-kind line all render as black. */
  .catalog-print .catalog-entry .font-bold { font-weight: 900 !important; }
  .catalog-print .catalog-entry .catalog-rows { margin-top: 3px !important; }
  .catalog-print .catalog-entry .logo-strip { margin-top: 4px !important; }
  .catalog-print .catalog-entry .logo-strip img { height: 32px !important; width: auto !important; }
  .catalog-print .py-3 { padding-top: 5px !important; padding-bottom: 5px !important; }
  /* Hard separator between lots — solid black 2px rule, not the slate
     divide-y we use on-screen. */
  .catalog-print .divide-y > * + * { border-top-color: #000 !important; border-top-width: 2px !important; }

  /* 2-column "Special Catalog" — denser entries, but with the same
     weight + color treatment as the single column so it stays readable. */
  .catalog-print-narrow, .catalog-print-narrow * { font-family: Helvetica, Arial, sans-serif !important; }
  .catalog-print-narrow .catalog-columns { column-gap: 16px !important; }
  .catalog-print-narrow .catalog-entry { font-size: 12px !important; line-height: 1.2 !important; color: #000 !important; }
  .catalog-print-narrow .catalog-entry .text-base { font-size: 15px !important; }
  .catalog-print-narrow .catalog-entry .font-bold { font-weight: 900 !important; }
  .catalog-print-narrow .catalog-col-entry { padding: 4px 0 !important; border-bottom-color: #000 !important; border-bottom-width: 2px !important; }
  .catalog-print-narrow .logo-strip img { height: 24px !important; }
  .print-diff-row { padding: 2px 4px !important; margin-bottom: 1px !important; }
  .print-diff-row span { font-size: 8px !important; padding: 1px 4px !important; }
  .print-diff-row p { font-size: 7px !important; margin-bottom: 1px !important; }
  .print-diff-row .flex-wrap { gap: 2px !important; }

  /* Change sheet — compact print layout */
  .print-change-sheet { padding: 0 !important; }
  .print-change-sheet h1 { font-size: 14px !important; margin-bottom: 2px !important; }
  .print-change-sheet > .mb-6 { margin-bottom: 4px !important; }
  .print-change-sheet > .mb-8 { margin-bottom: 6px !important; }
  .print-change-sheet table th { font-size: 8px !important; padding: 3px 6px !important; }
  .print-change-sheet table td { font-size: 9px !important; padding: 1px 6px !important; line-height: 1.3 !important; }
  .print-change-sheet .space-y-6 > * + * { margin-top: 6px !important; }
  .print-change-sheet .rounded-xl { border-radius: 2px !important; box-shadow: none !important; }
  .print-change-sheet .bg-slate-50 { padding: 4px 8px !important; }
  .print-change-sheet .border-b { border-bottom-width: 1px !important; }
  .print-change-sheet .text-sm { font-size: 9px !important; }
  .print-change-sheet .text-xs { font-size: 8px !important; }
  .print-change-sheet .mt-0\.5 { margin-top: 0 !important; }
  .print-change-sheet details > *:not(summary) { font-size: 8px !important; }
}

/* iOS Safari: date/time inputs render invisible without explicit appearance & height */
@supports (-webkit-touch-callout: none) {
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"] {
    -webkit-appearance: none;
    appearance: none;
    min-height: 2.75rem;
    background-color: white;
  }
}
