/* Jon's Kitchen - Warm Culinary Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@500;600;700;800&display=swap');

:root {
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Color System */
  --bg-main: #FAF7F2;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F4EFE6;
  --bg-overlay: rgba(26, 23, 21, 0.6);
  
  --primary: #C85A32;
  --primary-hover: #B24C26;
  --primary-light: #FDF0EB;
  
  --secondary: #4A7C59;
  --secondary-light: #EBF4EE;
  
  --text-main: #2C2623;
  --text-muted: #6E6762;
  --text-light: #9B948E;
  
  --border-color: #E6DFC6;
  --border-subtle: #F0EADF;
  
  --shadow-sm: 0 2px 8px rgba(44, 38, 35, 0.05);
  --shadow-md: 0 4px 16px rgba(44, 38, 35, 0.08);
  --shadow-lg: 0 12px 32px rgba(44, 38, 35, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-main: #141211;
  --bg-surface: #1E1B18;
  --bg-surface-elevated: #282420;
  
  --primary: #E06B42;
  --primary-hover: #F07B52;
  --primary-light: #321A12;

  --secondary: #5F9E72;
  --secondary-light: #1A281E;

  --text-main: #F4EFEA;
  --text-muted: #A8A099;
  --text-light: #78716A;

  --border-color: #38322B;
  --border-subtle: #2C2722;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 90px; /* Space for sticky bottom navigation */
}

/* Header & Search Bar */
header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

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

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  background: var(--secondary-light);
  color: var(--secondary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.admin-status-pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid var(--border-color);
}

.admin-status-pill.logged-in {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.admin-status-pill.logged-out {
  background-color: var(--bg-surface-elevated);
  color: var(--text-muted);
}

/* Search Box */
.search-container {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  font-size: 0.95rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--primary);
  background-color: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(200, 90, 50, 0.15);
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* Category Filter Chips */
.categories-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.75rem 1.25rem;
  scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.chip.active, .chip:hover {
  background-color: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Main Recipe Grid */
.main-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
}

.recipes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Recipe Card */
.recipe-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.card-image-wrap {
  position: relative;
  width: 100%;
  height: 180px;
  background-color: var(--bg-surface-elevated);
  overflow: hidden;
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.recipe-card:hover .card-image {
  transform: scale(1.05);
}

.card-category-badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  color: var(--text-main);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
}

.card-body {
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.card-description {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-clamp: 2;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.85rem;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Floating Bottom Navigation / Action Bar */
.bottom-nav {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  backdrop-filter: blur(12px);
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  min-width: 54px;
  text-align: center;
  transition: color 0.2s ease;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--primary);
}

.add-recipe-btn {
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(200, 90, 50, 0.4);
  transition: transform 0.2s ease, background-color 0.2s ease;
  margin: 0 0.15rem;
}

.add-recipe-btn:hover {
  transform: scale(1.08);
  background-color: var(--primary-hover);
}

/* Modal Overlay & Containers */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  transform: translateY(20px);
  transition: transform 0.25s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* Recipe Detail View Modal */
.detail-hero-image {
  width: 100%;
  height: 240px;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin-bottom: 1rem;
}

.servings-calculator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background-color: var(--bg-surface-elevated);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.serv-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ingredient-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px dashed var(--border-subtle);
  font-size: 0.95rem;
}

.ingredient-item.checked {
  text-decoration: line-through;
  color: var(--text-light);
  opacity: 0.6;
}

.instruction-step {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.step-number {
  background-color: var(--primary-light);
  color: var(--primary);
  font-family: var(--font-heading);
  font-weight: 800;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 0.95rem;
  line-height: 1.5;
  padding-top: 0.2rem;
}

/* PIN Keypad Modal */
.pin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  max-width: 280px;
  margin: 1rem auto 0 auto;
}

.pin-btn {
  aspect-ratio: 1;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-color);
  background-color: var(--bg-surface-elevated);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pin-btn:active {
  background-color: var(--primary);
  color: #ffffff;
  transform: scale(0.92);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.pin-dot.filled {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface-elevated);
  color: var(--text-main);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background-color: var(--bg-surface);
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

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

.btn-danger {
  padding: 0.5rem 1rem;
  background-color: #E74C3C;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}

/* Print Mode Stylesheet */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    padding-bottom: 0 !important;
  }

  header, 
  .categories-scroll, 
  .main-container, 
  .bottom-nav, 
  .modal-overlay:not(#recipeDetailModal),
  .close-btn,
  .nav-btn,
  .serv-btn {
    display: none !important;
  }

  #recipeDetailModal {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .modal-card {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .detail-hero-image {
    max-height: 250px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    margin-bottom: 1rem !important;
  }

  .ingredient-item {
    page-break-inside: avoid;
    border-bottom: 1px solid #ddd !important;
  }

  .instruction-step {
    page-break-inside: avoid;
  }
}
