:root{ --brand:#5e3bee; --gold:#ffd65a; --bg:#fafafa; }
*{box-sizing:border-box}
body{margin:0;font-family:'Kanit',sans-serif;background:var(--bg);color:#2a2a2a}
nav{display:flex;align-items:center;justify-content:space-between;padding:12px 18px;background:var(--brand);color:#fff}
nav .logo{font-weight:700;font-size:20px}
nav a{color:#fff;text-decoration:none;margin-left:16px}
.wrapper{display:grid;grid-template-columns:360px 1fr;gap:18px;padding:18px;align-items:start}
.sidebar{background:#fff;border-radius:14px;box-shadow:0 6px 16px rgba(0,0,0,.08);padding:18px;position:relative}
.sidebar h3{margin:0 0 12px 0;font-size:18px}
.label{font-weight:600;margin:10px 0 6px}
.input, .textarea, select{width:100%;border:1px solid #e8e8e8;border-radius:10px;padding:10px 12px;font:inherit}
.helper{color:#888;font-size:13px;margin-top:6px}
.stage{display:flex;flex-direction:column;align-items:center;gap:12px}
canvas#posterCanvas{width:100%;max-width:620px;height:auto;border:1px solid #e5e5e5;border-radius:14px;background:#f1f1f1}
.actions{display:flex;gap:10px;width:100%;max-width:620px}
.btn{flex:1;border:none;border-radius:10px;padding:12px 14px;color:#fff;font-weight:600;cursor:pointer;transition:.2s}
.btn:active{transform:translateY(1px)}
.btn-free{background:#7b7b7b}.btn-free:hover{background:#6a6a6a}
.btn-premium{background:linear-gradient(45deg,#8e2de2,#4a00e0)}.btn-premium:hover{opacity:.92}
.mobile-toggles{display:none;position:sticky;bottom:10px;gap:8px;width:100%;max-width:620px}
.toggle-btn{flex:1;border:none;border-radius:10px;padding:10px 12px;background:#fff;color:#333;font-weight:600;box-shadow:0 6px 14px rgba(0,0,0,.1);cursor:pointer}
.hidden{display:none !important}

/* Cropper modal */
.modal{position:fixed;inset:0;background:rgba(0,0,0,.6);display:none;align-items:center;justify-content:center;padding:18px;z-index:9999}
.modal.active{display:flex}
.modal-card{background:#111;border-radius:16px;padding:12px;max-width:96vw;width:860px;color:#fff;box-shadow:0 10px 28px rgba(0,0,0,.4)}
.modal-header{display:flex;justify-content:space-between;align-items:center;padding:6px 10px}
.modal-body{background:#000;border-radius:12px;overflow:hidden}
.modal-body img{max-width:100%;display:block}
.modal-actions{display:flex;gap:10px;justify-content:flex-end;padding:10px}
.btn-ghost{background:#333;color:#fff;border:none;border-radius:10px;padding:10px 14px;cursor:pointer}
.btn-gold{background:var(--gold);color:#222;border:none;border-radius:10px;padding:10px 14px;cursor:pointer;font-weight:700}

/* Skins popup */
.skins-modal .modal-card{background:#141414}
.skins-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:10px;padding:10px}
.skin-item{position:relative;border-radius:10px;overflow:hidden;border:2px solid transparent;cursor:pointer;background:#222}
.skin-item img{width:100%;height:100%;object-fit:cover;display:block;aspect-ratio:1/1}
.skin-item.selected{border-color:var(--gold)}
.skin-item .tick{position:absolute;top:6px;right:6px;background:var(--gold);color:#222;font-weight:800;border-radius:50%;width:26px;height:26px;display:flex;align-items:center;justify-content:center;font-size:14px}

/* Desktop: modal scrollable (ไม่ล้นจอ) */
@media (min-width:961px){
  .skins-modal .modal-card{max-height:90vh;display:flex;flex-direction:column;overflow:hidden}
  .skins-modal .modal-body{flex:1;overflow:auto}
  .skins-grid{overflow:auto}
}

/* Preview selected skins */
.preview-header{display:flex;align-items:center;justify-content:space-between;margin-top:14px}
.range{width:58%}
.preview-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px;margin-top:10px;background-color: #f1eded;}
.preview-item{position:relative;border:2px dashed #ccc;border-radius:10px;overflow:hidden;background:#fafafa;cursor:grab}
.preview-item img{width:100%;height:100%;object-fit:cover;display:block;aspect-ratio:1/1}
.badge {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    background: rgb(0 0 0);
    color: #fff;
    font-size: 12px;
    padding: 0px 4px;
    border-radius: 999px;
}
.del {
    position: absolute;
    top: -5px;
    right: -1px;
    background: #ff4d4f;
    color: #fff;
    border: 2px solid #fff;
    /* border-radius: 50%; */
    /* padding: 3px 8px; */
    font-weight: 700;
    cursor: pointer;
    /*z-index: 1;*/
}

.preview-item.dragging{opacity:.6;outline:2px dashed #5e3bee}

/* Responsive */
@media (max-width:960px){
  .wrapper{grid-template-columns:1fr}
  .sidebar{display:none}
  .mobile-toggles{display:flex;margin-top:6px}
}


.dropdown-container { position: relative; }
.dropdown-list {
  position: absolute;
  top: 100%; left: 0; right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,.1);
  z-index: 50;
  display: none;
}
.dropdown-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 15px;
}
.dropdown-item:hover { background: #f2f2f2; }


.popup-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex; justify-content: center; align-items: center;
  z-index: 10000;
}
.popup-box {
  background: #fff;
  width: 330px;
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  font-family: 'Kanit', sans-serif;
  box-shadow: 0 4px 30px rgba(0,0,0,.4);
  animation: zoomIn .2s ease;
}
.popup-header {
  background: #007aff;
  padding: 10px;
}
.popup-body { padding: 15px; }
.popup-footer { padding: 10px 0; border-top:1px solid #eee; }
.btn-cancel {
  background:#ddd; border:none; padding:6px 14px;
  font-size:15px; border-radius:6px; cursor:pointer;
}
.btn-cancel:hover { background:#bbb; }
.hidden { display:none; }
@keyframes zoomIn {
  from { transform: scale(.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.pay-option {
  border:none;
  font-size:16px;
  padding:12px;
  border-radius:8px;
  font-weight:600;
  cursor:pointer;
  transition: all .2s;
}
.pay-option:hover { filter: brightness(1.1); transform: scale(1.02); }

.canvas_qr {
  width: 90%;
  max-width: 300px;
  aspect-ratio: 1 / 1;
  margin: auto;
}
.canvas_qr canvas,
.canvas_qr img {
  width: 100% !important;
  height: auto !important;
}

</style>

<style>
.payment-container {
  font-family: 'Kanit', sans-serif;
  padding: 10px;
  color: #222;
}

.pay-logo {
  width: 120px;
  margin-bottom: 15px;
}

.pay-alert {
  background: #f1faff;
  border: 1px solid #b6e6ff;
  border-radius: 10px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 10px;
  box-shadow: 0 0 5px rgba(0,0,0,0.05);
}

.alert-icon {
  font-size: 20px;
  color: #007bff;
}

.alert-text {
  font-size: 14px;
  text-align: left;
  color: #0056b3;
}

.pay-info {
  margin: 8px 0 10px;
  font-size: 15px;
}

.pay-note {
  color: #e31d00;
  font-weight: 500;
}

.pay-channel {
  margin-top: 2px;
  color: #555;
}

.pay-timer {
  font-size: 22px;
  font-weight: 700;
  margin: 5px 0 10px;
  color: #5105e0;
}



.pay-amount {
  font-size: 17px;
  margin-top: 5px;
  font-weight: 600;
  color: #222;
}

.pay-auto {
  font-size: 13px;
  color: #777;
  margin-top: 5px;
}

.pay-footer {
  margin-top: 10px;
}

.cancel-btn {
  color: #555;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
}

.cancel-warning {
  color: #c13636;
  font-size: 13px;
  margin-top: 2px;
}


.btn-view {
  background: linear-gradient(90deg, #6f42c1, #a06cd5);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-weight: 600;
  padding: 10px 16px;
  width: 100%;
  transition: all 0.2s;
  z-index: 999;
}
.btn-view:hover {
  background: linear-gradient(90deg, #5a32a3, #8c56c0);
  transform: scale(1.03);
}

.container {
  max-width: 850px;     /* ความกว้างสูงสุดของคอนเทนต์ */
  margin: 0 auto;        /* จัดให้อยู่ตรงกลาง */
  padding: 20px;         /* เว้นขอบใน */
  background: #fff;      /* สีพื้นหลัง (เลือกใส่หรือไม่ก็ได้) */
  border-radius: 12px;   /* มุมโค้ง */
  box-shadow: 0 0 12px rgba(0,0,0,0.05); /* เงาบางๆ เพิ่มความลอย */
  
}


.container h1,h2,h3,p {
  font-size: 17px;
  }

  #img_preview {
  display: block;             /* ให้รูปอยู่คนเดียวในบรรทัด */
  max-width: 100%;            /* ไม่ให้รูปเกินขนาด container */
  height: auto;               /* ปรับความสูงอัตโนมัติ */
  border-radius: 10px;        /* มุมโค้งสวย ๆ */
  margin: 10px auto;          /* จัดให้อยู่ตรงกลาง */
  box-shadow: 0 0 8px rgba(0,0,0,0.1); /* เงาบาง ๆ ดูลอย */
  transition: transform 0.3s ease;
}



/* ✅ ปรับแต่งเพิ่มเติมสำหรับจอเล็ก */
@media (max-width: 768px) {
  #img_preview {
    max-width: 95%;
    border-radius: 8px;
  }
}

/* ✅ สำหรับจอใหญ่มาก */
@media (min-width: 1200px) {
  #img_preview {
    max-width: 500px;
  }
}
