/* =========================================
   Handover Certificate – Complete Styles
   ========================================= */

/* ---------- Theme variables ---------- */
:root{
  --hc-font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --hc-font-size: 15px;      /* base body + input size (bigger than the old 13px) */
  --hc-text: #111;
  --hc-muted: #4b5563;
  --hc-border: #cbd5e1;
  --hc-border-strong: #9aa1a8;
  --hc-bg: #ffffff;
  --hc-soft: #f8fafc;
  --hc-shadow: 0 1px 3px rgba(0,0,0,.06);

  --hc-btn-bg: #111;
  --hc-btn-fg: #fff;
}

/* ---------- Wrapper / Card ---------- */
.hc-wrap{
  max-width: 720px;
  margin: 24px auto;
  padding: 0 12px;
  font: var(--hc-font-size)/1.5 var(--hc-font-family);
  color: var(--hc-text);
}

.hc-card{
  border: 1px solid var(--hc-border);
  background: var(--hc-bg);
  border-radius: 10px;
  box-shadow: var(--hc-shadow);
  padding: 18px;
}

/* ---------- Header (logo + details in page view) ---------- */
.hc-headtable{ width:100%; border-collapse:collapse; margin-bottom:10px; }
.hc-headtable td{ border:none; padding:0; vertical-align:middle; }
.hc-headtable .logo{ width:150px; }
.hc-headtable .logo img{ display:block; max-width:140px; height:auto; }
.hc-headtable .details{ padding-left:12px; font-size:14px; line-height:1.45; }

/* ---------- Title chip ---------- */
.hc-title{
  border: 1px solid #94a3b8;
  text-align: center;
  font-weight: 700;
  padding: 8px;
  margin: 8px 0 14px;
  font-size: 16px;
  letter-spacing: .2px;
  border-radius: 8px;
}

/* ---------- Section headings (form view) ---------- */
.hc-card h4{
  margin: 14px 0 8px;
  font-size: 16px;
  font-weight: 600;    /* change to 400 if you want headings not bold in the form */
}

/* ---------- Data table (form view) ---------- */
.hc-table{
  width:100%;
  border-collapse: collapse;
  margin: 10px 0;
  table-layout: fixed;
}
.hc-table th,
.hc-table td{
  border: 1px solid var(--hc-border-strong);
  padding: 8px 9px;
  vertical-align: top;
  word-break: break-word;
}
.hc-table th{
  background: #f1f5f9;
  text-align: left;
  font-weight: 400;    /* labels NOT bold in the form, as requested earlier */
  width: 220px;
  font-size: 14px;
}

/* ---------- Inputs (bigger form text) ---------- */
.hc-input,
.hc-textarea,
.hc-select{
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--hc-border);
  border-radius: 8px;
  font: 15px/1.45 var(--hc-font-family); /* match base size, comfortable on mobile */
  color: var(--hc-text);
  background: #fff;
}
.hc-textarea{ min-height: 72px; }

/* Read-only look blocks */
.hc-fixed{
  padding: 8px 10px;
  background: var(--hc-soft);
  border: 1px solid var(--hc-border);
  border-radius: 8px;
}

/* Small muted helper text */
.hc-muted{ color: var(--hc-muted); margin: 6px 0; font-size: 13px; }

/* ---------- Signature UI ---------- */
.sig-tools{ display:flex; gap:8px; margin: 4px 0 10px; }
.sig-pad{
  border: 1px solid var(--hc-border);
  border-radius: 8px;
  height: 120px;
  width: 100%;
  background: #fff;
  display: block;

  /* prevent browser gestures from stealing input */
  touch-action: none;
  -ms-touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;

  cursor: crosshair;
  position: relative;
  z-index: 1;
}

/* ---------- Photo grid (if used) ---------- */
.hc-photos{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}
.hc-photos .hc-photo{
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  background: #fafafa;
}
.hc-photos .hc-photo img{
  display:block;
  width: 100%;
  height: 140px;
  object-fit: cover;
}

/* ---------- Actions ---------- */
.hc-actions{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
  justify-content: center;
}
.hc-actions button{
  padding: 10px 14px;
  border: 1px solid var(--hc-btn-bg);
  border-radius: 10px;
  background: var(--hc-btn-bg);
  color: var(--hc-btn-fg);
  cursor: pointer;
  font-weight: 600;
}
.hc-actions button.secondary{
  background: #fff;
  color: var(--hc-btn-bg);
}

/* Hidden until JS shows after "Generate" */
.hc-post-actions{ display:none; }

/* Preview container (shown by JS after "Generate") */
.hc-print-view{ display:none; }

/* ---------- Collapsible form toggle (added by JS) ---------- */
/* JS injects inline styles for immediate usability; these rules are safe defaults */
.hc-form-toggle{
  display:none; /* only appears on small screens via media query */
}

/* ---------- Mobile layout (≤640px) ---------- */
@media (max-width: 640px){

  /* Stack header: logo on top, address/details underneath */
  .hc-headtable,
  .hc-headtable tbody,
  .hc-headtable tr{
    display: block !important;
    width: 100% !important;
  }
  .hc-headtable td{
    display: block !important;
    width: 100% !important;
    border: 0 !important;
    padding: 0 !important;
  }
  .hc-headtable .logo{
    width: 100% !important;
    margin: 0 0 10px 0 !important;
  }
  .hc-headtable .logo img{
    display:block;
    max-width: 100%;
    height: auto;
  }
  .hc-headtable .details{
    padding-left: 0 !important;   /* remove desktop gutter */
    font-size: 13px;
    line-height: 1.45;
  }

  /* Show the collapsible toggle bar (JS inserts the element) */
  .hc-form-toggle{
    display:flex !important;
  }

  /* Stack table rows to blocks for easier reading */
  .hc-table,
  .hc-table thead,
  .hc-table tbody,
  .hc-table tr,
  .hc-table th,
  .hc-table td{
    display:block; width:100%;
  }
  .hc-table tr{
    border: 1px solid var(--hc-border-strong);
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
  }
  .hc-table th{
    background: #f1f5f9;
    border-bottom: 1px solid var(--hc-border-strong);
    width: 100%;
    font-size: 14px;
  }
  .hc-table td{ border:none; padding: 10px; }

  .hc-photos{ grid-template-columns: repeat(2, 1fr); }
  .hc-photos .hc-photo img{ height: 120px; }
}

/* ---------- Print (certificate view only) ---------- */
@media print{
  @page{ size: A4 portrait; margin: 10mm; }
  body{ background: #fff; }
  .hc-form,
  .hc-post-actions{ display:none !important; }
  .hc-print-view{
    display:block !important;
    width: 170mm;
    transform: scale(0.98);
    transform-origin: top left;
  }
  /* cleaner print borders */
  .hc-table, .hc-table th, .hc-table td{ border: none !important; }
  .hc-table th{ background: transparent !important; }
  .hc-card{ border: none !important; box-shadow: none !important; }
}

/* ---------- Focus states (accessibility) ---------- */
.hc-input:focus,
.hc-textarea:focus,
.hc-select:focus,
.hc-actions button:focus,
.hc-form-toggle:focus{
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}
