/* GLOBAL RESETS AND TYPOGRAPHY */
:root {
  --primary-color: #6c757d; /* Grey */
  --accent-color: #495057; /* Darker Grey */
  --text-color: #333;
  --bg-color: #f8f9fa; /* Light Grey/Off-white background */
  --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 12px rgba(0, 0, 0, 0.15);
}

/* Profile Header Bar with Picture and Name */
.profile-header-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 0;
}

.profile-pic {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ddd;
}

.profile-pic-emoji {
  font-size: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
}

.profile-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: #333;
}

/* Profile Button Picture */
#profile-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: transparent;
  border: 2px solid #ddd;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

#profile-btn:hover {
  border-color: #999;
  transform: scale(1.1);
}

.profile-btn-pic {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Favorite Quote Cards (same as home page) */
.fav-quote-card {
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  overflow: hidden;
  min-height: 300px;
  position: relative;
  transition: transform 0.2s ease;
}

.fav-quote-card:hover {
  transform: translateY(-4px);
}


* {
  box-sizing: border-box;
}

body {
  font-family: 'Georgia', serif;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  padding-bottom: 80px; /* Prevent overlap with fixed bottom elements */
}
body.modal-lock {
  overflow: hidden;
  height: 100%;
  touch-action: none;
}

/* ✅ UPDATED: Plain Header Style */
header {
  text-align: center;
  padding: 30px 0;
  background-color: transparent; /* Removed background color */
  color: var(--primary-color);   /* Grey text */
  border-bottom: 1px solid #e9ecef; /* Subtle divider */
  margin-bottom: 20px;
  box-shadow: none; /* Removed shadow for cleaner look */
}

/* =========================== Daily Quote =========================== */
#daily-quote-container {
  max-width: 700px;
  margin: 0 auto 30px;
  padding: 0 20px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
#daily-quote-container:hover {
  transform: translateY(-2px);
}
.daily-quote-badge {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #6c757d;
  margin-bottom: 12px;
}
.daily-quote-content {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  border-radius: 12px;
  padding: 24px 32px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
}
.daily-quote-text {
  font-size: 1.3rem;
  font-style: italic;
  color: #333;
  margin: 0 0 12px 0;
  line-height: 1.6;
  text-align: center;
}
.daily-quote-author {
  font-size: 1rem;
  font-weight: 600;
  color: #6c757d;
  text-align: right;
  margin: 0;
}
.daily-quote-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid #e9ecef;
}
.daily-quote-footer .like-container {
  display: flex;
  align-items: center;
  gap: 6px;
}
@media (max-width: 600px) {
  .daily-quote-content { padding: 18px 22px; }
  .daily-quote-text { font-size: 1.1rem; }
  .daily-quote-author { font-size: 0.9rem; }
}

h1 {
  margin: 0;
  font-size: 2.5rem;
  font-weight: normal;
  letter-spacing: 1px;
}

/* =========================== Search & Menu =========================== */
#search-container {
  max-width: 700px;
  margin: 0 auto 30px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  position: relative;
}

#search-input {
  width: 90%;
  max-width: 600px;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

#search-input:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 5px rgba(108, 117, 125, 0.5);
  outline: none;
}

#themes-menu-btn {
  width: 10%;
  max-width: 40px;
  height: 40px;
  margin-left: 10px;
  border: none;
  background-color: var(--primary-color);
  color: white;
  font-size: 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow-light);
  transition: background-color 0.2s, transform 0.2s;
}

#themes-menu-btn:hover {
  background-color: var(--accent-color);
  transform: scale(1.05);
}

/* Menu Dropdowns */
.content-dropdown, #menu-dropdown {
  position: absolute;
  top: 100%;
  right: 20px;
  width: 250px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: var(--shadow-medium);
  z-index: 50;
  padding: 10px;
  max-height: 300px;
  overflow-y: auto;
}

#menu-dropdown { width: 150px; right: 20px; }

