/**
 * Henry Brothers Roofing — Custom Styles
 * Extends Tailwind (CDN). Keeps it lightweight and premium.
 */

:root {
  --accent: #1e40af;
}

/* Premium typography & spacing */
h1, h2, h3 {
  font-feature-settings: "tnum", "ss01";
}

/* Smooth everything */
* {
  transition-property: color, background-color, border-color, transform, box-shadow;
  transition-duration: 160ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Card hover lift */
.border-slate-200:hover,
.bg-white.border:hover {
  box-shadow: 0 10px 15px -3px rgb(15 23 42 / 0.05), 0 4px 6px -4px rgb(15 23 42 / 0.05);
  transform: translateY(-1px);
}

/* Buttons */
button, .btn {
  -webkit-tap-highlight-color: transparent;
}

/* Form inputs */
input, select, textarea {
  font-size: 15px;
  line-height: 1.4;
}

input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.12);
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Gallery items */
.gallery-item {
  position: relative;
  overflow: hidden;
}
.gallery-item img {
  transition: transform 700ms cubic-bezier(0.23, 1, 0.32, 1);
}
.gallery-item:hover img {
  transform: scale(1.035);
}

/* Lightbox polish */
#lightbox {
  backdrop-filter: blur(12px);
}

/* Mobile bottom bar safe area */
@media (max-width: 767px) {
  body {
    padding-bottom: 78px;
  }
}

/* Accessibility */
:focus-visible {
  outline: 2px solid #1e40af;
  outline-offset: 2px;
}

/* Subtle section dividers */
section + section {
  border-top: 1px solid #f1e7e7;
}

/* Print friendly */
@media print {
  nav, .sticky, #quote-modal, footer, .md\\:hidden { display: none !important; }
  body { padding-bottom: 0; }
}

/* =========================================
   FLOATING CHATBOT WIDGET
   Quick lead capture - short conversational UI
   ========================================= */

#chat-widget {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  font-family: inherit;
}

#chat-widget .chat-bubble-btn {
  width: 56px;
  height: 56px;
  background: #0f172a;
  color: white;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 15px -3px rgb(15 23 42 / 0.3), 0 4px 6px -4px rgb(15 23 42 / 0.3);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s;
  cursor: pointer;
}

#chat-widget .chat-bubble-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 20px 25px -5px rgb(15 23 42 / 0.3), 0 8px 10px -6px rgb(15 23 42 / 0.3);
}

#chat-widget .chat-bubble-btn svg {
  width: 26px;
  height: 26px;
}

#chat-panel {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 340px;
  max-width: calc(100vw - 2rem);
  height: 460px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

#chat-panel.hidden {
  display: none;
}

.chat-header {
  background: #0f172a;
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chat-header .avatar {
  width: 32px;
  height: 32px;
  background: #1e40af;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.5px;
}

.chat-header .info {
  flex: 1;
  min-width: 0;
}

.chat-header .info .name {
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
}

.chat-header .info .status {
  font-size: 11px;
  color: #86efac;
  display: flex;
  align-items: center;
  gap: 4px;
}

.chat-header .status-dot {
  width: 7px;
  height: 7px;
  background: #86efac;
  border-radius: 50%;
  display: inline-block;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.35;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 2px;
}

.message {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  white-space: pre-wrap;
}

.message.bot {
  background: white;
  border: 1px solid #e2e8f0;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.message.user {
  background: #1e40af;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.quick-reply {
  font-size: 12.5px;
  padding: 6px 13px;
  background: white;
  border: 1px solid #64748b33;
  color: #1e40af;
  border-radius: 9999px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.1s;
}

.quick-reply:hover {
  background: #f1f5f9;
  border-color: #1e40af;
}

.chat-input-area {
  border-top: 1px solid #e2e8f0;
  padding: 10px 12px;
  background: white;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.chat-input-area input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 9999px;
  padding: 9px 14px;
  font-size: 14px;
  outline: none;
}

.chat-input-area input:focus {
  border-color: #1e40af;
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.chat-input-area button.send {
  background: #1e40af;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.chat-input-area button.send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile adjustments */
@media (max-width: 640px) {
  #chat-widget .chat-bubble-btn {
    width: 52px;
    height: 52px;
  }
  #chat-panel {
    width: calc(100vw - 1.5rem);
    right: 0.75rem;
    bottom: 72px;
    height: 420px;
  }
}

/* Hide on very small screens if needed, but keep visible */

/* Make sure chat button sits above the mobile sticky CTA bar */
@media (max-width: 767px) {
  #chat-widget {
    bottom: 5.25rem; /* above the fixed mobile bar */
  }
  #chat-panel {
    bottom: 5.75rem;
  }
}
