/*
Theme Name: Kwitansi Theme
Theme URI: http://example.com/
Author: Generated by ChatGPT
Description: Responsive WordPress theme for creating printable kwitansi (receipts) with preview and PDF.
Version: 1.0
License: GNU General Public License v2 or later
Text Domain: kwitansi-theme
*/

:root{
  --accent:#2563eb;
  --muted:#6b7280;
  --card:#ffffff;
  --bg:#f3f4f6;
}

html,body{
  height:100%;
}

body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,"Helvetica Neue",Arial;
  background:var(--bg);
  color:#111827;
}

.wrap{
  max-width:1100px;
  margin:24px auto;
  padding:16px;
}

/* Header */
header.site-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

header .brand{
  display:flex;
  gap:12px;
  align-items:center;
}

header .brand h1{
  font-size:1.25rem;
  margin:0;
}

/* Card */
.card{
  background:var(--card);
  border-radius:12px;
  padding:16px;
  box-shadow:0 6px 18px rgba(15,23,42,0.06);
}

/* Form controls */
.controls{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:12px;
}

label{
  display:block;
  font-size:0.9rem;
  margin-bottom:6px;
  color:var(--muted);
}

input[type="text"],
input[type="number"],
textarea,
select{
  width:100%;
  padding:10px 12px;
  border-radius:8px;
  border:1px solid #e5e7eb;
  font-size:0.95rem;
  box-sizing:border-box;
}

/* Rows */
.row{
  display:flex;
  gap:12px;
}

.row .col{
  flex:1;
}

/* Actions */
.actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:12px;
}

button{
  background:var(--accent);
  color:white;
  padding:10px 14px;
  border-radius:8px;
  border:0;
  font-weight:600;
  cursor:pointer;
}

button.ghost{
  background:transparent;
  color:var(--accent);
  border:1px solid rgba(37,99,235,0.18);
}

.small{
  padding:8px 10px;
  font-size:0.9rem;
}

/* Receipt preview */
#receiptPreview{
  margin-top:18px;
  padding:18px;
  border-radius:10px;
  background:white;
  border:1px solid #e6eefc;
}

.receipt{
  max-width:720px;
  margin:0 auto;
  font-family: "Times New Roman", serif;
  color:#111827;
}

.receipt .head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:8px;
}

.receipt .head img.logo{
  max-width:180px;
  width:100%;
  height:auto;
  object-fit:contain;
}

.receipt h2{
  margin:0;
  font-size:1.1rem;
  text-align:center;
}

.receipt .meta{
  font-size:0.9rem;
  margin-bottom:8px;
}

.receipt .line{
  border-top:1px solid #d1d5db;
  margin:8px 0;
}

.receipt .table{
  width:100%;
  font-size:1rem;
  margin-top:8px;
}

.receipt .table td{
  padding:6px 4px;
  vertical-align:top;
}

.receipt .amount{
  font-weight:700;
  font-size:1.05rem;
}

.signature{
  margin-top:28px;
  text-align:right;
}

.signature .name{
  display:block;
  margin-top:60px;
  font-weight:700;
}

/* ================================
   RESPONSIVE 
   ================================ */
@media (max-width:720px){
  .controls{
    grid-template-columns:1fr;
  }
  .row{
    flex-direction:column;
  }
}

/* ======================================
   LOGO FIX — AGAR TIDAK MENCONG DI HP
   ====================================== */
.receipt .head img.logo{
  max-width:180px;
  max-height:80px;   /* pembatas tinggi logo */
  width:auto;
  height:auto;
  object-fit:contain;
  display:block;
}

/* ================================
   PRINT STYLES
   ================================ */
@media print{
  body *{visibility:visible;}
  #receiptPreview,
  #receiptPreview *{
    visibility:visible;
  }
  #receiptPreview{
    position:fixed;
    left:0;
    top:0;
    width:100%;
  }
  .no-print{
    display:none;
  }
}
/* ===== PREVIEW RESPONSIVE UNTUK HP ===== */
@media (max-width: 480px) {

  #previewArea, 
  .preview-container, 
  .receipt {
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px !important;
    overflow-x: hidden !important;
  }

  .receipt .head {
    flex-direction: column !important;
    text-align: center !important;
    align-items: center !important;
  }

  .receipt .head > div {
    width: 100% !important;
    margin-bottom: 8px;
  }

  .receipt img.logo {
    max-width: 120px !important;
    height: auto !important;
  }

  .receipt table {
    width: 100% !important;
    font-size: 0.85rem !important;
  }

  .receipt table td,
  .receipt table th {
    padding: 4px !important;
  }
}