.menu-options { display: flex; flex-direction: column; }
.menu-option {
  padding: 8px 10px; margin-bottom: 5px; background-color: #f9f9f9;
  border: 1px solid #eee; border-radius: 5px; cursor: pointer;
  text-align: center; transition: background-color 0.15s;
}
.menu-option:hover { background-color: #eee; border-color: #ddd; }

.dropdown-header { padding-bottom: 5px; margin-bottom: 10px; border-bottom: 1px solid #eee; }
.dropdown-header h3 { margin: 0; font-size: 1.1em; color: var(--primary-color); }
.theme-item, .author-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; cursor: pointer; border-bottom: 1px dotted #f0f0f0;
}
.theme-item:hover, .author-item:hover { background-color: #fafafa; }
.theme-name, .author-name { font-size: 0.9em; }
.theme-count, .author-count {
  color: #666; font-size: 0.85em; background: #f5f5f5;
  padding: 2px 8px; border-radius: 12px; min-width: 20px; text-align: center;
}

/* =========================== Quotes List =========================== */
#quotes-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.quote-card {
  height: 250px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-medium);
  cursor: pointer;
  background-color: #fff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.quote-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.2);
}

.quote-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  padding: 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.9);
}

.quote-text {
  font-size: 1.1rem;
  font-style: italic;
  margin-top: 0;
  margin-bottom: auto;
  color: var(--text-color);
  white-space: pre-line; /* Preserve line breaks from input */
  /* Prevent overly long quotes from pushing footer off-card */
  display: -webkit-box;
  -webkit-line-clamp: 10; /* show up to ~10 lines in card view */
  -webkit-box-orient: vertical;
  overflow: hidden;
  position: relative;
}

/* Subtle fade at bottom to indicate more content on click */
.quote-text.clamped::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0.85) 60%, rgba(255,255,255,1));
}

.quote-author {
  font-size: 1rem; text-align: right; font-weight: bold;
  color: var(--primary-color); margin: 10px 0 0;
}

.quote-theme {
  font-size: 0.85rem; color: #666; text-align: right; margin: 5px 0 10px;
}

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

.watermark {
  font-size: 0.7rem; color: #ccc; font-style: italic;
}

/* ✅ FIXED: Card Action Buttons */
.quote-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 10; /* Ensure buttons are above overlay content */
}

.quote-card:hover .quote-actions {
  opacity: 1;
}

.quote-actions button {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  margin-left: 5px;
  font-size: 0.8rem;
  transition: background 0.2s;
  z-index: 11; /* Ensure clickable */
}

.quote-actions button:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Like Container */
.like-container {
  display: flex; align-items: center; gap: 5px;
}

.like-btn {
  background: none; border: none;
  width: 30px; height: 30px; font-size: 1.4rem; cursor: pointer;
  transition: background-color 0.2s, transform 0.2s, color 0.2s;
  display: flex; justify-content: center; align-items: center;
  color: #999;
}

.like-btn:hover {
  transform: scale(1.2);
}

.like-btn.liked {
  color: #e74c3c;
}

.like-count {
  font-size: 0.9rem; color: var(--primary-color); font-weight: bold;
}

/* =========================== Load More =========================== */
#load-more-btn {
  display: block; margin: 30px auto; padding: 10px 20px;
  font-size: 1rem; background-color: var(--primary-color);
  color: white; border: none; border-radius: 8px; cursor: pointer;
  box-shadow: var(--shadow-light); transition: background-color 0.2s, transform 0.2s;
}
#load-more-btn:hover { background-color: var(--accent-color); transform: scale(1.05); }

/* =========================== Add Quote Button =========================== */
#add-btn {
  position: fixed; bottom: 20px; right: 20px;
  width: 50px; height: 50px; border-radius: 50%;
  background-color: var(--primary-color); color: white;
  border: none; font-size: 2rem;
  display: flex; justify-content: center; align-items: center;
  cursor: pointer; box-shadow: var(--shadow-medium); z-index: 100;
  transition: background-color 0.2s, transform 0.2s;
}
#add-btn:hover { background-color: var(--accent-color); transform: scale(1.1); }

/* =========================== Overlay & Add Form =========================== */
#overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.6); z-index: 90; transition: opacity 0.3s;
}
#overlay.hidden { opacity: 0; pointer-events: none; }

#add-form {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 500px;
  background-color: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 100;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-height: 90vh;
  overflow-y: auto;
}

