/* ==========================================================================
   03 명언 검색 - Google Style Minimalist Design CSS
   ========================================================================== */

:root {
  --bg-color: #ffffff;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #70757a;
  --search-border: #dfe1e5;
  --search-hover-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
  --search-focus-shadow: 0 2px 8px rgba(32, 33, 36, 0.22);
  --btn-bg: #f8f9fa;
  --btn-border: #f8f9fa;
  --btn-hover-bg: #f1f3f4;
  --btn-hover-border: #dadce0;
  --card-bg: #ffffff;
  --card-border: #ebebeb;
  --tag-bg: #f1f3f4;
  --tag-text: #3c4043;
  --tag-hover: #e8eaed;
  --blue: #4285f4;
  --red: #ea4335;
  --yellow: #fbbc05;
  --green: #34a853;
  --dropdown-bg: #ffffff;
  --dropdown-hover: #f1f3f4;
  --footer-bg: #f2f2f2;
  --footer-border: #dadce0;
  --highlight-bg: #ffe082;
  --highlight-color: #202124;
  --toast-bg: rgba(32, 33, 36, 0.9);
  --toast-text: #ffffff;
}

[data-theme="dark"] {
  --bg-color: #202124;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0a6;
  --text-muted: #80868b;
  --search-border: #5f6368;
  --search-hover-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  --search-focus-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  --btn-bg: #303134;
  --btn-border: #303134;
  --btn-hover-bg: #3c4043;
  --btn-hover-border: #5f6368;
  --card-bg: #2b2c2f;
  --card-border: #3c4043;
  --tag-bg: #303134;
  --tag-text: #bdc1c6;
  --tag-hover: #3c4043;
  --dropdown-bg: #303134;
  --dropdown-hover: #3c4043;
  --footer-bg: #171717;
  --footer-border: #303134;
  --highlight-bg: #f9ab00;
  --highlight-color: #202124;
  --toast-bg: rgba(232, 234, 237, 0.95);
  --toast-text: #202124;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans KR", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* ==========================================================================
   Header
   ========================================================================== */
.main-header {
  height: 60px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
}

.header-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

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

.db-status-badge {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: auto;
  padding: 4px 10px;
  border-radius: 12px;
  background-color: var(--tag-bg);
}

.db-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
  box-shadow: 0 0 0 2px rgba(52, 168, 83, 0.2);
  display: inline-block;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Main App Container
   ========================================================================== */
.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  transition: all 0.3s ease;
}

/* 활성 검색 모드일 때 (상단으로 전환) */
.app-container.has-searched {
  justify-content: flex-start;
  padding-top: 30px;
}

/* ==========================================================================
   Google-Style Logo
   ========================================================================== */
.logo-wrapper {
  margin-bottom: 28px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.logo-wrapper:hover {
  transform: scale(1.02);
}

.google-logo {
  font-size: 72px;
  font-weight: 700;
  letter-spacing: -2px;
  display: inline-flex;
  line-height: 1;
  font-family: 'Product Sans', 'Futura', -apple-system, sans-serif;
}

.app-container.has-searched .google-logo {
  font-size: 46px;
}

.logo-blue { color: var(--blue); }
.logo-red { color: var(--red); }
.logo-yellow { color: var(--yellow); }
.logo-green { color: var(--green); }

.logo-sub {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 600;
}

/* ==========================================================================
   Search Box Container & Input
   ========================================================================== */
.search-wrapper {
  width: 100%;
  max-width: 630px;
  position: relative;
  margin-bottom: 24px;
}

.search-box {
  width: 100%;
  height: 50px;
  border: 1px solid var(--search-border);
  border-radius: 25px;
  background-color: var(--bg-color);
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: relative;
  z-index: 20;
  transition: box-shadow 0.2s ease, border-color 0.2s ease, border-radius 0.2s ease;
}

.search-box:hover {
  box-shadow: var(--search-hover-shadow);
  border-color: transparent;
}

.search-wrapper.open .search-box {
  border-radius: 24px 24px 0 0;
  box-shadow: var(--search-focus-shadow);
  border-color: transparent;
}

.search-icon {
  width: 20px;
  height: 20px;
  fill: var(--text-muted);
  margin-right: 12px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
  padding: 4px 0;
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-icon-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.action-icon-btn:hover {
  background-color: var(--btn-hover-bg);
  color: var(--text-primary);
}

.action-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.clear-btn {
  display: none;
}
.clear-btn.visible {
  display: flex;
}

/* ==========================================================================
   Realtime Search Dropdown (Autocomplete Suggestions)
   ========================================================================== */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--dropdown-bg);
  border-radius: 0 0 24px 24px;
  box-shadow: var(--search-focus-shadow);
  border-top: 1px solid var(--card-border);
  z-index: 15;
  overflow: hidden;
  display: none;
  padding: 8px 0;
}

.search-wrapper.open .suggestions-dropdown {
  display: block;
}

.suggestion-section-title {
  padding: 6px 18px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  padding: 10px 18px;
  cursor: pointer;
  transition: background-color 0.1s ease;
  gap: 12px;
}

