/* ===== Reset & Base ===== */
/* 🌈 ตั้งค่า Global Font ทั้งแอป */
html,
body,
button,
input,
textarea,
select {
  font-family: 'Prompt', sans-serif !important;
  letter-spacing: 0.2px;
  color: #222;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Prompt', sans-serif !important;
  font-weight: 600;
}

p,
span,
label,
div {
  font-family: 'Prompt', sans-serif !important;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

#loginOverlay {
  display: none;
}


html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Prompt', sans-serif;
  background: #111;
  color: #f1f1f1;
  height: 100%;
  overflow-x: hidden;
  user-select: none;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: 80px;
  position: relative;
}

/* ===== Tab Navigation ===== */
.tab-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: #1e1e1e;
  border-bottom: 2px solid #ffffff;
  z-index: 99;
}

.tab-btn {
  flex: 1;
  padding: 14px 0;
  font-size: 1.05rem;
  color: #d8d8d8;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: 0.25s;
  font-weight: 600;
}

.tab-btn.active {
  color: #ffffff;
  border-bottom: 8px solid #0048ff;
}

/* ===== App Info ===== */
.app-info {
  padding: 80px 20px 0;
  text-align: center;
}

.app-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(45deg, #2f55ff, #ff3131);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-info p {
  margin: 6px 0;
  color: #595959;
}

button#logoutBtn {
  /* สไตล์เดิมของปุ่ม (ต้องมีอยู่แล้ว) */
  margin-top: 10px;
  background: #ff4444;
  border: none;
  padding: 4px 8px;
  font-size: 1.1rem;
  border-radius: 8px;
  border-right: 3px solid #98332c;
  border-bottom: 3px solid #98332c;
  font-weight: 600;
  color: white;
  cursor: pointer;

  /* *** คำสั่งใหม่เพื่อจัดตำแหน่ง *** */
  display: block;
  /* สำคัญ: เพื่อให้กำหนดความกว้าง/ตำแหน่งได้ */
  position: fixed;
  /* ทำให้ปุ่มลอยอยู่เหนืององค์ประกอบอื่น ๆ และไม่ขยับตามการเลื่อน */
  bottom: 40px;
  /* เว้นระยะจากขอบล่างของหน้าจอ 25 พิกเซล */
  left: 50%;
  /* เลื่อนจุดเริ่มต้นไปกึ่งกลางหน้าจอ */
  transform: translateX(-50%);
  /* ดึงปุ่มกลับมาทางซ้ายครึ่งหนึ่งของความกว้างตัวเอง (เพื่อให้ปุ่มอยู่ตรงกลางเป๊ะ) */
  z-index: 1000;
  /* ทำให้ปุ่มอยู่เหนือทุกอย่าง (เผื่อมีอะไรมาบัง) */
}

/* ===== Header Card ===== */
.header-card {
  margin: 20px;
  padding-right: 20px;
  padding-left: 20px;
  padding-top: 10px;
  padding-bottom: 10px;
  background: #222;
  border-radius: 16px;
  border-right: 3px solid #0ba100;
  border-bottom: 3px solid #0ba100;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

.header-card p {
  margin: 0 0 5px;
  font-weight: 600;
  color: #00d632;
  text-align: center;
}

.header-card { position: relative; text-align: center; }

.header-top {
  position: relative;
  height: 28px;            /* ความสูงบรรทัดหัวเรื่อง */
  margin-bottom: 6px;      /* ระยะห่างจากตัวเลขรวม */
}

/* 🎯 จับหัวเรื่องให้อยู่กลางการ์ดแบบไม่โดนปุ่มดัน */
.header-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  margin: 0;
  font-weight: 600;
  color: #00d832;
}

/* 🔇 ปุ่มไปชิดขวาบรรทัดเดียวกัน */
.mute-btn {
  position: absolute;
  right: -15px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.35rem;
  cursor: pointer;
  color: #fff;
  opacity: 0.9;
  transition: transform .2s ease, opacity .2s ease;
}
.mute-btn:active { transform: translateY(-50%) scale(1.1); opacity: .75; }

