/* Quotations Module Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary-color: #1f3b73; --primary-hover: #1b2f5b; --secondary-color: #0ea5e9;
  --danger-color: #dc2626; --danger-hover: #b91c1c;
  --bg-color: #1f3b73; --card-bg: #ffffff; --border-color: #d9e7ea;
  --text-primary: #1e293b; --text-secondary: #64748b;
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1); --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
  --print-footer-h: 24mm;
}
/* Embed HARLOWSI font (Harlow Solid Italic) for UI and print */
@font-face {
  font-family: 'HARLOWSI';
  src: local('HARLOWSI'), url('fonts/HARLOWSI.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: linear-gradient(135deg, #0f172a 0%, #1f2937 100%); color: var(--text-primary); line-height: 1.6; padding: 24px; min-height: 100vh; position: relative; }
body::before { content: ""; position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0) 60%), url('../icons/LuminoTec%20Logo.png') center/ min(80vw, 800px) no-repeat; opacity: 0.08; pointer-events: none; z-index: 0; }
.container { max-width: 1200px; margin: 0 auto; position: relative; z-index: 1; }
header { text-align: center; margin-bottom: 40px; padding: 24px; background: rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border-radius: 16px; border: 1px solid rgba(255, 255, 255, 0.2); }
header h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); color: #ffffff; margin-bottom: 10px; font-weight: 300; letter-spacing: 0.5px; font-family: "Segoe UI","Inter","Roboto","Helvetica Neue",Arial,sans-serif; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.subtitle { color: rgba(255,255,255,0.95); font-size: 1.1rem; }
.form-section, .list-section { background: var(--card-bg); padding: 28px; border-radius: 16px; box-shadow: 0 6px 16px rgba(0,0,0,0.12); margin-bottom: 28px; border: 1px solid rgba(0, 0, 0, 0.05); transition: box-shadow 0.3s ease; }
.form-section:hover, .list-section:hover { box-shadow: 0 12px 24px rgba(0,0,0,0.18); }
.form-section h2, .list-section h2 { font-size: 1.4rem; margin-bottom: 16px; }
.form-group { margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: block; margin-bottom: 6px; font-weight: 500; }
input[type="text"], input[type="date"], input[type="number"], input[type="tel"], input[type="email"], select { width: 100%; padding: 12px; min-height: 44px; border: 2px solid var(--border-color); border-radius: 8px; font-size: 1rem; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.error-message { display: block; color: var(--danger-color); font-size: .9rem; min-height: 18px; margin-top: 4px; }
.btn { padding: 11px 24px; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1); position: relative; overflow: hidden; }
.btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.2); transform: translate(-50%, -50%); transition: width 0.6s, height 0.6s; }
.btn:hover::before { width: 300px; height: 300px; }
.btn-primary { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); color: #fff; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4); }
.btn-secondary { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); color: #fff; box-shadow: 0 4px 12px rgba(75, 85, 99, 0.3); }
.btn-secondary:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(75, 85, 99, 0.4); }
/* Reduce hover spread only for the Home button (secondary button in header) */
header a.btn.btn-secondary:hover::before { width: 140px; height: 140px; }
.btn-danger { background: var(--danger-color); color: #fff; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; }
.list-header { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.list-header h2 { margin-bottom: 0; }
.search-row { display: flex; gap: 12px; flex-wrap: wrap; }
.search-row input, .search-row select { flex: 1; min-width: 140px; }
.backup-row { display: flex; gap: 12px; flex-wrap: wrap; }
.backup-row .btn { padding: 10px 20px; font-size: 0.9rem; }
.items-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 16px; margin-top: 8px; }
.items-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.item-row { display:grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: center; position: relative; z-index: 0; }
.items-card, .form-section { overflow: visible; }
/* Ensure the product selector's dropdown is not clipped under adjacent inputs on mobile */
select#product-selector { position: relative; z-index: 10; }
/* Lower stacking of siblings so the select menu can overlay */
.item-row > input, .item-row > button { position: relative; z-index: 1; }
@supports (-webkit-touch-callout: none) {
  /* Nudge WebView to create its own compositing layer for the select */
  select#product-selector { transform: translateZ(0); }
}
.table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
thead { background: var(--bg-color); }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border-color); }
thead th { color: #ffffff; border-bottom-color: rgba(255,255,255,0.25); }
thead th { background: var(--bg-color); }
thead th:first-child { border-top-left-radius: 12px; }
thead th:last-child { border-top-right-radius: 12px; }
.page-footer { margin-top: 20px; background: var(--bg-color); color: #ffffff; text-align: center; border-radius: 12px; padding: 14px; box-shadow: 0 6px 16px rgba(0,0,0,0.12); }
.page-footer .footer-primary { font-weight: 800; font-family: 'HARLOWSI', 'Segoe UI', Roboto, Arial, sans-serif; }
.page-footer .footer-secondary { margin-top: 4px; opacity: 0.95; }
.action-btn { padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; font-size: .9rem; margin-right: 6px; }
.delete-btn { background: var(--danger-color); color: #fff; }
.whatsapp-btn { background: #25d366; color: #fff; padding: 5px 8px; line-height: 1; }
.empty-state { text-align: center; color: var(--text-secondary); padding: 40px; display: none; }
.empty-state.show { display: block; }
.totals { margin-top: 16px; border:1px solid var(--border-color); border-radius:12px; padding:12px; }
.totals .row { display:flex; justify-content:space-between; padding:6px 0; }
.totals .grand { font-weight:700; font-size:1.1rem; }
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; justify-content: center; align-items: center; }
.modal.show { display: flex; }
.modal-content { background: var(--card-bg); padding: 24px; border-radius: 12px; max-width: 420px; width: 90%; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
@media (max-width: 768px) {
  html, body { overflow-x: hidden; }
  body { padding: 10px; }
  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .btn { width: 100%; }
  /* Two-column mobile layout */
  .item-row { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(44px, auto); }
  /* Product selector spans full width */
  .item-row select#product-selector { grid-column: 1 / -1; }
  /* Add Item button on its own row, full width */
  .item-row .btn { grid-column: 1 / -1; width: 100%; justify-self: stretch; }
}
@media (max-width: 420px) {
  /* Extra small screens: stack everything */
  .item-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; top: -9999px; left: -9999px; }
  tr { margin-bottom: 10px; border: 1px solid var(--border-color); border-radius: 8px; padding: 8px; }
  td { border: none; position: relative; padding-left: 50%; }
  td:before { position: absolute; left: 10px; width: 45%; content: attr(data-label); font-weight: 600; pointer-events: none; }
  /* Avoid the overlay from the data-label on the Actions cell to ensure buttons are clickable */
  td:last-child { padding-left: 10px; }
  td:last-child:before { content: none; }
}

/* Print-safe quotation structure */
.print-page{ position: relative; padding: 24px; }
.print-footer{ display: none }
.print-footer .line1{ font-weight: 800; font-family: 'HARLOWSI', 'Segoe UI', Roboto, Arial, sans-serif }
.print-footer .line2{ margin-top: 4px; opacity: .95 }

/* Repeat table headers when printing for document tables that use .items */
table.items thead{ display: table-header-group }

@media print {
  @page { size: A4; margin: 20mm 20mm 30mm 20mm }
  body { background: #fff !important; padding: 0 }
  .page-footer{ display: none }
  .print-page{ padding: 0 }
  .print-content{ padding-bottom: 18mm }
  .print-footer{ display:block; position: fixed; left: 0; right: 0; bottom: 0; background: var(--bg-color); color: #fff; border-radius: 8px; text-align: center; padding: 5.5px 12px; line-height: 1.25; font-size: 11px }
}

/* Signature block (hidden on screen, visible on print only) */
.signature-block { display: none; }
.signature-block .sign-col { flex: 1; }
.signature-block .sign-title { font-weight: 600; margin-bottom: 12px; }
.signature-block .sign-line { border-bottom: 1px solid #333; height: 36px; margin: 24px 0 8px; }
.signature-block .sign-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 0.9em; color: var(--text-secondary); }
.signature-block .sign-meta span { font-weight: 600; }

@media (max-width: 600px) {
  .signature-block { flex-direction: column; }
}

@media print {
  .signature-block { display: flex; gap: 24px; page-break-inside: avoid; break-inside: avoid; margin-top: 24mm; }
  .no-break { page-break-inside: avoid; break-inside: avoid; }
  .signature-block .sign-line { height: 28px; border-bottom: 1px solid #000; }
}
