/* ===============================
   AVT ORDERING TOOL – styles.css
   Full replacement
   - "Liquid glass" feel
   - Cleaner borders
   - Bigger previews
   =============================== */

* { box-sizing: border-box; font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', Arial, sans-serif; font-size: 14px; }

:root{
  --glass: rgba(255,255,255,0.55);
  --glass-strong: rgba(255,255,255,0.72);
  --stroke: rgba(255,255,255,0.55);
  --stroke2: rgba(17,24,39,0.08);
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.10);
  --shadow2: 0 6px 18px rgba(15, 23, 42, 0.08);
  --text: #111827;
  --muted: #6b7280;
  --brand: #2563eb;
}

body{
  margin:0;
  color: var(--text);
  background: linear-gradient(180deg, #e7ecf4 0%, #f4f6fa 100%);
}

.bg{
  position: fixed;
  inset:0;
  z-index:-1;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,0.55), transparent 45%),
    radial-gradient(circle at 70% 5%, rgba(255,255,255,0.35), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255,255,255,0.25), transparent 45%);
}

.page{
  max-width: 1300px;
  margin: 28px auto 60px;
  padding: 0 18px;
}

/* Liquid-glass shell */
.header, .card{
  background: var(--glass);
  border-radius: 22px;
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.header{
  display:flex;
  align-items:center;
  gap: 22px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.headerRight{
  margin-left: auto;
  white-space: nowrap;
}

.logo{ height: 97px; } /* increased by 15% from 84px */

.headerText h1{
  margin:0;
  font-size: 26px;
  font-weight: 600;
}

.headerMetaRow{
  display:flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items:flex-end;
  margin-top: 8px;
}

.headerBtns{ display:flex; gap:10px; }

.card{
  padding: 18px 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow2);
}

.card h2{
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 800;
}

/* Forms */
label{
  display:flex;
  flex-direction: column;
  gap:6px;
  font-size: 13px;
  color: #374151;
}

input, select{
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(17,24,39,0.10);
  padding: 0 12px;
  font-size: 14px;
  background: rgba(255,255,255,0.85);
}

input:focus, select:focus{
  outline:none;
  border-color: rgba(37,99,235,0.55);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* Layout */
.layout2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.col{
  display:flex;
  flex-direction: column;
  gap: 18px;
}

.row1{ display:grid; grid-template-columns: 1fr; gap:12px; }
.row2{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }

.gridForm{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.fullWidth{ grid-column: 1 / -1; }

/* Image areas */
.imageWrap, .stopSquare{
  margin-top: 14px;
  border-radius: 18px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.bigImg{
  width:100%;
  max-height: 560px;
  object-fit: contain;
  border-radius: 16px;
  display:block;
  background: rgba(255,255,255,0.75);
  padding: 10px;
  border: 1px solid rgba(17,24,39,0.08);
}

.placeholder{
  height: 280px;
  border-radius: 16px;
  border: 1px dashed rgba(17,24,39,0.22);
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--muted);
  background: rgba(255,255,255,0.55);
  text-align:center;
  font-size: 14px;
}

/* Pills */
.pillRow{
  display:flex;
  justify-content:flex-end;
  margin-top: 10px;
}

.pill{
  background: rgba(255,255,255,0.65);
  color: #1f2937;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.12);
  box-shadow: 0 8px 20px rgba(15,23,42,0.08);
}

/* Stops */
.stopSquare{ text-align:center; }

.stopImg{
  height: 320px;
  max-width: 100%;
  object-fit: contain;
  display:block;
  margin: 0 auto;
  background: rgba(255,255,255,0.75);
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(17,24,39,0.08);
}

.stopFooter{
  display:flex;
  justify-content: space-between;
  margin-top: 10px;
}

/* Total */
.totalBar{
  display:flex;
  justify-content: space-between;
  align-items:center;
}

.totalLabel{
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.totalValue{
  font-size: 24px;
  font-weight: 800;
}

.gstRow{
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-top: 1px solid rgba(0,0,0,0.1);
}

.gstLabel{
  font-size: 13px;
  color: var(--muted);
}

.gstValue{
  font-size: 13px;
  font-weight: 600;
}

.totalIncGstRow{
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  margin-top: 5px;
  border-top: 2px solid rgba(0,0,0,0.15);
}

.totalIncGstLabel{
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.totalIncGstValue{
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.muted{ color: var(--muted); font-size: 13px; }

.discountApplied{
  color: #b91c1c;
  font-weight: 900;
  margin-bottom: 6px;
}

/* Buttons */
.actions{ display:flex; gap:10px; }
.btn{
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(37,99,235,0.18);
}
.btnGhost{
  background: rgba(255,255,255,0.65);
  color: #111827;
  border: 1px solid rgba(17,24,39,0.10);
  box-shadow: none;
}

/* Admin */
.adminLink{
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.adminPanel{ margin-top: 10px; }

/* Milestones */
.milestoneBox{
  border: 1px solid rgba(17,24,39,0.10);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.60);
}
.milestoneRow{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(17,24,39,0.06);
}
.milestoneRow:last-child{ border-bottom: none; }

/* Lift specs */
.specGrid{
  border: 1px solid rgba(17,24,39,0.10);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.60);
}
.specRow{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(17,24,39,0.06);
}
.specRow:last-child{ border-bottom:none; }
.specKey{ font-weight: 900; }
.specVal{ line-height: 1.35; }

/* IMPORTANT: remove the “blue underline” look */
.editField{
  display:inline-block;
  padding: 0;
  border: none;
}
.editField[contenteditable="true"]:focus{
  outline: none;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
  border-radius: 8px;
  padding: 2px 6px;
}

/* Agreement signing */
.signGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 18px;
}
.signCard{
  border: 1px solid rgba(17,24,39,0.10);
  border-radius: 16px;
  padding: 14px;
  background: rgba(255,255,255,0.60);
}
.lineInput{
  width:100%;
  border: none !important;
  border-bottom: 2px solid #111827 !important;
  border-radius: 0 !important;
  padding: 6px 2px !important;
  height: 34px !important;
  background: transparent !important;
}

/* Modal */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
  z-index: 50;
}
.modalBox{
  width: 420px;
  max-width: 100%;
  background: rgba(255,255,255,0.92);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  border: 1px solid rgba(17,24,39,0.10);
}
.modalBox input{ width:100%; }
.modalBtns{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top: 12px;
}
.pwError{ color:#b91c1c; font-weight: 900; margin-top: 10px; }

/* History Modal */
.historyModalBox{
  width: 900px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

.historyFilters{
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.historyFilters input,
.historyFilters select{
  padding: 8px 12px;
  border: 1px solid rgba(17,24,39,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.85);
}

.historyList{
  flex: 1;
  overflow-y: auto;
  max-height: 550px;
  padding-right: 8px;
}

.historyItem{
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(17,24,39,0.10);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.historyItem:hover{
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.historyItemHeader{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.statusBadge{
  padding: 4px 10px;
  border-radius: 6px;
  color: white;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.historyItemDetails{
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.historyItemActions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btnSmall{
  padding: 6px 12px !important;
  font-size: 12px !important;
  min-width: auto !important;
}

.btnDanger{
  background: #dc2626 !important;
  color: #fff !important;
}

.btnDanger:hover{
  background: #b91c1c !important;
}

.statusDropdown{
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  min-width: 120px;
}

.statusDropdown:hover{
  border-color: #9ca3af;
}

.statusDropdown:focus{
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* PRINT (A4) */
@media print{
  body{ background:#fff !important; }
  .bg{ display:none !important; }

  .page{ max-width:none; margin:0; padding:0; }

  .actions, .adminLink, .adminPanel, .headerBtns, #pwModal{
    display:none !important;
  }

  .header, .card{
    box-shadow:none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background:#fff !important;
    border: none !important;
    border-radius: 0 !important;
  }

  /* make inputs look like text (no boxes) */
  input, select{
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
  }

  /* Ensure date input shows value */
  input[type="date"] {
    color: #111827 !important;
  }
  input[type="date"]:valid {
    color: #111827 !important;
  }

  /* Prevent ABN from wrapping */
  .headerRight {
    white-space: nowrap !important;
  }

  /* Make title smaller to fit on one line */
  .headerText h1 {
    font-size: 18px !important;
    white-space: nowrap !important;
  }

  /* Hide placeholders in print */
  input::placeholder {
    color: transparent !important;
    opacity: 0 !important;
  }
  input::-webkit-input-placeholder {
    color: transparent !important;
    opacity: 0 !important;
  }
  input::-moz-placeholder {
    color: transparent !important;
    opacity: 0 !important;
  }
  input:-ms-input-placeholder {
    color: transparent !important;
    opacity: 0 !important;
  }
  input::-ms-input-placeholder {
    color: transparent !important;
    opacity: 0 !important;
  }

  /* Hide signature date placeholders specifically */
  #signCustDate::-webkit-datetime-edit,
  #signAvtDate::-webkit-datetime-edit {
    color: transparent !important;
  }
  #signCustDate::-webkit-datetime-edit-text,
  #signCustDate::-webkit-datetime-edit-month-field,
  #signCustDate::-webkit-datetime-edit-day-field,
  #signCustDate::-webkit-datetime-edit-year-field,
  #signAvtDate::-webkit-datetime-edit-text,
  #signAvtDate::-webkit-datetime-edit-month-field,
  #signAvtDate::-webkit-datetime-edit-day-field,
  #signAvtDate::-webkit-datetime-edit-year-field {
    color: transparent !important;
  }

  /* Reorder customer info fields for print */
  .custName-field { order: 1; }
  .custDate-field { order: 2; }
  .custAddress-field { order: 3; }
  .custLocation-field { order: 4; }

  /* Add faded solid line under first row (Client's Name and Generated Quote Date) */
  .custName-field,
  .custDate-field {
    border-bottom: 1px solid #ccc !important;
    padding-bottom: 8px !important;
    margin-bottom: 8px !important;
  }

  /* Show valid until date in print */
  .validUntil {
    display: block !important;
    font-size: 11px !important;
    color: #374151 !important;
    margin-top: 4px !important;
    font-weight: 600 !important;
  }

  @page{ size: A4; margin: 8mm; }

  /* Show doc type header and scope of works in print */
  #docTypeHeader{
    display: block !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #374151 !important;
    margin-bottom: 8px !important;
    text-align: center !important;
  }
  
  #scopeOfWorksCard{
    display: block !important;
    page-break-before: always !important;
    margin-bottom: 0 !important;
    order: 10;
  }
  
  #scopeOfWorksCard h2{
    font-size: 16px !important;
    margin-bottom: 12px !important;
    border-bottom: 2px solid #000 !important;
    padding-bottom: 8px !important;
  }
  
  #scopeOfWorksCard p{
    margin: 10px 0 !important;
    line-height: 1.6 !important;
  }
  
  #scopeOfWorksCard ul{
    margin: 10px 0 10px 20px !important;
    line-height: 1.6 !important;
  }
  
  #scopeOfWorksCard li{
    margin: 5px 0 !important;
  }
  
  /* Hide edit button in print */
  #editScopeBtn{
    display: none !important;
  }
  
  /* Move total after scope */
  .totalBar{
    order: 11;
    page-break-before: avoid !important;
  }

  /* Prevent breaks inside cards */
  .header, .card{ 
    page-break-inside: avoid;
    break-inside: avoid;
  }
  
  /* Compact layout for print */
  .card{ 
    margin-bottom: 6px !important;
    padding: 10px 14px !important;
  }
  
  .header{
    margin-bottom: 8px !important;
  }
  
  /* Reduce gap after lift specs */
  #liftSpecsCard{
    margin-bottom: 0 !important;
    padding-bottom: 5px !important;
  }
  
  .specGrid{
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    margin: 0 !important;
  }
  
  .specRow{
    padding: 4px 0 !important;
    margin: 0 !important;
  }
  
  #supplyAgreementCard{
    margin-top: 0 !important;
    padding-top: 5px !important;
  }
  
  /* Add line under headings */
  .card h2, .card h3{
    border-bottom: 1px solid #000 !important;
    padding-bottom: 6px !important;
    margin-bottom: 8px !important;
    font-size: 15px !important;
  }
  
  /* Reduce image sizes to fit better */
  .bigImg{ 
    max-height: 60mm !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }
  
  .stopImg{ 
    max-height: 35mm !important;
    width: auto !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
  }
  
  /* Adjust image wrappers - center content */
  .imageWrap, .stopSquare{
    margin: 4px 0 !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }
  
  /* Reduce pill sizes */
  .pill{
    font-size: 11px !important;
    padding: 4px 10px !important;
  }
  
  /* Make layout columns stack vertically for print */
  .layout2{
    display: block !important;
  }
  
  .col{
    width: 100% !important;
  }
  
  /* Keep shaft, stops, and total together */
  .card:has(#shaftSelect),
  .card:has(#stopSelect),
  .totalBar{
    page-break-after: avoid !important;
  }
  
  /* Style the total bar for print */
  .totalBar{
    background: #f9fafb !important;
    border: 2px solid #111827 !important;
    border-radius: 8px !important;
    padding: 20px 24px !important;
    margin-top: 20px !important;
  }
  
  .totalLabel{
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #374151 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
  }
  
  .totalValue{
    font-size: 27px !important;
    font-weight: 900 !important;
    color: #111827 !important;
    margin: 4px 0 !important;
  }
  
  .totalBreakdown, .muted{
    font-size: 12px !important;
    color: #6b7280 !important;
  }
  
  /* Reorder sections for print - move supply agreement after lift specs */
  #liftSpecsCard{
    order: 1;
    page-break-before: always !important;
    page-break-after: avoid !important;
  }
  
  #supplyAgreementCard{
    order: 2;
    page-break-before: auto !important;
  }
  
  #milestoneCard{
    order: 3;
  }
  
  #agreementCard{
    order: 4;
  }
  
  .page{
    display: flex !important;
    flex-direction: column !important;
  }
}

/* Basic mobile stacking safeguard (your mobile.css can override further) */
@media (max-width: 768px){
  .layout2{ grid-template-columns: 1fr; }
  .row2{ grid-template-columns: 1fr; }
  .gridForm{ grid-template-columns: 1fr; }
}