/* Mobile-specific positioning to prevent form from moving too high */
@media (max-width: 600px) {
  #add-form {
    top: 10px;
    transform: translate(-50%, 0);
    max-height: calc(100vh - 20px);
    padding: 20px;
  }
  #add-form.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 0) scale(0.95);
  }
}

#add-form.hidden {
  opacity: 0; pointer-events: none; transform: translate(-50%, -50%) scale(0.95);
}
#add-form h2 {
  margin-top: 0; color: var(--primary-color); border-bottom: 2px solid #eee;
  padding-bottom: 10px; margin-bottom: 20px;
}

#quote-input, #author-input, #theme-input {
  width: 100%; padding: 10px; margin-bottom: 15px;
  border: 1px solid #ccc; border-radius: 6px; font-size: 1rem; box-sizing: border-box;
}
#quote-input { resize: vertical; min-height: 100px; }

/* Duplicate Warning */
#duplicate-warning-container {
  margin-bottom: 15px; padding: 10px; border-radius: 6px;
  background-color: #fff3cd; border: 1px solid #ffeeba;
  color: #856404; font-size: 0.9rem;
}
#duplicate-warning-container .duplicate-card {
  padding: 5px; background-color: #fff; border-radius: 4px; margin-top: 5px;
}
#duplicate-warning-container.hidden { display: none; }

/* Duplicate Check Status */
#duplicate-status-container {
  margin-bottom: 15px;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
#duplicate-status-container.loading {
  background-color: #e7f3ff;
  border: 1px solid #b3d9ff;
  color: #004085;
}
#duplicate-status-container.success {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  color: #155724;
}
#duplicate-status-container.hidden { display: none; }

/* Loading Spinner Animation */
.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: #007bff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Checkmark Icon */
.checkmark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #28a745;
  font-size: 1.2rem;
  font-weight: bold;
}

.theme-tag { background-color: var(--accent-color); color: white; padding: 5px 10px; border-radius: 15px; font-size: 0.9em; display: inline-flex; align-items: center; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.remove-tag, .theme-tag .remove-btn { margin-left: 8px; cursor: pointer; font-weight: bold; font-size: 1em; line-height: 1; transition: color 0.2s; border: none; background: transparent; color: rgba(255,255,255,0.9); }
.remove-tag:hover, .theme-tag .remove-btn:hover { color: #f0f0f0; }

/* Container for selected theme tags: allow inline layout and wrapping only when needed */
#selected-themes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

/* Theme dropdown: limit height and make scrollable so it doesn't cover the screen */
#theme-dropdown, .theme-dropdown {
  position: absolute;
  top: calc(100% - 6px);
  left: 0;
  width: 100%;
  max-height: 140px; /* Smaller height so list is compact and scrollable */
  overflow-y: auto;
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: var(--shadow-light);
  z-index: 60;
  box-sizing: border-box;
  padding-bottom: 4px;
}
.theme-dropdown-item, #theme-dropdown .theme-dropdown-item {
  padding: 8px 10px; cursor: pointer; font-size: 0.95rem;
}
.theme-dropdown-item:hover, #theme-dropdown .theme-dropdown-item:hover { background-color: #f5f5f5; }

/* Make the dropdown slightly smaller on very small screens */
@media (max-width: 420px) {
  #theme-dropdown, .theme-dropdown { max-height: 100px; }
}

/* Profile Panel - Full Screen Overlay */
#profile-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f8f9fa;
  z-index: 500;
  overflow-y: auto;
  padding-top: 70px;
  display: flex;
  flex-direction: column;
}

#profile-panel.hidden {
  display: none !important;
}

#profile-panel.visible {
  display: flex !important;
}

/* Profile Close Button */
#profile-close-btn {
  position: fixed;
  top: 15px;
  left: 20px;
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 0.95rem;
  z-index: 501;
  transition: background-color 0.2s;
}

#profile-close-btn:hover {
  background-color: #495057;
}

#profile-info {
  padding: 20px;
  text-align: center;
  background-color: white;
  margin-bottom: 20px;
  border-bottom: 1px solid #eee;
}

