html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

body {
  background-color: #f8f9fa;
}

/* DocButterfly Theme Styles */
.navbar-brand {
  font-weight: bold;
  color: #1a3a5c !important;
}

.navbar-brand img {
  transition: transform 0.3s ease;
}

.navbar-brand:hover img {
  transform: scale(1.1);
}

/* Hero Section */
.hero-section {
  padding: 60px 0;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  margin: -30px -15px 40px -15px;
}

.hero-logo {
  max-width: 300px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.hero-tagline {
  color: #1a3a5c;
  font-weight: 600;
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.hero-subtitle {
  color: #6c757d;
  font-size: 1.1rem;
}

.card {
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.card-img-top {
  border-radius: 10px 10px 0 0;
}

.btn-primary {
  background-color: #1a3a5c;
  border-color: #1a3a5c;
}

.btn-primary:hover {
  background-color: #122a42;
  border-color: #122a42;
}

.family-tree-card {
  transition: transform 0.2s;
}

.family-tree-card:hover {
  transform: translateY(-5px);
}

.post-card {
  border-left: 4px solid #1a3a5c;
}

.timeline {
  position: relative;
  padding-left: 30px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #1a3a5c;
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 5px;
  width: 12px;
  height: 12px;
  background: #1a3a5c;
  border-radius: 50%;
}

.heritage-background {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 60px 0;
}

.person-card {
  border: none;
  background: white;
  border-radius: 15px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.person-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

/* Voting System Styles */
.vote-buttons {
  display: flex;
  align-items: center;
}

.btn-vote {
  border: 1px solid #dee2e6;
  background: white;
  color: #6c757d;
  transition: all 0.2s;
}

.btn-upvote:hover,
.btn-upvote.active {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

.btn-downvote:hover,
.btn-downvote.active {
  background-color: #dc3545;
  border-color: #dc3545;
  color: white;
}

.vote-count {
  margin-left: 5px;
  font-weight: bold;
}

.vote-score .badge {
  font-size: 0.75rem;
}

.detail-section {
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 15px;
}

.detail-section:last-child {
  border-bottom: none;
}

.comment-item {
  border-left: 3px solid #ffc107;
}

.border-left-primary {
  border-left: 4px solid #1a3a5c;
}

.border-left-success {
  border-left: 4px solid #28a745;
}

.border-left-info {
  border-left: 4px solid #17a2b8;
}

/* GEDCOM Upload Styles */
.upload-area {
  border: 2px dashed #dee2e6;
  border-radius: 10px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s;
}

.upload-area:hover {
  border-color: #1a3a5c;
  background-color: #f8f9fa;
}

.upload-area.dragover {
  border-color: #1a3a5c;
  background-color: #e8f5e8;
}
/* ═══════════════════════════════════════════ */
/* AI CHAT FAB + PANEL (site-wide)             */
/* ═══════════════════════════════════════════ */

.ai-chat-fab {
    position: fixed; bottom: 24px; right: 24px; width: 52px; height: 52px;
    border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; border: none; font-size: 1.3rem; cursor: pointer; z-index: 1040;
    box-shadow: 0 4px 16px rgba(99,102,241,0.4); transition: transform 0.2s, box-shadow 0.2s;
    display: flex; align-items: center; justify-content: center;
}
.ai-chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 24px rgba(99,102,241,0.5); }
.ai-chat-fab.active { background: linear-gradient(135deg, #4f46e5, #7c3aed); }

.ai-chat-panel {
    position: fixed; bottom: 88px; right: 24px; width: 380px; height: 520px;
    z-index: 1039; background: #fff; border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18); display: flex; flex-direction: column;
    overflow: hidden; border: 1px solid #e5e7eb;
}
.ai-chat-header {
    padding: 12px 16px; background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.ai-chat-header i { margin-right: 6px; }
.ai-chat-close { background: none; border: none; color: #fff; font-size: 1.3rem; cursor: pointer; line-height: 1; opacity: 0.8; padding: 0 4px; }
.ai-chat-close:hover { opacity: 1; }
.ai-chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-msg { display: flex; max-width: 92%; }
.chat-msg.user { align-self: flex-end; }
.chat-msg.assistant { align-self: flex-start; }
.chat-bubble { padding: 8px 12px; border-radius: 12px; font-size: 0.84rem; line-height: 1.55; word-break: break-word; }
.chat-msg.user .chat-bubble { background: #6366f1; color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.assistant .chat-bubble { background: #f3f4f6; color: #1f2937; border-bottom-left-radius: 4px; }
.chat-bubble code { background: rgba(0,0,0,0.08); padding: 1px 4px; border-radius: 3px; font-size: 0.78rem; }
.chat-msg.user .chat-bubble code { background: rgba(255,255,255,0.2); }
.chat-bubble a { color: #6366f1; text-decoration: underline; }
.chat-msg.user .chat-bubble a { color: #c7d2fe; }
.chat-code-block { margin: 6px 0; border-radius: 6px; overflow: hidden; }
.chat-code-block pre { background: #1e1e1e; color: #d4d4d4; padding: 10px; margin: 0; font-size: 0.75rem; line-height: 1.4; overflow-x: auto; white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow-y: auto; }
.ai-chat-input { padding: 10px 12px; border-top: 1px solid #e5e7eb; display: flex; gap: 8px; flex-shrink: 0; background: #f9fafb; }
.ai-chat-input input { flex: 1; border: 1px solid #d1d5db; border-radius: 8px; padding: 8px 12px; font-size: 0.82rem; outline: none; transition: border-color 0.15s; }
.ai-chat-input input:focus { border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,0.15); }
.ai-chat-input button { background: #6366f1; color: #fff; border: none; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-size: 0.85rem; transition: background 0.15s; }
.ai-chat-input button:hover { background: #4f46e5; }
.ai-chat-input button:disabled { background: #9ca3af; cursor: default; }
.ai-chat-callout {
    position: fixed; bottom: 84px; right: 24px; width: 300px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff;
    border-radius: 12px; padding: 14px 16px; z-index: 1041;
    box-shadow: 0 8px 32px rgba(99,102,241,0.45); cursor: pointer;
    animation: sac-callout-appear 0.4s ease-out;
}
.ai-chat-callout::after { content: ''; position: absolute; bottom: -8px; right: 20px; width: 16px; height: 16px; background: #8b5cf6; transform: rotate(45deg); border-radius: 2px; }
.ai-chat-callout-close { position: absolute; top: 6px; right: 8px; background: none; border: none; color: rgba(255,255,255,0.7); font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 2px 4px; }
.ai-chat-callout-close:hover { color: #fff; }
.ai-chat-callout-title { font-weight: 700; font-size: 0.88rem; margin-bottom: 6px; }
.ai-chat-callout-title i { margin-right: 4px; }
.ai-chat-callout-body { font-size: 0.8rem; line-height: 1.5; opacity: 0.92; }
.ai-chat-callout-hiding { opacity: 0; transform: translateY(8px) scale(0.95); transition: opacity 0.3s, transform 0.3s; }
@keyframes sac-callout-appear { from { opacity: 0; transform: translateY(12px) scale(0.9); } to { opacity: 1; transform: translateY(0) scale(1); } }
.chat-typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.chat-typing span { width: 6px; height: 6px; background: #9ca3af; border-radius: 50%; animation: sac-bounce 1.4s infinite ease-in-out both; }
.chat-typing span:nth-child(1) { animation-delay: -0.32s; }
.chat-typing span:nth-child(2) { animation-delay: -0.16s; }
.chat-typing span:nth-child(3) { animation-delay: 0s; }
@keyframes sac-bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }
@media (max-width: 576px) {
    .ai-chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 80px; }
    .ai-chat-callout { width: calc(100vw - 60px); right: 12px; }
}
