/* chat_c1.css - Main chat interface styles */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

body {
  font-family: Helvetica, sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* ========== HEADER ========== */
header {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 10;
  height: 70px; /* Set explicit height to eliminate gaps */
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
}

.header-right {
  flex-direction: column;
  align-items: flex-end;
}

.logo {
  max-height: 40px;
  max-width: 100%;
  height: auto;
  width: auto;
}

.title-line {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex: 1;
  min-width: 0;
}

.title {
  font-size: 22px;
  font-weight: normal;
}

.model-cost-line {
  font-size: 12px;
  color: #4caf50;
  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 0px;
  justify-content: flex-end;
  padding-right: 0;
  margin-top: 4px;
  word-break: break-word;
}

.session-cost-label {
  color: green;
  white-space: nowrap;
  text-align: right;
  padding-right: 0;
  font-weight: normal;
}

/* ========== MAIN CONTENT ========== */
main {
  flex: 1;
  margin-top: 70px; /* Match header height exactly */
  overflow-y: auto;
  padding: 20px 20px 80px;
  scroll-behavior: smooth;
}

.info-text {
  color: #666;
  margin-bottom: 20px;
}

.chat-window {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ========== CHAT BUBBLES ========== */
.bubble {
  max-width: 70%;
  padding: 10px;
  border-radius: 10px;
  position: relative;
}

.bubble.user {
  background: #eee;
  align-self: flex-end;
  text-align: right;
}

.bubble.bot {
  background: none;
  align-self: flex-start;
  text-align: left;
}

.text {
  margin: 0;
}

.cost {
  font-size: 12px;
  color: green;
  margin-bottom: 5px;
}

.bubble.user .cost {
  text-align: right;
}

.bubble.bot .cost {
  text-align: right;
}

/* ========== FOOTER / INPUT ========== */
footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  padding: 0 7px 10px 5px;
  display: flex;
  justify-content: center;
  background: transparent;
  box-shadow: none;
}

form {
  display: flex;
  align-items: center;
  width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  width: 100%;
  padding: 5px 10px;
}

textarea {
  flex: 1;
  padding: 14px 10px;
  font-size: 16px;
  line-height: 20px;
  resize: none;
  border: none;
  border-radius: 30px;
  outline: none;
  max-height: 150px;
  min-height: 20px;
}

textarea::placeholder {
  font-size: 16px;
  color: #aaa;
}

button,
.icon-button {
  background: transparent;
  border: none;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

button svg,
.icon-button svg {
  width: 20px;
  height: 20px;
  transition: color 0.2s ease;
}

/* Predefined button states */
.icon-button {
  background-color: #f0f0f0;  /* Light gray background by default */
}

.icon-button svg {
  color: #666;  /* Gray icon */
}

.icon-button:hover,
.icon-button.hover {
  background-color: #333;  /* Dark background on hover */
}

.icon-button:hover svg,
.icon-button.hover svg {
  color: #fff;  /* White icon on hover */
}

/* Send button states */
#sendButton {
  background-color: #f0f0f0;  /* Light gray background when disabled */
}

#sendButton svg {
  color: #999;  /* Gray arrow when disabled */
}

#sendButton.active {
  background-color: #000;  /* Black background when active */
}

#sendButton.active svg {
  color: #fff;  /* White arrow when active */
}

#sendButton:disabled {
  cursor: not-allowed;
}

