/**
 * ============================================================================
 * FOOD OS - WARM CULINARY MODERNISM DESIGN SYSTEM
 * Hệ quy chuẩn giao diện Ẩm Thực Thông Minh & Game Hóa
 * Dựa trên tài liệu quy chuẩn DESIGN.md & mẫu stitch_ai_culinary_experience_platform
 * ============================================================================
 */

@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&family=Epilogue:wght@600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

:root {
  /* Core Color Tokens (Warm Culinary Modernism) */
  --md-sys-color-primary: #a63605;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #c74d1f;
  --md-sys-color-on-primary-container: #fffbff;
  --md-sys-color-primary-fixed: #ffdbd0;
  --md-sys-color-primary-fixed-dim: #ffb59c;

  --md-sys-color-secondary: #1a6c38;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #a3f5b3;
  --md-sys-color-on-secondary-container: #22723e;

  --md-sys-color-tertiary: #7b5500;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #9b6b00;
  --md-sys-color-tertiary-fixed: #ffdead;
  --md-sys-color-tertiary-fixed-dim: #fabc4d;

  --md-sys-color-surface: #fff8f6;
  --md-sys-color-surface-dim: #e4d7d4;
  --md-sys-color-surface-bright: #fff8f6;
  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #fef1ed;
  --md-sys-color-surface-container: #f8ebe8;
  --md-sys-color-surface-container-high: #f2e6e2;
  --md-sys-color-surface-container-highest: #ece0dc;

  --md-sys-color-on-surface: #201a18;
  --md-sys-color-on-surface-variant: #58423a;
  --md-sys-color-outline: #8c7169;
  --md-sys-color-outline-variant: #e0c0b6;
  --md-sys-color-surface-tint: #a93807;
  --md-sys-color-error: #ba1a1a;

  /* Typography Families */
  --font-heading: 'Epilogue', system-ui, -apple-system, sans-serif;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
}

/* Hide Alpine.js uninitialized elements */
[x-cloak] {
  display: none !important;
}

/* Global Reset & Base Typography */
html, body {
  background-color: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .font-heading, .font-display-hero, .font-headline-lg, .font-headline-md, .font-headline-sm {
  font-family: var(--font-heading);
  color: var(--md-sys-color-on-surface);
  letter-spacing: -0.02em;
}

/* Material Symbols Styling */
.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
  display: inline-block;
}
.material-symbols-outlined.fill-1,
.material-symbols-outlined[style*="'FILL' 1"] {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Glassmorphism & Header */
.foodos-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  background-color: rgba(255, 248, 246, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(224, 192, 182, 0.35);
  transition: all 0.3s ease;
}

.foodos-nav-link {
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9999px;
  text-decoration: none;
  transition: all 0.2s ease;
}
.foodos-nav-link:hover {
  color: var(--md-sys-color-primary);
  background-color: rgba(166, 54, 5, 0.06);
}
.foodos-nav-link.active {
  color: var(--md-sys-color-primary);
  background-color: rgba(166, 54, 5, 0.1);
  font-weight: 700;
}

/* Gamification Badge in Header */
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 9999px;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid rgba(224, 192, 182, 0.4);
  font-size: 12px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
}

/* Hero Section & Glowing Orbs */
.hero-atmosphere {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(254, 241, 237, 0.8) 0%, #fff8f6 60%, #fff8f6 100%);
  padding-top: 48px;
  padding-bottom: 72px;
}
.hero-glow-1 {
  position: absolute;
  top: -140px;
  left: 50%;
  transform: translateX(-50%);
  width: 1000px;
  height: 480px;
  background: radial-gradient(circle, rgba(255, 219, 208, 0.6) 0%, rgba(255, 181, 156, 0.2) 50%, transparent 80%);
  border-radius: 9999px;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}
.hero-glow-2 {
  position: absolute;
  top: 40px;
  left: 40px;
  width: 180px;
  height: 180px;
  background: rgba(255, 222, 173, 0.4);
  border-radius: 50%;
  filter: blur(40px);
  pointer-events: none;
  z-index: 0;
}
.hero-glow-3 {
  position: absolute;
  top: 80px;
  right: 40px;
  width: 240px;
  height: 240px;
  background: rgba(199, 77, 31, 0.15);
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  z-index: 0;
}

/* Main Massive Search Bar */
.hero-search-wrapper {
  background-color: var(--md-sys-color-surface-container-lowest);
  padding: 8px 10px;
  border-radius: 9999px;
  box-shadow: 0 12px 40px rgba(166, 54, 5, 0.12);
  border: 2px solid rgba(166, 54, 5, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hero-search-wrapper:hover {
  border-color: rgba(166, 54, 5, 0.45);
}
.hero-search-wrapper:focus-within {
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 16px 48px rgba(166, 54, 5, 0.22);
}

.hero-search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-body);
  font-size: 16px;
  padding: 8px 12px;
}
.hero-search-input::placeholder {
  color: var(--md-sys-color-outline);
}

