/*
  ╔══════════════════════════════════════════════════════════════╗
  ║  ZANIX — css/comments.css                                    ║
  ║  Comment System: FAB + Side Drawer / Bottom Sheet            ║
  ╚══════════════════════════════════════════════════════════════╝
*/

/* ── FAB (Floating Action Button) ── */
#fab-comment {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 8500;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 15px rgba(201, 168, 76, 0.3);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s;
}

#fab-comment:hover {
  background: var(--accent-glow);
  transform: scale(1.1) rotate(5deg);
}

#fab-comment:active {
  transform: scale(0.95);
}

#fab-comment::before {
  content: '💬';
  font-size: 1.5rem;
}

/* Badge for comment count */
#fab-comment::after {
  content: attr(data-count);
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--bg-base);
  color: var(--accent);
  font-size: 0.7rem;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  border: 1px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: transform 0.3s var(--ease), opacity 0.3s;
}

#fab-comment[data-count]:not([data-count="0"])::after {
  opacity: 1;
  transform: scale(1);
}

/* ── Overlay ── */
#comment-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
}

#comment-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ── Panel (Side Drawer / Bottom Sheet) ── */
#comment-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--bg-mid);
  z-index: 9100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.5s var(--ease);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5);
}

#comment-panel.active {
  transform: translateX(0);
}

/* Header */
.comment-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-raised);
}

.comment-header h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin: 0;
  text-transform: uppercase;
}

.close-panel {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.3s;
}

.close-panel:hover {
  color: var(--accent);
}

/* Comment List */
.comment-feed {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}

.comment-feed::-webkit-scrollbar {
  width: 4px;
}

.comment-feed::-webkit-scrollbar-thumb {
  background: var(--accent);
}

.comment-item {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  animation: fadeUp 0.5s var(--ease) forwards;
}

.comment-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.comment-author {
  font-family: 'Cinzel', serif;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.comment-body {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Form */
.comment-form-container {
  padding: 2rem;
  background: var(--bg-raised);
  border-top: 1px solid var(--border-subtle);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.comment-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.comment-input-group label {
  font-family: 'Cinzel', serif;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.comment-form input,
.comment-form textarea {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  font-family: 'Jost', sans-serif;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.comment-form textarea {
  height: 100px;
  resize: none;
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.char-count {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.submit-btn {
  background: var(--accent);
  color: var(--text-on-accent);
  border: none;
  padding: 0.6rem 1.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s, opacity 0.3s;
}

.submit-btn:hover:not(:disabled) {
  background: var(--accent-glow);
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.msg-inline {
  font-size: 0.8rem;
  padding: 0.5rem 0;
  margin-top: 0.5rem;
  text-align: center;
}

.msg-success { color: #4ade80; }
.msg-error { color: #f87171; }

/* ── Mobile Overrides ── */
@media (max-width: 768px) {
  #comment-panel {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90vh;
    transform: translateY(100%);
    border-left: none;
    border-top: 1px solid var(--border-subtle);
    border-radius: 20px 20px 0 0;
  }

  #comment-panel.active {
    transform: translateY(0);
  }

  .comment-header {
    padding: 1rem 1.5rem;
  }

  .comment-header h2 {
    font-size: 1rem;
  }

  .comment-feed {
    padding: 1rem 1.5rem;
  }

  .comment-item {
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
  }

  .comment-meta {
    font-size: 0.65rem;
    margin-bottom: 0.5rem;
  }

  .comment-body {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .comment-form-container {
    padding: 1rem 1.5rem;
    background: var(--bg-mid); /* Slightly different to separate from feed */
  }

  .comment-form {
    gap: 0.5rem;
  }

  .comment-form input {
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
  }

  .comment-form textarea {
    height: 45px;
    padding: 0.5rem 0.8rem;
    font-size: 0.85rem;
    transition: height 0.3s var(--ease), border-color 0.3s;
  }

  .comment-form textarea:focus {
    height: 90px;
  }

  .comment-input-group label {
    font-size: 0.5rem;
    margin-bottom: 0.1rem;
  }

  .cf-turnstile {
    transform: scale(0.85);
    transform-origin: left top;
    height: 65px; /* Adjust height for scale */
    margin-bottom: -10px;
  }

  .form-footer {
    margin-top: 0;
  }

  .submit-btn {
    padding: 0.4rem 1rem;
    font-size: 0.65rem;
  }

  .comment-ad {
    padding: 0.8rem 1.5rem !important;
  }

  .comment-ad #container-eaa00d3602ba5fad41d972f0466c91c6 {
    min-height: 50px;
    display: flex;
    justify-content: center;
  }
}

.section-ad {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border-subtle);
  margin-top: 2rem;
}