/* Disabled button states */
.button-disabled {
  background-color: #e0e0e0 !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

.button-disabled svg {
  color: #888 !important;
}

.button-disabled:hover {
  background-color: #e0e0e0 !important;
}

.button-disabled:hover svg {
  color: #888 !important;
}

/* ========== PREDEFINED PROMPTS POPUP ========== */
.predefined-popup {
  position: absolute;
  z-index: 999;
  background: #fff;
  padding: 18px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
  max-width: 420px;
  width: 90vw;
  font-size: 15px;
  max-height: 70vh;
  overflow-y: auto;
  line-height: 1.55;
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: flex-start;
}

.predefined-popup.visible {
  opacity: 1;
  transform: scale(1);
}

.predefined-line {
  display: inline-block;
  background: #f7f9fa;
  color: #23272f;
  padding: 9px 20px;
  border-radius: 22px;
  margin: 6px 6px 6px 0;
  font-size: 15px;
  cursor: pointer;
  transition: 
    background 0.14s, 
    color 0.14s, 
    border 0.14s, 
    box-shadow 0.14s;
  outline: none;
  min-width: 0;
  max-width: 100%;
  box-shadow: 0 2px 8px rgba(30, 34, 40, 0.03);
  border: 1px solid #e2e5ea;
  white-space: pre-line;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.predefined-line:hover,
.predefined-line:focus {
  background: #e9ecef;
  color: #181c22;
  border-color: #d2d7df;
  box-shadow: 0 3px 12px rgba(40, 44, 52, 0.06);
}

/* ========== INFO CARD (for demo page) ========== */
.info-card {
  max-width: 720px;
  margin: 10px auto 24px auto;
  box-shadow: 0 2px 14px #0001;
  border-radius: 16px;
  background: #fff;
  padding: 34px 36px 24px 36px;
}

.info-card .prototype-ribbon {
  display: inline-block;
  background: #fae2e2;
  color: #c00;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  padding: 3px 16px 2px 16px;
  margin-bottom: 4px;
  letter-spacing: 0.01em;
}

.info-card .info-title {
  font-size: 1.6em;
  font-weight: 700;
  color: #444;
  margin-bottom: 7px;
}

.info-card .info-intro {
  font-size: 1.12em;
  color: #444;
  margin-bottom: 12px;
}

.info-card .keyboard-hint {
  font-size: 15px;
  color: #444;
  margin-bottom: 11px;
  text-align: right;
}

.info-card .keyboard-hint kbd {
  display: inline-block;
  font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-size: 1em;
  padding: 2px 8px;
  background: #f5f5f7;
  border: 1px solid #ccc;
  border-radius: 6px;
  color: #222;
  margin: 0 2px;
  font-weight: 500;
  box-shadow: 0 1px 2px #0001;
}

.ai-demo-btn {
  display: inline-block;
  margin-top: 6px;
  background: #2563eb;
  color: #fff !important;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 1.04rem;
  text-decoration: none;
  font-weight: 600;
  box-shadow: 0 1px 6px 0 rgba(28,76,220,0.09);
  transition: background 0.18s;
}

.ai-demo-btn:hover {
  background: #194bc3;
}

.cta-button {
  text-align: center;
  margin-top: 2px;
}

.privacy-note {
  font-size: 12.7px;
  color: #888;
  margin-bottom: 5px;
  margin-top: 20px;
  text-align: left;
}

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 600px) {
  header {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    height: 60px; /* Adjust header height for mobile */
  }

  main {
    margin-top: 60px; /* Match mobile header height */
  }

  .header-left {
    flex-shrink: 0;
    max-width: 30%;
  }

  .header-right {
    flex: 1;
    align-items: flex-end;
  }

  .logo {
    height: 38px !important;
    width: auto !important;
    max-width: 100% !important;
    object-fit: contain;
  }

  .title-line {
    align-items: flex-end;
    text-align: right;
  }

  .title {
    font-size: 18px;
  }

  .model-cost-line {
    flex-direction: column;
    align-items: flex-end;
  }

  .predefined-popup {
    max-width: 98vw;
    padding: 12px 8px;
    font-size: 14px;
  }
  
  .predefined-line {
    padding: 8px 10px;
    font-size: 14px;
  }
}

/* When cost has memo-updating class, keep right alignment with inline layout */
.cost.memo-updating {
  text-align: right !important;
}

/* ========== MEMO UPDATE SPOTLIGHT EFFECT ========== */
.memo-wave-text {
  font-size: 14px;
  color: #666;
  font-style: italic;
  display: inline;
  margin-right: 10px;
  position: relative;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.memo-wave-text::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: #fff;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(
    90deg,
    rgba(0,0,0,0) calc(50% - 15%),
    rgba(0,0,0,1) 50%,
    rgba(0,0,0,0) calc(50% + 15%)
  );
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 200% 100%;
  -webkit-mask-position: -200% 0;
  mask-image: linear-gradient(
    90deg,
    rgba(0,0,0,0) calc(50% - 15%),
    rgba(0,0,0,1) 50%,
    rgba(0,0,0,0) calc(50% + 15%)
  );
  mask-repeat: no-repeat;
  mask-size: 200% 100%;
  mask-position: -200% 0;
  opacity: 1;
  animation: memoSpotlight 5s linear infinite;
}

@keyframes memoSpotlight {
  0% { 
    -webkit-mask-position: -150% 0; 
    mask-position: -150% 0; 
  }
  40% { 
    -webkit-mask-position: 150% 0; 
    mask-position: 150% 0; 
  }
  50% { 
    -webkit-mask-position: 150% 0; 
    mask-position: 150% 0; 
  }
  90% { 
    -webkit-mask-position: -150% 0; 
    mask-position: -150% 0; 
  }
  100% { 
    -webkit-mask-position: -150% 0; 
    mask-position: -150% 0; 
  }
}

.cost-value {
  color: green;
  font-size: 12px;
  display: inline;
}

