@import '../base/variables.css';

/* ==========================================================================
   Home Page - Apple-inspired minimal design
   ========================================================================== */

:root {
  --home-max-width: 960px;
  --home-section-gap: 48px;
  --home-transition: 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* Page container */
.home-page {
  max-width: var(--home-max-width);
  margin: 0 auto;
  padding: 0 24px 48px;
  color: var(--text-primary, #212529);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.home-hero {
  padding: 48px 0 32px;
  text-align: center;
}

.home-hero__eyebrow {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary, #6c757d);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
}

.home-hero__title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary, #212529);
  margin: 0 0 28px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.home-hero__search {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

/* Search bar */
.home-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-secondary, #f0f2f5);
  border-radius: 980px;
  padding: 12px 16px 12px 20px;
  transition:
    box-shadow var(--home-transition),
    background var(--home-transition);
}

.home-search:focus-within {
  background: var(--bg-secondary, white);
  box-shadow:
    0 0 0 4px rgba(255, 165, 0, 0.15),
    0 2px 12px rgba(0, 0, 0, 0.08);
}

.home-search__icon {
  color: var(--text-secondary, #6c757d);
  font-size: 18px;
  flex-shrink: 0;
}

.home-search__input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary, #212529);
  min-width: 0;
}

.home-search__input::placeholder {
  color: var(--text-secondary, #9ca3af);
}

.home-search__clear {
  background: none;
  border: none;
  color: var(--text-secondary, #9ca3af);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
  transition: color var(--home-transition);
}

.home-search__clear:hover {
  color: var(--text-primary, #212529);
}

/* Search suggestions dropdown */
.home-search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-secondary, white);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  z-index: 100;
}

.home-search-suggestions__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-primary, #212529);
  text-align: left;
  transition: background var(--home-transition);
}

.home-search-suggestions__item:hover {
  background: var(--bg-tertiary, #f0f2f5);
}

.home-search-suggestions__item i {
  color: var(--accent-primary, #ffa500);
  font-size: 16px;
}

.home-search-suggestions__item + .home-search-suggestions__item {
  border-top: 1px solid var(--border-color, #e5e7eb);
}

/* ==========================================================================
   Section Layout
   ========================================================================== */

.home-section {
  margin-top: var(--home-section-gap);
}

.home-section__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.home-section__title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #212529);
  margin: 0;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.home-section__subtitle {
  font-size: 14px;
  color: var(--text-secondary, #6c757d);
  margin: 4px 0 0;
}

.home-section__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--accent-primary, #ffa500);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  white-space: nowrap;
  transition: opacity var(--home-transition);
}

.home-section__link:hover {
  opacity: 0.7;
}

/* ==========================================================================
   Quick Access Chips
   ========================================================================== */

.home-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.home-chips::-webkit-scrollbar {
  display: none;
}

.home-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  background: var(--bg-secondary, #f0f2f5);
  border: none;
  border-radius: 980px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary, #212529);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--home-transition);
}

.home-chip:hover {
  background: var(--bg-tertiary, #e2e5e9);
}

.home-chip i {
  font-size: 16px;
  color: var(--accent-primary, #ffa500);
}

/* ==========================================================================
   AI Recommendation Cards
   ========================================================================== */

.home-recommendations__loading,
.home-recommendations__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* Place card */
.home-place-card {
  background: var(--bg-secondary, white);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition:
    transform var(--home-transition),
    box-shadow var(--home-transition);
}

.home-place-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.home-place-card__image {
  position: relative;
  height: 220px;
  overflow: hidden;
}

.home-place-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.home-place-card:hover .home-place-card__image img {
  transform: scale(1.03);
}

.home-place-card__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent);
  pointer-events: none;
}

.home-place-card__rating {
  position: absolute;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: white;
  padding: 4px 10px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 600;
}

.home-place-card__rating i {
  color: #ffd700;
  font-size: 12px;
}

.home-place-card__fav {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary, #9ca3af);
  font-size: 18px;
  transition:
    transform var(--home-transition),
    color var(--home-transition);
}

.home-place-card__fav:hover {
  transform: scale(1.08);
}

.home-place-card__fav--active {
  color: #ff4757;
}

.home-place-card__body {
  padding: 16px;
}

.home-place-card__name {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-primary, #212529);
  margin: 0 0 6px;
  line-height: 1.3;
}

.home-place-card__category {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary, #6c757d);
  margin-bottom: 8px;
}

.home-place-card__reason {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-primary, #ffa500);
  background: rgba(255, 165, 0, 0.08);
  padding: 4px 10px;
  border-radius: 980px;
}

/* ==========================================================================
   Stats Section
   ========================================================================== */

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-secondary, white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.home-stats__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  text-align: center;
}

.home-stats__item + .home-stats__item {
  border-left: 1px solid var(--border-color, #e5e7eb);
}

.home-stats__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary, #212529);
  line-height: 1.2;
  margin-bottom: 4px;
}

.home-stats__label {
  font-size: 12px;
  color: var(--text-secondary, #6c757d);
  font-weight: 500;
}

/* ==========================================================================
   Login CTA
   ========================================================================== */

.home-login-cta {
  max-width: 480px;
  margin: 0 auto;
  text-align: center;
  background: var(--bg-secondary, white);
  border-radius: 16px;
  padding: 40px 32px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.home-login-cta__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary, #212529);
  margin: 0 0 8px;
}

.home-login-cta__desc {
  font-size: 15px;
  color: var(--text-secondary, #6c757d);
  margin: 0 0 24px;
}

.home-login-cta__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.home-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 28px;
  border-radius: 980px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    opacity var(--home-transition),
    transform var(--home-transition);
}

.home-btn:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.home-btn--primary {
  background: var(--accent-primary, #ffa500);
  color: white;
  border: none;
}

.home-btn--secondary {
  background: transparent;
  color: var(--accent-primary, #ffa500);
  border: 1.5px solid var(--accent-primary, #ffa500);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.home-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary, #6c757d);
}

.home-empty i {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
  opacity: 0.4;
}

.home-empty p {
  font-size: 15px;
  margin: 0;
}

/* ==========================================================================
   Error
   ========================================================================== */

.home-error {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: #dc3545;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  cursor: pointer;
  font-size: 14px;
}

.home-error__close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 2px;
}

/* ==========================================================================
   Dark Mode
   ========================================================================== */

[data-theme='dark'] .home-page {
  color: var(--text-primary, #e0e0e0);
}

[data-theme='dark'] .home-hero__title {
  color: var(--text-primary, #ffffff);
}

[data-theme='dark'] .home-search {
  background: var(--bg-secondary, #1e1e1e);
}

[data-theme='dark'] .home-search:focus-within {
  background: var(--bg-secondary, #252525);
  box-shadow:
    0 0 0 4px rgba(255, 165, 0, 0.2),
    0 2px 12px rgba(0, 0, 0, 0.3);
}

[data-theme='dark'] .home-search__input {
  color: var(--text-primary, #e0e0e0);
}

[data-theme='dark'] .home-search-suggestions {
  background: var(--bg-secondary, #1e1e1e);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

[data-theme='dark'] .home-search-suggestions__item:hover {
  background: var(--bg-tertiary, #2a2a2a);
}

[data-theme='dark'] .home-search-suggestions__item + .home-search-suggestions__item {
  border-top-color: var(--border-color, #333333);
}

[data-theme='dark'] .home-chip {
  background: var(--bg-secondary, #1e1e1e);
  color: var(--text-primary, #e0e0e0);
}

[data-theme='dark'] .home-chip:hover {
  background: var(--bg-tertiary, #2a2a2a);
}

[data-theme='dark'] .home-place-card {
  background: var(--bg-secondary, #1e1e1e);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme='dark'] .home-place-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

[data-theme='dark'] .home-place-card__overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
}

[data-theme='dark'] .home-place-card__fav {
  background: rgba(30, 30, 30, 0.85);
  color: var(--text-secondary, #888);
}

[data-theme='dark'] .home-place-card__name {
  color: var(--text-primary, #ffffff);
}

[data-theme='dark'] .home-place-card__reason {
  background: rgba(255, 165, 0, 0.12);
}

[data-theme='dark'] .home-stats {
  background: var(--bg-secondary, #1e1e1e);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme='dark'] .home-stats__item + .home-stats__item {
  border-left-color: var(--border-color, #333333);
}

[data-theme='dark'] .home-stats__value {
  color: var(--text-primary, #ffffff);
}

[data-theme='dark'] .home-login-cta {
  background: var(--bg-secondary, #1e1e1e);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme='dark'] .home-login-cta__title {
  color: var(--text-primary, #ffffff);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  :root {
    --home-section-gap: 36px;
  }

  .home-hero {
    padding: 32px 0 24px;
  }

  .home-hero__title {
    font-size: 26px;
  }

  .home-section__title {
    font-size: 19px;
  }

  .home-recommendations__loading,
  .home-recommendations__grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .home-place-card__image {
    height: 180px;
  }

  .home-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .home-stats__item:nth-child(3) {
    border-left: none;
    border-top: 1px solid var(--border-color, #e5e7eb);
  }

  .home-stats__item:nth-child(4) {
    border-top: 1px solid var(--border-color, #e5e7eb);
  }

  [data-theme='dark'] .home-stats__item:nth-child(3),
  [data-theme='dark'] .home-stats__item:nth-child(4) {
    border-top-color: var(--border-color, #333333);
  }
}

@media (max-width: 480px) {
  .home-page {
    padding: 0 16px 40px;
  }

  .home-hero__title {
    font-size: 22px;
  }

  .home-hero__eyebrow {
    font-size: 13px;
  }

  .home-recommendations__loading,
  .home-recommendations__grid {
    grid-template-columns: 1fr;
  }

  .home-login-cta {
    padding: 32px 20px;
  }

  .home-login-cta__actions {
    flex-direction: column;
  }

  .home-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
