/* === ISS Solar AI Assistant Styles === */

:root {
  --iss-primary:   #FEC700;
  --iss-secondary: #D4A700;
  --iss-bg:        #FFFBEA;
  --iss-text:      #1a1a1a;
  --iss-white:     #ffffff;
  --shadow-sm:     0 2px 8px rgba(254, 199, 0, 0.15);
  --shadow-md:     0 4px 16px rgba(254, 199, 0, 0.22);
  --shadow-lg:     0 8px 32px rgba(254, 199, 0, 0.28);
}

/* === Launcher Button === */
.iss-launcher-wrap {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99998;
}
.bubble.bot a:hover {
    color: white !important;
}
#iss-chat-launcher {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--iss-primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--iss-text);
}

#iss-chat-launcher:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(254, 199, 0, 0.45);
  background: var(--iss-secondary);
}

#iss-chat-launcher:active {
  transform: scale(0.95);
}

#iss-chat-launcher.chat-open {
  background: #2a2a2a;
  color: var(--iss-white);
}

.launcher-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.launcher-inner svg {
  width: 32px;
  height: 32px;
  stroke-width: 2;
}

/* Pulse */
.launcher-pulse {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: var(--iss-primary);
  animation: issPulse 2s infinite;
  opacity: 0;
}

@keyframes issPulse {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(1.6); opacity: 0;    }
}

/* Badge */
.launcher-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #2a9d3f;
  color: var(--iss-white);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--iss-white);
  box-shadow: var(--shadow-md);
  animation: issBounce 0.5s ease;
}

@keyframes issBounce {
  0%, 100% { transform: scale(1);   }
  50%      { transform: scale(1.2); }
}

/* === Chat Widget === */
#iss-chat-widget {
  position: fixed;
  right: 20px;
  bottom: 95px;
  width: 420px;
  max-width: calc(100vw - 40px);
  height: 650px;
  max-height: calc(100vh - 120px);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  flex-direction: column;
  background: var(--iss-white);
  z-index: 99999;
  border: 1px solid rgba(0,0,0,0.06);
  font-family: inherit;
  animation: issSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#iss-chat-widget.show {
  display: flex;
}

#iss-chat-widget.minimized .chat-body,
#iss-chat-widget.minimized .chat-input-wrap {
  display: none;
}

@keyframes issSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1);       }
}

@keyframes issFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* === Header === */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--iss-primary);
  color: var(--iss-text);
  flex-shrink: 0;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.chat-logo-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-logo-wrap svg {
  width: 24px;
  height: 24px;
  stroke: var(--iss-text);
  stroke-width: 1.75;
}

.chat-title-wrap {
  flex: 1;
  min-width: 0;
}

.chat-title {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--iss-text);
}

.chat-subtitle {
  font-size: 11px;
  opacity: 0.75;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--iss-text);
}

.chat-status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--iss-text);
  opacity: 0.85;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #2a9d3f;
  border-radius: 50%;
  display: inline-block;
  animation: issStatusPulse 2s infinite;
}

@keyframes issStatusPulse {
  0%, 100% { opacity: 1;   }
  50%       { opacity: 0.4; }
}

.top-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.action-btn {
  background: rgba(0,0,0,0.1);
  border: none;
  border-radius: 6px;
  color: var(--iss-text);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.action-btn:hover {
  background: rgba(0,0,0,0.2);
  transform: scale(1.05);
}

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

/* === Chat Body === */
.chat-body {
  flex: 1;
  padding: 16px;
  background: var(--iss-bg);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--iss-secondary) transparent;
  scroll-behavior: smooth;
}

.chat-body::-webkit-scrollbar { width: 5px; }
.chat-body::-webkit-scrollbar-track { background: transparent; }
.chat-body::-webkit-scrollbar-thumb { background: var(--iss-secondary); border-radius: 3px; }
.chat-body::-webkit-scrollbar-thumb:hover { background: var(--iss-primary); }

/* === Messages === */
.bubble {
  max-width: 85%;
  padding: 11px 15px;
  border-radius: 14px;
  margin: 8px 0;
  line-height: 1.55;
  font-size: 14.5px;
  word-break: break-word;
  animation: issFadeIn 0.25s ease;
  font-family: inherit;
}

.bubble.user {
  background: var(--iss-primary);
  color: var(--iss-text);
  margin-left: auto;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.bubble.bot {
  background: var(--iss-white);
  border: 1px solid rgba(254, 199, 0, 0.25);
  color: #2c2c2c;
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.bubble.bot p { margin: 0 0 9px 0; }
.bubble.bot p:last-child { margin-bottom: 0; }

.bubble.bot ul,
.bubble.bot ol {
  margin: 7px 0 7px 18px;
  padding: 0;
}

.bubble.bot li { margin: 5px 0; }

.bubble.bot a {
  color: #8a6d00;
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid rgba(212, 167, 0, 0.4);
  transition: border-color 0.2s ease;
}

.bubble.bot a:hover { border-bottom-color: var(--iss-secondary); }

.bubble.bot strong {
  color: #6b5000;
  font-weight: 700;
}

.bubble.bot code {
  background: rgba(254, 199, 0, 0.15);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

.bubble.bot h2,
.bubble.bot h3,
.bubble.bot h4 {
  color: #6b5000;
  margin: 10px 0 6px 0;
  font-weight: 700;
  font-family: inherit;
}

/* Contact info card */
.contact-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(254, 199, 0, 0.12);
  border: 1px solid rgba(254, 199, 0, 0.3);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.7;
}

.contact-card-title {
  font-weight: 700;
  font-size: 13px;
  color: #6b5000;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.contact-card-title svg {
  width: 14px;
  height: 14px;
  stroke: #6b5000;
  stroke-width: 2;
  flex-shrink: 0;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.contact-row:last-child { margin-bottom: 0; }

.contact-row svg {
  width: 13px;
  height: 13px;
  stroke: #8a6d00;
  stroke-width: 2;
  flex-shrink: 0;
}

.contact-row a {
  color: #7a5f00;
  text-decoration: none;
  font-weight: 500;
}

.contact-row a:hover { text-decoration: underline; }

.quote-btn-wrap {
  margin-top: 10px;
}

.quote-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--iss-primary);
  color: var(--iss-text);
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

.quote-cta-btn:hover {
  background: var(--iss-secondary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: var(--iss-text);
  border-bottom: none;
}

.quote-cta-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2.5;
}

/* === Typing Indicator === */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px !important;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--iss-secondary);
  border-radius: 50%;
  animation: issTyping 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes issTyping {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.45; }
  30%           { transform: translateY(-9px); opacity: 1;    }
}

