/* Indie Band Guestbook Styling */

#guestbook {
  width: 100%;
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem 4rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
}

#guestbook h2 {
  text-align: center;
}

.guestbook-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: -1rem;
}

/* Guestbook Form */
.guestbook-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-top: 1px solid white;
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

.guestbook-form:focus-within {
  border-color: #3f3f46;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'Sansation', var(--font-main);
  letter-spacing: 0.04em;
}

.form-input,
.form-textarea {
  width: 100%;
  background: #000000;
  border: 1px solid #27272a;
  border-radius: 4px;
  padding: 0.65rem 0.85rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease;
}

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

.form-textarea {
  min-height: 90px;
  resize: vertical;
  line-height: 1.5;
}

.form-meta {
  display: flex;
  justify-content: flex-end;
  font-size: 0.75rem;
  color: #71717a;
  font-family: monospace;
}

/* Security Challenge */
.challenge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.4rem 0;
  flex-wrap: wrap;
}

.challenge-text {
  color: #a1a1aa;
}

.challenge-badge {
  color: var(--accent-light);
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: bold;
}

.challenge-input {
  width: 60px;
  background: #000000;
  border: 1px solid #27272a;
  border-radius: 4px;
  color: var(--text-primary);
  font-family: monospace;
  font-size: 0.95rem;
  padding: 0.3rem 0.5rem;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease;
}

.challenge-input:focus {
  border-color: var(--accent);
}

.btn-refresh-challenge {
  background: none;
  border: none;
  color: #71717a;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s ease;
}

.btn-refresh-challenge:hover {
  color: #fafafa;
}

/* Honeypot field (hidden from humans) */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Submit Row & Privacy Note */
.guestbook-submit-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-submit {
  align-self: flex-start;
  background: transparent;
  color: #fafafa;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 0.6rem 1.4rem;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.btn-submit:hover:not(:disabled) {
  background: var(--accent);
  color: black;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 15px var(--accent-glow);
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: #3f3f46;
  color: #71717a;
}

.guestbook-privacy-note {
  font-size: 0.75rem;
  color: #71717a;
}

.guestbook-privacy-note a {
  color: var(--accent-light);
  text-decoration: underline;
}

/* Inline Alerts */
.form-alert {
  display: none;
  font-size: 0.85rem;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
}

.form-alert.visible {
  display: block;
}

.form-alert.alert-error {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.form-alert.alert-success {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

/* Entries Section */
.guestbook-entries-container {
  width: 100%;
  margin-top: 1rem;
}

.entries-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #27272a;
  margin-bottom: 1.2rem;
}

.entries-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.entries-count {
  font-size: 0.8rem;
  color: #71717a;
  font-family: monospace;
}

/* Responsive Grid Arrangement */
.guestbook-entries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  grid-auto-flow: dense;
  gap: 1rem;
  width: 100%;
}

/* Individual Entry Card in Grid */
.guestbook-entry {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.1rem;
  background: rgba(10, 10, 10, 0.7);
  border: 1px solid #27272a;
  transition: all 0.2s ease;
  min-height: 110px;
  position: relative;
  overflow: hidden;
  grid-column: span 1;
}

/* Notes with more content span 2 columns on desktop/tablet */
.guestbook-entry.entry-wide {
  grid-column: span 2;
}

.guestbook-entry:hover {
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
  background: rgba(16, 16, 20, 0.8);
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
  gap: 0.5rem;
  border-bottom: 1px dashed rgba(39, 39, 42, 0.6);
  padding-bottom: 0.4rem;
}

.entry-name {
  color: var(--accent-light);
  font-weight: bold;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-name::before {
  content: "~ ";
  color: var(--text-secondary);
  font-weight: normal;
}

.entry-time {
  color: #71717a;
  font-size: 0.75rem;
  font-family: monospace;
  white-space: nowrap;
}

.entry-message {
  color: #e4e4e7;
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  flex-grow: 1;
}

/* Empty & Loading States */
.guestbook-empty,
.guestbook-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2.5rem 1rem;
  color: #71717a;
  font-size: 0.9rem;
  font-style: italic;
}

/* Load More Container */
.guestbook-load-more {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn-load-more {
  background: transparent;
  border: 1px dashed #3f3f46;
  color: var(--text-secondary);
  padding: 0.6rem 1.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  letter-spacing: 0.05em;
  transition: all 0.2s ease;
}

.btn-load-more:hover:not(:disabled) {
  color: #ffffff;
  border-color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  background: rgba(124, 92, 255, 0.08);
}

.btn-load-more:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

@media screen and (max-width: 600px) {
  #guestbook {
    padding: 0 0.5rem 3rem 0.5rem;
  }
  .guestbook-form {
    padding: 1rem;
  }
  .guestbook-entries {
    grid-template-columns: 1fr;
  }
  .guestbook-entry.entry-wide {
    grid-column: span 1;
  }
}
