/* =========================================================
   PTK DREAM CHAT
   Final Fixed Bottom + Balanced Bubble
========================================================= */

.ptk-dream-page{
  min-height:100vh;
  overflow:hidden;
}

.ptk-dream-chat{
  display:flex;
  flex-direction:column;
  height:100vh;
  max-width:900px;
  margin:0 auto;
  position:relative;
}

.ptk-dream-chat__messages{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
  overflow:hidden;
  padding:16px 0 110px;
}

#chat-box{
  flex:1;
  min-height:0;
  overflow-y:auto;
  padding:10px 0;
  scroll-behavior:smooth;
}

/* =========================
   MESSAGE
========================= */
.ptk-dream-message{
  width:fit-content;
  max-width:100%;
  min-width:120px;
  padding:12px 14px;
  margin:8px 0;
  border-radius:14px;
  line-height:1.7;
  word-wrap:break-word;
  overflow-wrap:break-word;
  box-sizing:border-box;
}

.ptk-dream-message--user{
  margin-left:auto;
  background:#1a1a1a;
  color:#fff;
  text-align:right;
  border:1px solid rgba(255,255,255,.06);
}

.ptk-dream-message--bot{
  margin-right:auto;
  background:#111;
  color:#f3f3f3;
  text-align:left;
  border-left:3px solid var(--ptk-gold, #c49a3d);
  border-top:1px solid rgba(255,255,255,.05);
  border-right:1px solid rgba(255,255,255,.05);
  border-bottom:1px solid rgba(255,255,255,.05);
}

.ptk-dream-message--bot a,
.ptk-dream-message--user a{
  color:var(--ptk-gold-soft, #f5d061);
  text-decoration:none;
}

.ptk-dream-message--bot a:hover,
.ptk-dream-message--user a:hover{
  text-decoration:underline;
}

/* =========================
   STATUS
========================= */
.ptk-chat-status{
  margin:0 0 12px;
  padding:10px 12px;
  border-radius:12px;
  font-size:14px;
  line-height:1.5;
  border:1px solid rgba(255,255,255,.08);
  background:#161616;
  color:#e5e7eb;
}

.ptk-chat-status[data-type="success"]{
  background:rgba(16,185,129,.10);
  border-color:rgba(16,185,129,.28);
  color:#d1fae5;
}

.ptk-chat-status[data-type="error"]{
  background:rgba(225,29,72,.10);
  border-color:rgba(225,29,72,.28);
  color:#ffe4e6;
}

.ptk-chat-status[data-type="info"]{
  background:rgba(196,154,61,.10);
  border-color:rgba(196,154,61,.20);
  color:#f8edcf;
}

/* =========================
   INPUT AREA
========================= */
.ptk-dream-chat__input{
  position:fixed;
  bottom:0;
  left:50%;
  transform:translateX(-50%);
  width:95%;
  max-width:900px;
  z-index:1000;
  padding:14px 0 calc(14px + env(safe-area-inset-bottom));
  backdrop-filter:blur(12px);
  border-top:0px solid rgba(255,255,255,.05);
}

.ptk-dream-chat__input form,
#chat-form{
  display:flex;
  gap:10px;
  align-items:center;
  width:100%;
}

.ptk-dream-chat__input input[type="text"],
#user-input{
  flex:1;
  width:100%;
  min-width:0;
  min-height:46px;
  padding:0 14px;
  border-radius:14px;
  border:0px solid rgba(255,255,255,.08);
  background:#212121;
  color:#fff;
  outline:none;
  box-sizing:border-box;
  transition:border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.ptk-dream-chat__input input[type="text"]::placeholder,
#user-input::placeholder{
  color:rgba(255,255,255,.45);
}

.ptk-dream-chat__input input[type="text"]:focus,
#user-input:focus{
  border-color:rgba(196,154,61,.45);
  box-shadow:0 0 0 3px rgba(196,154,61,.12);
  background:#1b1b1b;
}

.ptk-dream-chat__input button,
#chat-form button{
  flex:0 0 auto;
  min-height:46px;
  padding:0 18px;
  border:0;
  border-radius:14px;
  background:var(--ptk-gold, #c49a3d);
  color:#111;
  font-weight:700;
  cursor:pointer;
  transition:transform .18s ease, opacity .18s ease, box-shadow .18s ease;
  box-shadow:0 8px 22px rgba(196,154,61,.18);
}

