/* ==========================================================================
   02 GUESTBOOK STYLES
   Theme: Clean, Modern & Friendly Light Mode
   ========================================================================== */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;

  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-tint: #eef2ff;

  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --border-light: #e2e8f0;
  --border-subtle: #cbd5e1;

  --danger: #ef4444;
  --danger-bg: #fef2f2;

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08);

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --transition-fast: 0.18s ease;
  --transition-normal: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Background Glows */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: -1;
  opacity: 0.4;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
  top: -100px;
  right: -80px;
}

.bg-glow-2 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  bottom: 0;
  left: -100px;
}

/* Container */
.container {
  width: 100%;
  max-width: 1050px;
  margin: 0 auto;
  padding: 0 24px;
}

.text-center { text-align: center; }

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-sub-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-sub-link:hover {
  color: var(--primary);
  background: var(--bg-tertiary);
}

.current-badge {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-tint);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Main Content */
.main-content {
  flex: 1;
  padding: 50px 0 80px;
}

.page-header {
  margin-bottom: 44px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid var(--border-light);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.page-title {
  font-size: 2.3rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}

.page-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto;
}

/* Guestbook Layout (2 Columns) */
.guestbook-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 32px;
  align-items: start;
}

/* Card Common */
.card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.card-header {
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-hint {
  font-size: 0.76rem;
  color: var(--text-light);
  display: block;
  margin-top: 4px;
}

/* Form Styles */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.label-row label {
  margin-bottom: 0;
}

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

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon i {
  position: absolute;
  left: 14px;
  color: var(--text-light);
  font-size: 0.9rem;
}

.input-with-icon input {
  padding-left: 40px !important;
}

input[type="text"], textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  outline: none;
  transition: all var(--transition-fast);
}

input[type="text"]:focus, textarea:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* Emoji Selector */
.emoji-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emoji-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.emoji-btn:hover {
  transform: scale(1.1);
  background: #ffffff;
  border-color: var(--border-subtle);
}

.emoji-btn.active {
  background: var(--primary-tint);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
  transform: scale(1.1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
}

.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #4f46e5 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.btn-submit {
  width: 100%;
  margin-top: 6px;
}

/* Feed Section */
.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.feed-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feed-title-wrap h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-count-badge {
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--primary);
  background: var(--primary-tint);
  padding: 3px 10px;
  border-radius: var(--radius-full);
}

.btn-clear-all {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-clear-all:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Message List */
.message-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Message Card */
.message-card {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  display: flex;
  gap: 16px;
  position: relative;
  animation: slideDown 0.35s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-subtle);
}

.message-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.message-body {
  flex: 1;
}

.message-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.message-author {
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--text-primary);
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-light);
}

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

.btn-delete-msg {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 4px;
  font-size: 0.8rem;
  opacity: 0;
  transition: all var(--transition-fast);
  margin-left: 8px;
}

.message-card:hover .btn-delete-msg {
  opacity: 1;
}

.btn-delete-msg:hover {
  color: var(--danger);
  transform: scale(1.15);
}

/* Loading & DB Error Alerts */
.feed-loading {
  text-align: center;
  padding: 30px 20px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--primary);
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-sm);
}

.db-error-alert {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  color: #991b1b;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.db-error-alert .alert-icon {
  font-size: 1.3rem;
  color: var(--danger);
  flex-shrink: 0;
  margin-top: 2px;
}

.db-error-alert strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.db-error-alert p {
  font-size: 0.85rem;
  color: #7f1d1d;
  line-height: 1.5;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  background: #ffffff;
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}

.empty-icon {
  font-size: 2.5rem;
  color: var(--border-subtle);
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Footer */
.footer {
  background: #ffffff;
  border-top: 1px solid var(--border-light);
  padding: 28px 0;
  margin-top: auto;
}

.copyright {
  font-size: 0.82rem;
  color: var(--text-light);
}

/* Responsive */
@media (max-width: 820px) {
  .guestbook-layout {
    grid-template-columns: 1fr;
  }

  .form-section {
    order: 1;
  }

  .feed-section {
    order: 2;
  }

  .btn-delete-msg {
    opacity: 1;
  }
}
