/* widget/widget.css */
#cc-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  color: white;
  font-size: 22px;
}

#cc-panel {
  position: fixed;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: min(380px, calc(100vw - 36px));
  height: min(560px, calc(100dvh - 140px - env(safe-area-inset-bottom)));
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  background: #0f0f12;
  color: #eaeaf0;
  overflow: hidden;
  flex-direction: column;
  display: none;
}

#cc-header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

#cc-title {
  font-weight: 700;
  font-size: 14px;
}

#cc-subtitle {
  font-size: 12px;
  opacity: 0.8;
}

#cc-close {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #eaeaf0;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  cursor: pointer;
}

#cc-messages {
  padding: 12px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.cc-bubble {
  max-width: 84%;
  padding: 10px 12px;
  border-radius: 14px;
  margin: 8px 0;
  line-height: 1.25;
  font-size: 14px;
  white-space: pre-wrap;
}

.cc-bot {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-left-radius: 6px;
}

.cc-user {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top-right-radius: 6px;
}

#cc-controls {
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

/* =========================================================
   iPhone-safe quick buttons scroller
   - #cc-quick is the scroll container (block)
   - inner .cc-quick-row is inline-flex nowrap
   - Done/Clear can be sticky on the right
   ========================================================= */
#cc-quick {
  display: block;
  margin-bottom: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

#cc-quick .cc-quick-row {
  display: inline-flex;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  align-items: center;
  padding-right: 6px; /* breathing room for sticky buttons */
}

#cc-quick .cc-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

#cc-quick::-webkit-scrollbar {
  height: 8px;
}
#cc-quick::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

/* Sticky action buttons (applied by JS via classes) */
#cc-quick .cc-btn.cc-sticky-done {
  position: sticky;
  right: 0;
  z-index: 3;
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
}

#cc-quick .cc-btn.cc-sticky-clear {
  position: sticky;
  right: 84px; /* sits just left of Done */
  z-index: 3;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.1);
}

.cc-btn {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #eaeaf0;
  padding: 8px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
}

.cc-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

#cc-inputrow {
  display: flex;
  gap: 8px;
}

#cc-input {
  flex: 1;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.25);
  color: #eaeaf0;
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}

#cc-send {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  color: white;
  font-weight: 700;
}

#cc-hint {
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.75;
}

/* =========================================================
   iPhone viewport sizing fixes
   - Use 100dvh to handle Safari address bar
   - Make panel wider and taller on small screens
   ========================================================= */
@media (max-width: 480px), (max-height: 700px) {
  #cc-panel {
    right: 10px;
    left: 10px;
    width: auto;
    bottom: calc(76px + env(safe-area-inset-bottom));
    height: calc(100dvh - 110px - env(safe-area-inset-bottom));
    border-radius: 14px;
  }

  #cc-controls {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}