.ptk-dream-chat__input button:hover,
#chat-form button:hover{
  opacity:.95;
}

.ptk-dream-chat__input button:active,
#chat-form button:active{
  transform:translateY(1px);
}

/* =========================
   NUMBER PICKER
========================= */
.ptk-number-picker-wrap{
  margin:12px 0 4px;
  padding:14px;
  border-radius:14px;
  background:#111;
  border:1px solid rgba(255,255,255,.06);
}

.ptk-number-picker-title{
  margin:0 0 10px;
  font-size:14px;
  font-weight:700;
  color:#f5f5f5;
  line-height:1.5;
}

.ptk-number-chip-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 12px;
}

button.ptk-number-chip{
  min-height:36px;
  padding:6px 12px;
  border-radius:999px;
  border:1px solid #444 !important;
  background:#1b1b1b !important;
  color:#fff !important;
  cursor:pointer;
  margin:0;
  transition:.2s ease;
  box-sizing:border-box;
  font-size:14px;
  line-height:1.2;
}

button.ptk-number-chip:hover{
  border-color:var(--ptk-gold, #c49a3d) !important;
}

button.ptk-number-chip.is-selected,
.ptk-number-chip.is-selected{
  background:var(--ptk-gold, #c49a3d) !important;
  color:#111 !important;
  border-color:var(--ptk-gold, #c49a3d) !important;
  transform:scale(1.05);
}

.ptk-number-save-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:8px 14px;
  border:0;
  border-radius:12px;
  background:var(--ptk-gold, #c49a3d);
  color:#111;
  font-size:14px;
  font-weight:700;
  cursor:pointer;
  transition:opacity .18s ease, transform .18s ease;
}

.ptk-number-save-btn:hover{
  opacity:.95;
}

.ptk-number-save-btn:disabled{
  opacity:.65;
  cursor:not-allowed;
}

.ptk-number-picker-note{
  margin-top:10px;
  font-size:12px;
  line-height:1.6;
  color:#bdbdbd;
}

/* =========================
   DREAM STATS
========================= */
.dream-stats{
  margin:15px 0;
  padding:10px 12px;
  background:#111;
  color:#fff;
  border:1px solid rgba(255,255,255,.06);
  border-radius:12px;
  font-size:14px;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.ds-btn{
  border:none;
  background:#222;
  color:#fff;
  padding:6px 10px;
  border-radius:8px;
  cursor:pointer;
}

.ds-btn:hover{
  background:#333;
}

.ds-views{
  font-weight:700;
}

/* =========================
   HISTORY CARD
========================= */
.ptk-dream-history-card.is-starred{
  border-color:rgba(196,154,61,.35);
  box-shadow:0 0 0 1px rgba(196,154,61,.14);
}

/* =========================
   SCROLLBAR
========================= */
#chat-box::-webkit-scrollbar{
  width:8px;
}

#chat-box::-webkit-scrollbar-track{
  background:transparent;
}

#chat-box::-webkit-scrollbar-thumb{
  background:rgba(255,255,255,.14);
  border-radius:999px;
}

#chat-box::-webkit-scrollbar-thumb:hover{
  background:rgba(255,255,255,.22);
}

/* =========================
   MOBILE
========================= */
@media (max-width: 768px){
  .ptk-dream-chat{
    height:100vh;
  }

  .ptk-dream-chat__messages{
    padding:12px 0 170px;
  }

  #chat-box{
    padding:8px 0;
  }

  .ptk-dream-message{
    max-width:100%;
    min-width:96px;
    font-size:14px;
    padding:11px 12px;
    border-radius:12px;
  }

  .ptk-dream-chat__input{
    width:100%;
    max-width:none;
    left:0;
    transform:none;
    bottom:calc(var(--ptk-bottom-nav-h, 64px) + 6px);
    padding:12px 10px calc(12px + env(safe-area-inset-bottom));
  }

  .ptk-dream-chat__input form,
  #chat-form{
    gap:8px;
  }

  .ptk-dream-chat__input input[type="text"],
  #user-input{
    min-height:44px;
    font-size:16px;
  }

  .ptk-dream-chat__input button,
  #chat-form button{
    min-height:44px;
    padding:0 14px;
    font-size:14px;
  }

  .ptk-number-picker-wrap{
    padding:12px;
  }

  .ptk-number-chip-list{
    gap:6px;
  }

  button.ptk-number-chip{
    min-height:34px;
    padding:6px 10px;
    font-size:13px;
  }
}