/* === Quick Actions === */
.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 14px 8px;
  background: var(--iss-white);
  border-bottom: 1px solid #f0e8c0;
}

.quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--iss-white);
  border: 1.5px solid var(--iss-secondary);
  color: #6b5000;
  border-radius: 20px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.quick-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.quick-btn:hover {
  background: var(--iss-primary);
  color: var(--iss-text);
  border-color: var(--iss-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

/* === Input Area === */
.chat-input-wrap {
  flex-shrink: 0;
  background: var(--iss-white);
  border-top: 1px solid #f0e8c0;
}

.chat-input {
  display: flex;
  gap: 9px;
  padding: 12px 14px;
  align-items: center;
}

.chat-input input {
  flex: 1;
  border: 1.5px solid #e8d87a;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14.5px;
  outline: none;
  transition: all 0.2s ease;
  font-family: inherit;
  background: #fafaf5;
  color: var(--iss-text);
}

.chat-input input:focus {
  border-color: var(--iss-primary);
  background: var(--iss-white);
  box-shadow: 0 0 0 3px rgba(254, 199, 0, 0.18);
}

.chat-input input::placeholder { color: #aaa; }

.chat-input button {
  background: var(--iss-primary);
  color: var(--iss-text);
  border: none;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-input button svg {
  width: 18px;
  height: 18px;
  stroke: var(--iss-text);
  stroke-width: 2.5;
}

.chat-input button:hover:not(:disabled) {
  background: var(--iss-secondary);
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.chat-input button:active:not(:disabled) { transform: scale(0.95); }

.chat-input button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.powered-by {
  text-align: center;
  padding: 6px 14px 10px;
  font-size: 11px;
  color: #aaa;
  font-weight: 500;
  font-family: inherit;
}

.powered-by strong { color: #8a6d00; font-weight: 700; }

/* === Error / System messages === */
.bubble.system {
  background: #fff4cc;
  border: 1px solid rgba(254, 199, 0, 0.5);
  color: #6b5000;
  font-size: 13px;
  text-align: center;
  margin: 6px auto;
  max-width: 90%;
  border-radius: 8px;
  padding: 9px 14px;
}

/* === Mobile === */
@media (max-width: 768px) {
  .iss-launcher-wrap {
    right: 14px;
    bottom: 14px;
  }

  #iss-chat-launcher {
    width: 56px;
    height: 56px;
  }

  .launcher-inner svg {
    width: 28px;
    height: 28px;
  }

  #iss-chat-widget {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  #iss-chat-widget.keyboard-open {
    height: 55vh;
  }

  .bubble {
    max-width: 90%;
    font-size: 14px;
  }

  .quick-btn {
    font-size: 12px;
    padding: 6px 11px;
  }

  .chat-input input {
    font-size: 16px; /* prevent iOS zoom */
  }
}

@media (max-width: 480px) {
  .chat-header { padding: 11px 13px; }

  .chat-logo-wrap {
    width: 34px;
    height: 34px;
  }

  .chat-title { font-size: 14px; }

  .action-btn {
    width: 26px;
    height: 26px;
  }

  .chat-body { padding: 12px; }
}

/* === Accessibility === */
.action-btn:focus,
.quick-btn:focus,
.chat-input button:focus,
#iss-chat-launcher:focus {
  outline: 3px solid rgba(254, 199, 0, 0.6);
  outline-offset: 2px;
}

.chat-input input:focus { outline: none; }

/* === Dark Mode === */
@media (prefers-color-scheme: dark) {
  #iss-chat-widget {
    background: #1c1c1c;
    border-color: #333;
  }

  .chat-body { background: #111; }

  .bubble.bot {
    background: #262626;
    border-color: rgba(254, 199, 0, 0.25);
    color: #e0e0e0;
  }

  .bubble.bot strong { color: #f0c840; }
  .bubble.bot a { color: #d4aa00; border-bottom-color: rgba(212,170,0,0.4); }

  .chat-input-wrap,
  .quick-actions {
    background: #1c1c1c;
    border-color: #333;
  }

  .chat-input input {
    background: #262626;
    border-color: #444;
    color: #e0e0e0;
  }

  .chat-input input:focus { background: #2e2e2e; }

  .quick-btn {
    background: #262626;
    color: #d4aa00;
  }

  .contact-card {
    background: rgba(254, 199, 0, 0.08);
    border-color: rgba(254, 199, 0, 0.2);
  }

  .powered-by { color: #666; }
  .powered-by strong { color: #c9a000; }
}

/* === Print === */
@media print {
  .iss-launcher-wrap,
  #iss-chat-widget { display: none !important; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .launcher-pulse { display: none; }
}