#profile-user {
  font-size: 1rem;
  color: #333;
  margin-bottom: 10px;
}

#profile-panel .dropdown-header {
  padding: 15px 20px 10px 20px;
  margin: 0;
  border-bottom: 1px solid #ddd;
  background-color: white;
}

#profile-panel .dropdown-header h3 {
  margin: 0;
  font-size: 1.8rem;
  color: #6c757d;
  text-align: center;
}

#profile-panel .dropdown-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: #6c757d;
}

/* Profile Favorites List */
#profile-favorites-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
  padding: 20px;
  overflow-y: auto;
  flex-grow: 1;
}

.favorite-item {
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
}

.favorite-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fav-text {
  font-size: 1.1rem;
  font-style: italic;
  margin: 0 0 15px 0;
  color: #333;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fav-author {
  font-size: 0.95rem;
  text-align: right;
  font-weight: bold;
  color: #6c757d;
  margin: 10px 0 0 0;
}

.fav-likes {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #666;
}

.fav-likes-icon {
  font-size: 1.1rem;
}

.favorites-empty {
  padding: 30px 20px;
  text-align: center;
  color: #666;
  font-size: 1rem;
  grid-column: 1 / -1;
}

.favorites-empty button {
  margin-top: 15px;
  padding: 8px 16px;
  background-color: #6c757d;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}

.favorites-empty button:hover {
  background-color: #495057;
}

/* Buttons in Add Form */
.button-row { display: flex; gap: 10px; margin-top: 20px; }
.button-row button {
  flex-grow: 1; flex-shrink: 1; flex-basis: 0;
  text-align: center; padding: 10px 15px; border: none; border-radius: 6px;
  cursor: pointer; font-size: 1rem; font-weight: bold;
  transition: background-color 0.2s, transform 0.2s; box-shadow: var(--shadow-light);
  display: flex; justify-content: center; align-items: center; /* Center emoji/text */
}

/* Button Colors */
#suggest-btn { background-color: #ced4da; color: #333; font-size: 1.2rem; } /* Lighter Grey, larger emoji */
#suggest-btn:hover { background-color: #adb5bd; transform: scale(1.03); }

#save-btn { background-color: var(--accent-color); color: white; }
#save-btn:hover { background-color: #343a40; transform: scale(1.03); }

#replace-btn, #clear-btn { background-color: #dc3545; color: white; }
#replace-btn:hover, #clear-btn:hover { background-color: #c82333; transform: scale(1.03); }

.button-row button.hidden, .button-row button[style*="display: none"] { display: none !important; }

#loader {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  padding: 20px; background-color: rgba(255, 255, 255, 0.95);
  border-radius: 8px; box-shadow: var(--shadow-medium);
  z-index: 101; font-size: 1.2rem; color: var(--primary-color);
}
#loader.hidden { display: none; }

/* =========================== Quote Popup =========================== */
#quote-popup {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0, 0, 0, 0.8); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  pointer-events: auto;
}
#quote-popup.hidden { display: none; pointer-events: none; }

.popup-content {
  width: 90%; max-width: 700px; box-sizing: border-box;
  background-color: white; border-radius: 10px; overflow: hidden;
  position: relative; max-height: 90vh;
  display: flex; flex-direction: column;
  background-size: cover; background-position: center;
  overflow-y: auto;
}

.popup-inner {
  position: relative; z-index: 1; padding: 40px 20px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; width: 100%;
  min-height: 100%;
  justify-content: center;
}

.popup-content.light-text .popup-inner .watermark { color: rgba(255,255,255,0.9) !important; }
.popup-content.dark-text .popup-inner .watermark { color: rgba(0,0,0,0.8) !important; }

.popup-quote-text {
  font-size: 2.4rem; font-style: italic; margin-top: 0; margin-bottom: 20px;
  text-align: center;
  white-space: pre-line; /* Preserve line breaks in popup */
}
.popup-quote-author {
  font-size: 1.8rem; text-align: center; font-weight: bold; margin: 0;
}

.popup-actions { display: flex; justify-content: center; gap: 15px; margin-top: 30px; }
.popup-actions button {
  padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer;
  font-size: 1rem; font-weight: bold; transition: background-color 0.2s, transform 0.2s;
  box-shadow: var(--shadow-light);
}