.suggestion-item:hover,
.suggestion-item.active {
  background-color: var(--dropdown-hover);
}

.suggestion-icon {
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
  flex-shrink: 0;
}

.suggestion-content {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.suggestion-highlight {
  font-weight: 700;
  color: var(--blue);
}

.suggestion-tag {
  font-size: 11px;
  padding: 2px 6px;
  background-color: var(--tag-bg);
  color: var(--text-secondary);
  border-radius: 10px;
  margin-left: 8px;
}

/* ==========================================================================
   Search Buttons (Google Search & I'm Feeling Lucky)
   ========================================================================== */
.button-row {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.google-btn {
  background-color: var(--btn-bg);
  border: 1px solid var(--btn-border);
  color: var(--text-secondary);
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  font-weight: 500;
}

.google-btn:hover {
  background-color: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ==========================================================================
   Trending Keyword Chips (실시간 인기 검색어)
   ========================================================================== */
.trending-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 630px;
  margin-bottom: 30px;
}

.chips-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip {
  background-color: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid transparent;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip:hover {
  background-color: var(--tag-hover);
  color: var(--text-primary);
  border-color: var(--search-border);
  transform: translateY(-1px);
}

.chip.active {
  background-color: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
}

/* ==========================================================================
   Results Feed Area
   ========================================================================== */
.results-container {
  width: 100%;
  max-width: 720px;
  display: none;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.results-container.visible {
  display: flex;
}

.results-meta {
  font-size: 13px;
  color: var(--text-muted);
  padding: 0 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quote-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-category {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background-color: rgba(66, 133, 244, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.card-btn.liked {
  color: var(--red);
}

.card-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.quote-text {
  font-size: 18px;
  line-height: 1.6;
  font-weight: 500;
  color: var(--text-primary);
  word-break: keep-all;
}

.quote-text::before {
  content: "“";
  font-size: 26px;
  color: var(--blue);
  margin-right: 4px;
  font-family: serif;
}

.quote-text::after {
  content: "”";
  font-size: 26px;
  color: var(--blue);
  margin-left: 4px;
  font-family: serif;
}

.quote-author-wrapper {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.quote-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.quote-author-en {
  font-size: 12px;
  color: var(--text-muted);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.card-tag {
  font-size: 11px;
  color: var(--text-muted);
  background-color: var(--tag-bg);
  padding: 2px 8px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.card-tag:hover {
  background-color: var(--tag-hover);
  color: var(--text-primary);
}

/* 일치 검색어 하이라이트 */
mark {
  background-color: var(--highlight-bg);
  color: var(--highlight-color);
  padding: 0 2px;
  border-radius: 2px;
}

/* ==========================================================================
   Google-Style Pagination
   ========================================================================== */
.pagination-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 32px;
  margin-bottom: 24px;
  width: 100%;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.page-btn {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 50%;
  border: 1px solid transparent;
  background-color: transparent;
  color: var(--blue);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.page-btn:hover:not(:disabled):not(.active) {
  background-color: var(--btn-hover-bg);
  border-color: var(--btn-hover-border);
  color: var(--text-primary);
}

.page-btn.active {
  background-color: var(--blue);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(66, 133, 244, 0.35);
  cursor: default;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  color: var(--text-muted);
}

.page-nav-btn {
  border-radius: 20px;
  padding: 0 14px;
  min-width: auto;
  gap: 4px;
}

.page-dots {
  color: var(--text-muted);
  padding: 0 4px;
  user-select: none;
  font-size: 14px;
}

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  fill: var(--text-muted);
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 14px;
}

/* ==========================================================================
   Lucky Modal / Random Modal
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 20px;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: var(--card-bg);
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
  text-align: center;
  position: relative;
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
}

.modal-close-btn:hover {
  background-color: var(--btn-hover-bg);
}

.modal-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  color: var(--yellow);
  background-color: rgba(251, 188, 5, 0.15);
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.modal-quote {
  font-size: 22px;
  line-height: 1.5;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  word-break: keep-all;
}

.modal-author {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(40px);
  background-color: var(--toast-bg);
  color: var(--toast-text);
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ==========================================================================
   Footer (Google Style)
   ========================================================================== */
.main-footer {
  background-color: var(--footer-bg);
  color: var(--text-secondary);
  font-size: 14px;
  border-top: 1px solid var(--footer-border);
  margin-top: auto;
}

.footer-top {
  padding: 12px 24px;
  border-bottom: 1px solid var(--footer-border);
  font-size: 13px;
  color: var(--text-muted);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding: 10px 24px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
  .google-logo {
    font-size: 52px;
  }
  .app-container.has-searched .google-logo {
    font-size: 38px;
  }
  .search-input {
    font-size: 14px;
  }
  .button-row {
    flex-direction: row;
    width: 100%;
    justify-content: center;
  }
  .google-btn {
    font-size: 13px;
    padding: 8px 14px;
  }
  .quote-text {
    font-size: 16px;
  }
  .footer-bottom {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
  }
}
