/* ---- Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ---- Landing Page ---- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  background: #fff;
  border-bottom: 3px solid #1a237e;
  padding: 0.75rem 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
}

.site-logo {
  height: 56px;
  width: auto;
  display: block;
  object-fit: contain;
}

.header-text {
  flex: 1;
  min-width: 200px;
}

.company-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a237e;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.company-tagline {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
  color: #37474f;
  line-height: 1.4;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-link {
  color: #1a237e;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.header-link:hover {
  text-decoration: underline;
}

.icon-wrap {
  font-size: 1rem;
}

.search-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #ccc;
  border-radius: 4px;
  overflow: hidden;
}

.header-search {
  width: 140px;
  padding: 0.4rem 0.5rem;
  border: none;
  font-size: 0.85rem;
}

.header-search:focus {
  outline: none;
}

.search-btn {
  padding: 0.4rem 0.6rem;
  border: none;
  background: #e8eaf6;
  cursor: pointer;
  font-size: 1rem;
}

.search-btn:hover {
  background: #c5cae9;
}

/* Navigation */
.site-nav {
  background: #1a237e;
  padding: 0 0 0 1rem;
}

.nav-list {
  max-width: 1200px;
  margin: 0 auto;
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.nav-link {
  display: block;
  padding: 0.75rem 1rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.15);
}

/* Breadcrumb */
.breadcrumb-wrap {
  background: #f5f5f5;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e0e0e0;
}

.breadcrumb {
  font-size: 0.85rem;
  color: #616161;
}

.breadcrumb a {
  color: #1a237e;
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

.breadcrumb .sep {
  margin: 0 0.2rem;
}

.breadcrumb .current {
  color: #212121;
}

/* Main content */
.site-main {
  padding: 2rem 0 4rem;
  min-height: 50vh;
}

.layout-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
}

.sidebar-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  color: #1a237e;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #1a237e;
}

.sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-link {
  display: block;
  padding: 0.5rem 0;
  color: #37474f;
  text-decoration: none;
  font-size: 0.9rem;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: #1a237e;
  font-weight: 500;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.page-title {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a237e;
}

.lead {
  font-size: 1.05rem;
  color: #37474f;
  margin-bottom: 1rem;
}

.main-content p {
  color: #424242;
  margin-bottom: 1rem;
}

/* Footer */
.site-footer {
  background: #1a237e;
  color: #fff;
  padding: 1rem 0;
  margin-top: 2rem;
}

.footer-text {
  margin: 0;
  font-size: 0.85rem;
  text-align: center;
  opacity: 0.9;
}

@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }
  .site-logo {
    height: 48px;
  }
  .company-name {
    font-size: 1rem;
  }
  .layout-with-sidebar {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
}

/* ---- Chat Widget (right-side floating) ---- */
.chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-size: 15px;
}

/* Toggle button */
.chat-toggle {
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(26, 35, 126, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(26, 35, 126, 0.5);
}

.chat-toggle .icon-close {
  display: none;
}

.chat-widget.is-open .chat-toggle .icon-chat {
  display: none;
}

.chat-widget.is-open .chat-toggle .icon-close {
  display: block;
}

.chat-toggle svg {
  width: 26px;
  height: 26px;
}

/* Panel */
.chat-panel {
  position: absolute;
  bottom: calc(56px + 12px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.96);
  transition: opacity 0.2s, visibility 0.2s, transform 0.2s;
}

.chat-widget.is-open .chat-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.chat-panel[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.chat-header {
  padding: 14px 16px;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.chat-close {
  width: 32px;
  height: 32px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Pre-chat form */
.chat-form-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8f9fb;
}

.chat-form-wrap.hidden {
  display: none;
}

.chat-form-intro {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: #37474f;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-form label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1a237e;
  margin-top: 2px;
}

.chat-form .required {
  color: #c62828;
}

.chat-form input,
.chat-form select,
.chat-form textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: #fff;
}

.chat-form input:focus,
.chat-form select:focus,
.chat-form textarea:focus {
  outline: none;
  border-color: #1a237e;
  box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.15);
}

.chat-form textarea {
  resize: vertical;
  min-height: 60px;
}

.chat-form-submit {
  margin-top: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.2s;
}

.chat-form-submit:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.chat-form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.chat-form-error {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #c62828;
  min-height: 1.2em;
}

/* Chat body (after form submit) */
.chat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-body.hidden {
  display: none;
}

.chat-body[aria-hidden="true"] {
  display: none;
}

.chat-body[aria-hidden="false"] {
  display: flex;
}

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f8f9fb;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 92%;
  animation: messageIn 0.25s ease-out;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message.user {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.message.user .message-avatar {
  background: linear-gradient(135deg, #323232 0%, #555 100%);
  text-transform: uppercase;
  font-size: 0.65rem;
}

.message-content {
  background: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.message.user .message-content {
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #fff;
}

.message-content p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.message-content p + p {
  margin-top: 6px;
}

/* Markdown rendered content in bot messages */
.message.bot .message-content h1,
.message.bot .message-content h2,
.message.bot .message-content h3,
.message.bot .message-content h4 {
  margin: 8px 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a237e;
}

.message.bot .message-content ul,
.message.bot .message-content ol {
  margin: 4px 0;
  padding-left: 1.4em;
}

.message.bot .message-content li {
  margin-bottom: 2px;
}

.message.bot .message-content code {
  background: #f0f0f5;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.88em;
}

.message.bot .message-content pre {
  background: #f0f0f5;
  padding: 8px 10px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85em;
  margin: 6px 0;
}

.message.bot .message-content pre code {
  background: none;
  padding: 0;
}

.message.bot .message-content strong {
  font-weight: 600;
}

.message.bot .message-content a {
  color: #1a237e;
  text-decoration: underline;
}

/* Typing indicator */
.message.typing .message-content {
  padding: 12px 16px;
}

.typing-dots {
  display: flex;
  gap: 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1a237e;
  animation: typingBounce 1.4s ease-in-out infinite both;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40% { transform: scale(1.2); opacity: 1; }
}

/* Input area */
.chat-input-area {
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e8eaed;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input:focus {
  outline: none;
  border-color: #1a237e;
  box-shadow: 0 0 0 3px rgba(26, 35, 126, 0.15);
}

.chat-input::placeholder {
  color: #888;
}

.chat-send {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s, opacity 0.2s;
}

.chat-send:hover:not(:disabled) {
  transform: scale(1.05);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status (errors / API key hint) */
.chat-status {
  padding: 6px 16px 10px;
  font-size: 0.8rem;
  color: #666;
  min-height: 20px;
}

.chat-status.error {
  color: #c62828;
}

/* Responsive */
@media (max-width: 420px) {
  .chat-widget {
    bottom: 16px;
    right: 16px;
  }

  .chat-panel {
    width: calc(100vw - 32px);
    right: 0;
    height: 70vh;
  }
}

/* ---- Raise Ticket Button ---- */
.chat-actions {
  padding: 4px 12px 8px;
  text-align: center;
  border-top: 1px solid #e8e8e8;
  background: #fafafa;
}
.chat-raise-ticket {
  background: #ff6b00;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
}
.chat-raise-ticket:hover {
  background: #e05e00;
}
.chat-raise-ticket:disabled {
  background: #ccc;
  cursor: not-allowed;
}
.ticket-success {
  background: #e8f5e9;
  border: 1px solid #4caf50;
  border-radius: 8px;
  padding: 12px;
  margin: 8px 0;
  text-align: center;
}
.ticket-success .ticket-number {
  font-size: 18px;
  font-weight: 700;
  color: #2e7d32;
  display: block;
  margin: 4px 0;
}