/* Auth & Admin UI */
#auth-toggle-container {
  position: fixed; left: 20px; bottom: 20px; z-index: 110;
  display: flex; align-items: center; gap: 8px;
}
#auth-toggle {
  width: 30px; height: 30px; border-radius: 50%;
  background-color: var(--primary-color); color: white;
  border: none; font-size: 1.2rem; line-height: 1; text-align: center;
  cursor: pointer; box-shadow: var(--shadow-light); transition: transform 0.2s;
}
#auth-toggle:hover { transform: scale(1.1); }
#auth-panel {
  background-color: white; padding: 10px; border-radius: 8px;
  box-shadow: var(--shadow-medium); display: flex; flex-direction: column; gap: 8px;
}

/* Centered modal state for auth panel */
#auth-panel.auth-centered {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
  background: linear-gradient(135deg, #ffffff 0%, #f1f3f5 60%, #e9ecef 100%);
  padding: 24px 26px 28px;
  border: 1px solid #dee2e6;
  box-shadow: 0 14px 32px rgba(33, 37, 41, 0.25);
  animation: authModalFade 0.35s ease;
  z-index: 140;
}
#auth-panel.auth-centered #email-auth-form input[type="email"],
#auth-panel.auth-centered #email-auth-form input[type="password"],
#auth-panel.auth-centered #email-auth-form input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  margin: 6px 0 10px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#auth-panel.auth-centered #email-auth-form input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(73, 80, 87, 0.25);
}
#auth-panel.auth-centered .auth-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}
#auth-panel.auth-centered .auth-btn {
  flex: 1;
  padding: 13px 18px;
  font-size: 0.95rem;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#auth-panel.auth-centered #auth-next-btn {
  background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
  color: #fff;
  font-weight: 600;
}
#auth-panel.auth-centered #auth-next-btn:hover {
  background: linear-gradient(135deg, #343a40 0%, #495057 100%);
}
#auth-panel.auth-centered #auth-cancel-btn {
  background: #e9ecef;
  color: #495057;
  font-weight: 600;
}
#auth-panel.auth-centered #auth-cancel-btn:hover {
  background: #dee2e6;
}
#auth-panel.auth-centered #auth-forgot-link {
  align-self: flex-start;
  font-size: 0.75rem;
  margin-top: -4px;
}
#auth-panel.auth-centered #auth-create-prompt {
  font-size: 0.75rem;
  margin-top: -2px;
  color: #495057;
}
@keyframes authModalFade {
  from { opacity: 0; transform: translate(-50%, -45%) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
/* Smaller screens adjustments */
@media (max-width: 600px) {
  #auth-panel.auth-centered {
    width: 94vw;
    padding: 20px 18px 24px;
    border-radius: 14px;
  }
  #auth-panel.auth-centered .auth-btn {
    font-size: 1rem;
    min-height: 50px;
    padding: 14px 20px;
  }
  #auth-panel.auth-centered #email-auth-form input {
    font-size: 16px;
    padding: 12px 14px;
    min-height: 50px;
  }
  .auth-btn {
    min-height: 48px;
    font-size: 1rem;
    padding: 13px 18px;
  }
}
@media (max-width: 400px) {
  #auth-panel.auth-centered {
    width: 96vw;
    padding: 18px 16px 22px;
  }
  #auth-panel.auth-centered .auth-actions {
    flex-direction: column;
    gap: 12px;
  }
  #auth-panel.auth-centered .auth-btn {
    width: 100%;
    min-height: 52px;
  }
}
.auth-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.3px;
}
.auth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.auth-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Sign In Button - Primary gradient */
#auth-signin-trigger,
#auth-next-btn {
  background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
  color: white;
}
#auth-signin-trigger:hover,
#auth-next-btn:hover {
  background: linear-gradient(135deg, #343a40 0%, #495057 100%);
}
#auth-signin-trigger::before {
  content: '🔐 ';
  margin-right: 6px;
}

/* Google Sign In Button - Brand colors */
#auth-google-btn {
  background: white;
  color: #444;
  border: 1px solid #dadce0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