.btn-ai-search {
  background: linear-gradient(135deg, #a63605 0%, #c74d1f 100%);
  color: #ffffff !important;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 12px 28px;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(166, 54, 5, 0.35);
  transition: all 0.25s ease;
  white-space: nowrap;
  cursor: pointer;
}
.btn-ai-search:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 24px rgba(166, 54, 5, 0.45);
  background: linear-gradient(135deg, #832700 0%, #a63605 100%);
}

/* Quick Appetite Tag Pills */
.appetite-tag {
  background-color: var(--md-sys-color-surface-container-lowest);
  border: 1px solid rgba(224, 192, 182, 0.45);
  color: var(--md-sys-color-on-surface);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}
.appetite-tag:hover {
  background-color: var(--md-sys-color-primary-fixed);
  border-color: rgba(166, 54, 5, 0.3);
  color: var(--md-sys-color-primary);
  transform: translateY(-1px);
}
.appetite-tag .emoji {
  font-size: 16px;
  transition: transform 0.2s ease;
}
.appetite-tag:hover .emoji {
  transform: scale(1.25);
}

/* Tầng 2: Tủ Lạnh Widget Box */
.fridge-widget-box {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 24px;
  padding: 28px 32px;
  border: 1px solid rgba(224, 192, 182, 0.4);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.fridge-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 16px;
  background-color: var(--md-sys-color-surface-container-low);
  border: 1px solid rgba(224, 192, 182, 0.35);
  font-size: 14px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface);
  transition: all 0.2s ease;
}
.fridge-chip:hover {
  background-color: var(--md-sys-color-surface-container);
}
.fridge-chip .chip-delete {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--md-sys-color-outline);
  cursor: pointer;
  transition: color 0.2s ease;
}
.fridge-chip .chip-delete:hover {
  color: var(--md-sys-color-error);
}

/* Tầng 3: Recipe Card 4:3 Aspect Ratio */
.recipe-card-hero {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(224, 192, 182, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
}
.recipe-card-hero:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(166, 54, 5, 0.12);
  border-color: rgba(166, 54, 5, 0.25);
}

.recipe-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--md-sys-color-surface-container);
}
.recipe-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.recipe-card-hero:hover .recipe-card-media img {
  transform: scale(1.06);
}

.recipe-fav-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--md-sys-color-on-surface-variant);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
  z-index: 2;
}
.recipe-fav-btn:hover {
  color: var(--md-sys-color-error);
  background: #ffffff;
  transform: scale(1.1);
}

.btn-cook-now {
  background: var(--md-sys-color-primary);
  color: #ffffff !important;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
  border-radius: 9999px;
  padding: 8px 18px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  text-decoration: none;
  transition: all 0.2s ease;
}
.btn-cook-now:hover {
  background: var(--md-sys-color-primary-container);
  box-shadow: 0 4px 12px rgba(166, 54, 5, 0.3);
}

/* Tầng 4: Creator / Chef Spotlight Card */
.creator-card {
  background-color: var(--md-sys-color-surface-container-lowest);
  border-radius: 24px;
  padding: 24px;
  border: 1px solid rgba(224, 192, 182, 0.35);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  transition: all 0.25s ease;
}
.creator-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  transform: translateY(-2px);
}

/* Call to Action Banner */
.cta-ai-banner {
  background: linear-gradient(135deg, #a63605 0%, #c74d1f 50%, #a93807 100%);
  border-radius: 28px;
  color: #ffffff;
  padding: 40px 48px;
  box-shadow: 0 16px 40px rgba(166, 54, 5, 0.25);
  position: relative;
  overflow: hidden;
}

/* Footer Styling */
.foodos-footer {
  background-color: var(--md-sys-color-surface-container-low);
  padding-top: 56px;
  padding-bottom: 48px;
  border-top: 1px solid rgba(224, 192, 182, 0.35);
  font-family: var(--font-body);
}
.foodos-footer a {
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  transition: color 0.2s ease;
}
.foodos-footer a:hover {
  color: var(--md-sys-color-primary);
}

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(224, 192, 182, 0.4);
  z-index: 1050;
  display: flex;
  justify-content: space-around;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.mobile-bottom-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  padding: 4px 10px;
  transition: all 0.2s ease;
}
.mobile-bottom-item.active {
  color: var(--md-sys-color-primary);
  font-weight: 700;
}
.mobile-bottom-item .material-symbols-outlined {
  font-size: 22px;
  margin-bottom: 2px;
}
