/* ============================================
   AIO Demo - AI Optimization Styles
   ============================================ */

/* Demo Banner */
.aio-demo-banner {
  background: #fffde7;
  border-bottom: 2px solid #ffc107;
  padding: 8px 15px;
  text-align: center;
  font-size: 12px;
  color: #5d4037;
  position: relative;
  z-index: 100;
}

/* === AI Search Bar (Header - replaces Google CSE) === */
.aio-search-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.aio-search-label {
  font-size: 11px;
  color: #005379;
  font-weight: bold;
  white-space: nowrap;
}

.aio-search-label::before {
  content: "\2728 ";
}

.aio-search-input {
  width: 240px;
  padding: 5px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.aio-search-input:focus {
  outline: none;
  border-color: #005379;
  box-shadow: 0 0 0 2px rgba(0,83,121,0.15);
}

.aio-search-btn {
  padding: 5px 14px;
  background: #005379;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  font-weight: bold;
  transition: background 0.2s;
}

.aio-search-btn:hover {
  background: #003f5c;
}

/* === Hero Search (Homepage) === */
.aio-hero-search {
  background: linear-gradient(135deg, #005379 0%, #003f5c 100%);
  padding: 30px 20px;
  text-align: center;
}

.aio-hero-title {
  color: #fff;
  font-size: 18px;
  margin: 0 0 6px;
  font-weight: bold;
}

.aio-hero-subtitle {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  margin: 0 0 18px;
}

.aio-hero-input-wrap {
  display: flex;
  justify-content: center;
  gap: 8px;
  max-width: 620px;
  margin: 0 auto 16px;
}

.aio-hero-input {
  flex: 1;
  padding: 11px 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 4px;
  font-size: 15px;
  background: rgba(255,255,255,0.95);
  font-family: inherit;
  box-sizing: border-box;
}

.aio-hero-input:focus {
  outline: none;
  border-color: rgba(255,255,255,0.7);
}

.aio-hero-btn {
  padding: 11px 24px;
  background: #fff;
  color: #005379;
  border: none;
  border-radius: 4px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  white-space: nowrap;
}

.aio-hero-btn:hover {
  background: #e0f3fb;
}

.aio-hero-examples {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.aio-hero-example {
  padding: 4px 12px;
  border: 1px solid rgba(255,255,255,0.4);
  color: rgba(255,255,255,0.9);
  background: transparent;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.aio-hero-example:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.7);
}

/* === AI Summary Panel (Fixed Right Sidebar) === */
.aio-summary-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.12);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  overflow: hidden;
}

.aio-summary-panel.aio-visible {
  transform: translateX(0);
}

/* Reopen tab (shown when panel is closed) */
.aio-reopen-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  background: #005379;
  color: #fff;
  padding: 14px 9px;
  border-radius: 6px 0 0 6px;
  cursor: pointer;
  z-index: 999;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.1em;
  display: none;
  box-shadow: -2px 0 8px rgba(0,0,0,0.15);
  transition: background 0.2s;
}

.aio-reopen-tab:hover {
  background: #003f5c;
}

.aio-reopen-tab.aio-tab-visible {
  display: block;
}

.aio-summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #005379;
  color: #fff;
  flex-shrink: 0;
}

.aio-summary-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: bold;
}

.aio-summary-badge .aio-icon::before {
  content: "\2728";
}

.aio-summary-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.aio-summary-close:hover {
  color: #fff;
}

/* Scrollable content area */
.aio-summary-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.aio-summary-body {
  padding: 14px 16px;
}

.aio-summary-text {
  font-size: 14px;
  line-height: 1.8;
  color: #333;
  margin: 0 0 12px 0;
}

.aio-typing-cursor::after {
  content: "|";
  animation: aio-blink 0.7s infinite;
  color: #005379;
}

@keyframes aio-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.aio-summary-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 10px 0;
}

.aio-summary-bullets li {
  padding: 5px 8px 5px 24px;
  position: relative;
  font-size: 13px;
  line-height: 1.6;
  color: #333;
  border-bottom: 1px dotted #ddd;
}

.aio-summary-bullets li:last-child {
  border-bottom: none;
}

.aio-summary-bullets li::before {
  content: "\2713";
  position: absolute;
  left: 4px;
  color: #005379;
  font-weight: bold;
}

/* Suggested Questions */
.aio-suggested-questions {
  padding: 12px 16px;
  border-top: 1px solid #e4edf3;
}

.aio-suggestions-label {
  font-size: 12px;
  color: #666;
  margin: 0 0 8px 0;
  font-weight: bold;
}

.aio-question-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.aio-question-chip {
  padding: 5px 12px;
  border: 1px solid #005379;
  color: #005379;
  background: #fff;
  border-radius: 18px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.aio-question-chip:hover {
  background: #005379;
  color: #fff;
}

/* Follow-up Input */
.aio-followup-section {
  padding: 10px 16px 12px;
  border-top: 1px solid #e4edf3;
  flex-shrink: 0;
}

.aio-followup-input-wrap {
  display: flex;
  gap: 6px;
}

.aio-followup-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
  box-sizing: border-box;
}

.aio-followup-input:focus {
  outline: none;
  border-color: #005379;
}

.aio-followup-btn {
  padding: 7px 14px;
  background: #005379;
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}

.aio-followup-btn:hover {
  background: #003f5c;
}

/* Conversation History */
.aio-conversation-history {
  padding: 0 16px 12px;
}

.aio-conv-turn {
  margin-bottom: 10px;
}

.aio-conv-question {
  text-align: right;
  margin-bottom: 4px;
}

.aio-conv-question span {
  display: inline-block;
  background: #005379;
  color: #fff;
  padding: 6px 10px;
  border-radius: 12px 12px 0 12px;
  font-size: 12px;
  max-width: 85%;
  text-align: left;
}

.aio-conv-answer {
  text-align: left;
}

.aio-conv-answer div {
  display: inline-block;
  background: #f0f7fb;
  color: #333;
  padding: 8px 10px;
  border-radius: 12px 12px 12px 0;
  font-size: 12px;
  max-width: 90%;
  line-height: 1.6;
}

/* Loading Overlay */
#aio-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 83, 121, 0.88);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

#aio-loading.active {
  display: flex;
}

.aio-loading-dots {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.aio-loading-dots span {
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  animation: aio-bounce 1.2s infinite ease-in-out;
}

.aio-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.aio-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes aio-bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.aio-loading-text {
  color: #fff;
  font-size: 16px;
}

/* Fallback message */
.aio-fallback {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 4px;
  padding: 12px 16px;
  margin-top: 10px;
  font-size: 13px;
  color: #5d4037;
  line-height: 1.6;
}

.aio-fallback-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.aio-fallback-chip {
  padding: 4px 12px;
  border: 1px solid #005379;
  color: #005379;
  background: #fff;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
}

.aio-fallback-chip:hover {
  background: #005379;
  color: #fff;
}

/* Responsive */
@media screen and (max-width: 768px) {
  .aio-hero-input-wrap {
    flex-direction: column;
  }
  .aio-hero-examples {
    flex-direction: column;
    align-items: center;
  }
  .aio-question-chips {
    flex-direction: column;
  }
  .aio-question-chip {
    text-align: center;
  }
  .aio-search-input {
    width: 160px;
  }
  .aio-summary-panel {
    width: 100vw;
  }
}