#auth-google-btn:hover {
  background: #f8f9fa;
  border-color: #c6c9cc;
}
#auth-google-btn::before {
  content: '🌐 ';
  margin-right: 6px;
}

/* Sign Out Button */
#sign-out-btn {
  background: linear-gradient(135deg, #6c757d 0%, #868e96 100%);
  color: white;
}
#sign-out-btn:hover {
  background: linear-gradient(135deg, #5a6268 0%, #6c757d 100%);
}

/* Cancel Button */
#auth-cancel-btn {
  background: #e9ecef;
  color: #495057;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
#auth-cancel-btn:hover {
  background: #dee2e6;
}
#admin-badge {
  background-color: #dc3545; color: white; padding: 5px 10px;
  border-radius: 6px; font-size: 0.8rem; font-weight: bold; text-align: center;
}
.hidden { display: none !important; }

/* Celebration Overlay */
.celebration-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  pointer-events: none;
  overflow: hidden;
}

/* Success Checkmark Animation */
.success-checkmark-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  z-index: 2001;
  pointer-events: none;
  animation: popIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.success-checkmark {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
}

.success-checkmark::before {
  content: '✓';
  font-size: 48px;
  color: white;
  font-weight: bold;
  animation: checkDraw 0.3s ease 0.2s forwards;
  opacity: 0;
}

@keyframes popIn {
  0% {
    transform: translate(-50%, -50%) scale(0);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes checkDraw {
  to {
    opacity: 1;
  }
}

/* Confetti Particle */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f0f;
  animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(0) rotateZ(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotateZ(720deg);
    opacity: 0;
  }
}

.popup-message {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background-color: #444; color: white; padding: 12px 24px; border-radius: 8px;
  font-size: 0.95rem; opacity: 0; transition: all 0.3s ease; z-index: 1000;
}
.popup-message.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.popup-message.success { background-color: #2e7d32; }
.popup-message.error { background-color: #c62828; }
.popup-message.warning { background-color: #f57c00; }
.popup-message.info { background-color: #1565c0; }

/* =========================== Custom Suggestions =========================== */
.custom-suggestions {
  position: absolute;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
  max-height: 240px;
  overflow-y: auto;
  width: 280px;
  padding: 4px 0;
  z-index: 150; /* Above add form */
  display: none;
  font-family: 'Georgia', serif;
  overscroll-behavior: contain;
}
.custom-suggestions.visible { display: block; }
.suggestion-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #333;
  user-select: none;
}
.suggestion-item:hover, .suggestion-item.active { background: #f2f5f9; }
.custom-suggestions:focus { outline: none; }
@media (max-width: 600px) {
  .custom-suggestions {
    max-height: 50vh;
    font-size: 1rem;
  }
}
.custom-suggestions::-webkit-scrollbar { width: 10px; }
.custom-suggestions::-webkit-scrollbar-track { background: #f8f9fa; border-radius: 8px; }
.custom-suggestions::-webkit-scrollbar-thumb { background: #ced4da; border-radius: 8px; }
.custom-suggestions::-webkit-scrollbar-thumb:hover { background: #adb5bd; }


/* Responsive Design */
@media (max-width: 600px) {
  h1 { font-size: 2rem; }
  #quotes-container { grid-template-columns: 1fr; padding: 0 10px; }
  .quote-card { height: 200px; }
  #add-form { padding: 20px; }
  .button-row { flex-direction: column; gap: 8px; }
  .button-row button { width: 100%; }
  #auth-toggle-container { left: 10px; bottom: 10px; }
  #add-btn { right: 10px; bottom: 10px; }
  #auth-panel { position: absolute; bottom: 40px; left: 0; width: 150px; }
  
  /* Mobile popup adjustments */
  .popup-content {
    width: 88%; max-width: 500px; max-height: 75vh; min-height: auto;
  }
  .popup-inner {
    padding: 20px 15px;
  }
  .popup-quote-text {
    font-size: 1.6rem; margin-bottom: 15px;
  }
  .popup-quote-author {
    font-size: 1.2rem;
  }
  .popup-actions button {
    padding: 8px 16px; font-size: 0.9rem;
  }
}