.header-card #todayRevenue {
  margin: -12px;
  font-size: 2rem;
  font-weight: 900;
  color: #ffffff;
}

.head-info {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 1rem;
  color: #c0c3c6;
}

/* ===== Input Section ===== */
.input-section {
  margin: 15px 20px;
}

.price-setting label {
  display: block;
  font-size: 1.1rem;
  color: #707070;
  margin-bottom: 4px;
  margin-top: -10px;
  text-align: center;
}

.price-setting input {
  width: 100%;
  padding: 1px;
  font-size: 1.8rem;
  font-weight: 700;
  border-radius: 8px;
  border: none;
  outline: none;
  background: #333;
  text-align: center;
  color: #ffffff;
}

/* ===== Long Press Button ===== */
.long-press-btn {
  width: 100%;
  margin-top: 16px;
  padding: 8px;
  background: linear-gradient(0deg, #0051ff, #0051ff);
  color: #ffffff;
  border: none;
  border-bottom: 4px solid #1e2cc5;
  border-radius: 12px;
  font-size: 1.9rem;
  font-weight: 800;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.1s ease;
}

.long-press-btn:active {
  transform: scale(0.95);
}

.press-hint {
  display: block;
  font-size: 0.75rem;
  color: #d6d6d6;
  opacity: 0.8;
  margin-top: 0px;
}

/* ===== History Section ===== */
.history-controls {
  text-align: center;
  margin-top: 80px;
  padding: 10px 20px;

}

.date-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

.date-filter input[type="date"] {
  background: #333;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1rem;
}

.history-item {
  margin: 5px 20px;
  padding: 12px;
  background: #222;
  border-radius: 10px;
  border-top: 3px solid #0062ff;

  cursor: pointer;
  transition: 0.25s;
}

.history-item:hover {
  background: #2e2e2e;
}

.history-item .date {
  font-weight: 700;
  font-size: 1.05rem;
  color: #daf0ff;
}

.history-item .details {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 1rem;
  color: #c3c3c3;
}

/* ===== Sub Records ===== */
.record-sublist {
  margin: 20px 20px;
  margin-top: 10px;
  padding: 18px;
  border-bottom: 3px solid #4d4d4d;
  border-left: 3px solid #4d4d4d;
  border-right: 3px solid #4d4d4d;
  background: rgb(21, 21, 21);
  border-radius: 8px;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.click-hint {
  display: block;
  text-align: center;
  color: #a9a9a9;
  font-size: 0.9rem;
  margin-top: 4px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.history-item:hover .click-hint {
  opacity: 1;
  color: #ff9100;
}

.record-sublist.open {
  display: flex;
}

.record-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ccc;
  font-size: 0.95rem;
}

.delete-btn {
  background: #ff4444;
  border: none;
  color: #fff;
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  transition: 0.2s;
}

.delete-btn:hover {
  background: #e63636;
}

/* ===== Confirm Dialog ===== */
.confirm-dialog {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.801);
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.confirm-box {
  background: #222;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  width: 80%;
  max-width: 320px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.207);
}

.confirm-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.confirm-buttons button {
  flex: 1;
  margin: 0 6px;
  padding: 4px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.2rem;
  cursor: pointer;
}

#confirmYes {
  background: #ff4444;
  color: #fff;
}

#confirmNo {
  background: #00aa3b;
  color: #eee;
}

#logoutYes {
  background: #ff4d4f;
  color: #fff;
}

#logoutYes:hover {
  background: #be3934;
}

#logoutNo {
  background: #f3f3f3;
}

#logoutNo:hover {
  background: #9af0ff;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
}

/* ===== Login Overlay ===== */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.119);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.login-box {
  background: #242424;
  border-radius: 16px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 340px;
  animation: popIn 0.3s ease;
}

.login-box h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
}

.login-box h3 {
  margin: 6px 0 18px;
  font-size: 1.2rem;
  font-weight: 500;
  color: #71acff;
}

/* ปุ่ม Google */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff0f0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  padding: 10px 16px;
  width: 100%;
  cursor: pointer;
  transition: 0.2s;
}

.google-btn:hover {
  background: #d4f2ff;
  border-color: #bbb;
}

.google-btn img {
  width: 22px;
  height: 22px;
}

/* Animation */
@keyframes popIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

body,
.login-box {
  font-family: 'Prompt', sans-serif;
}

.login-note {
  color: #aaa;
  font-size: 0.85rem;
  margin-top: 10px;
}

/* ===== Footer Credit ===== */
.footer-credit {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: #777;
}

.footer-credit a {
  color: #0055ff;
  text-decoration: none;
}

.mode-tabs {
  display: flex;
  justify-content: space-between;
  background: var(--bg-card);
  border-radius: 8px;
  border-right: 3px solid #232323;
  border-bottom: 3px solid #232323;
  overflow: hidden;
  margin-bottom: 12px;
  margin-top: 10px;
}

.mode-btn {
  flex: 1;
  padding: 10px 0;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--primary-action);
  color: #fff;
}

#filterArea {
  text-align: center;
  margin-bottom: 12px;
}

#filterArea input {
  background: #ebebeb;
  color: #111;
  border: 1px solid #909090;
  border-radius: 6px;
  border-bottom: 3px solid #9e9e9e;
  padding: 2px 10px;
  font-size: 1em;
  text-align: center;
}

.mode-btn {
  padding: 2px 14px;
  border: none;
  border-radius: px;
  background: #323232;
  color: #ccc;
  font-weight: 500;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.25s ease;
}

.mode-btn.active {
  background: #005eff;
  color: #fff;
  font-weight: 700;

  box-shadow: #00d832;
}

.year-dropdown {
  font-size: 0.9rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: #eeeeee;
  color: #1e1e1e;
  border-bottom: 4px solid #a4a4a4;
  outline: none;
  cursor: pointer;
  transition: 0.2s;
}

.year-dropdown:hover {
  border-color: #989898;
  background: #e6e6e6;
}

/* เอฟเฟกต์ตอนกดเพิ่มหัว */
.add-head-anim {
  position: relative;
  animation: pulseScale 0.2s ease, flashGlow 0.4s ease;
}

@keyframes pulseScale {
  0% {
    transform: scale(1);
  }

  40% {
    transform: scale(1.15);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes flashGlow {
  0% {
    box-shadow: 0 0 0px rgba(255, 255, 255, 0);
  }

  30% {
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
  }

  100% {
    box-shadow: 0 0 0px rgba(255, 255, 255, 0);
  }
}

.ai-summary {
  margin-top: 12px;
  margin-left: 22px;
  margin-right: 22px;
  padding: 10px 14px;
  border-left: 2px solid #b3b3b3;
  border-right: 2px solid #b3b3b3;
  border-bottom: 2px solid #b3b3b3;
  background: #1c1c1c;
  border-radius: 10px;
  color: #ffffff;
  font-weight: 600;
  font-size: 0.95rem;
  transition: 0.3s;
}

.ai-summary.talk {
  transform: scale(1.05);
  background: #2a2a2a;
}

.install-banner {
  position: fixed;
  top: -120px; /* เริ่มซ่อนอยู่ข้างบน */
  left: 50%;
  width: 90%;
  max-width: 600px; 
  transform: translateX(-50%);
  background: #eeeeee;
  color: #222222;
  padding: 6px 10px;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  font-weight: 600;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  transition: top 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.5s;
  opacity: 0;
}

.install-banner.show {
  top: 0; /* เลื่อนลงมาจากบนจอ */
  opacity: 1;
}

.install-banner button {
  background: #005ef6;
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}

.install-banner button:hover {
  background: #ffa733;
}

