/* 
 * FoodStudio Mobile-First Responsive Styles
 * 
 * This file contains mobile-first responsive styles for the FoodStudio app.
 * All styles are written mobile-first, then enhanced for larger screens.
 * 
 * Breakpoints:
 * - Mobile: 320px - 767px (default, no media query needed)
 * - Tablet: 768px - 1023px
 * - Desktop: 1024px and up
 * 
 * For intern learning: Always start with mobile styles, then use min-width 
 * media queries to enhance for larger screens.
 */

/* =============================================================================
   MOBILE-FIRST BASE STYLES
   ============================================================================= */

/* Ensure all elements are mobile-friendly by default */
* {
  box-sizing: border-box;
}

/* Mobile-first body and typography */
body {
  font-size: 16px; /* Minimum readable size on mobile */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%; /* Prevent iOS text scaling */
  -webkit-font-smoothing: antialiased;
}

/* Mobile-friendly links and buttons */
a, button {
  min-height: 44px; /* iOS recommended touch target size */
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* =============================================================================
   NAVIGATION - MOBILE FIRST
   ============================================================================= */

.fs-nav {
  display: flex;
  flex-direction: column; /* Stack vertically on mobile */
  padding: 12px 16px;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/*.fs-nav__left,*/
/*.fs-nav__center,*/
/*.fs-nav__right {*/
/*  display: flex;*/
/*  align-items: center;*/
/*  justify-content: center;*/
/*  width: 100%;*/
/*}*/

.fs-nav__left {
  justify-content: flex-start;
}

.fs-nav__right {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

/* Mobile logo sizing */
.fs-nav__left img {
  max-height: 100px;
  width: 119px;
}

/* Mobile search form */
.fs-search {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.fs-search__input {
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  font-size: 16px; /* Prevent zoom on iOS */
  background: var(--surface);
  color: var(--text);
}

.fs-search__go {
  height: 44px;
  width: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 18px;
  cursor: pointer;
}

/* Mobile navigation buttons */
.fs-iconbtn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 16px;
}

.fs-premium {
  padding: 8px 16px;
  height: 44px;
  border: 1px solid var(--text);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
}

.fs-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--text);
  color: var(--surface);
  border: none;
  font-weight: 800;
  font-size: 16px;
}

/* =============================================================================
   RECIPE CARDS AND GRIDS - MOBILE FIRST
   ============================================================================= */

/* Recipe container - mobile first */
.recipe-container {
  max-width: 100%;
  margin: 0;
  padding: 16px;
}

.recipe-card {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}

/* Mobile recipe header - stack vertically */
.recipe-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  text-align: center;
}

.recipe-image {
  align-self: center;
}

.recipe-image img {
  width: 200px;
  height: 200px;
  border-radius: 12px;
  object-fit: cover;
}

.recipe-title {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--heading);
  margin: 0 0 8px;
}

.recipe-source {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* Mobile recipe meta - stack pills */
.recipe-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* Mobile servings controls */
.servings .btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

/* Mobile recipe actions */
/*.recipe-actions {*/
/*  display: table-cell;*/
/*  flex-direction: column;*/
/*  gap: 8px;*/
/*  width: 100%;*/
/*}*/

.save-button {
  height: 44px;
  padding: 0 20px;
  border-radius: 22px;
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Mobile recipe controls */
.recipe-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 20px 16px;
}

.control-button {
  height: 40px;
  padding: 0 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  flex: 1;
  min-width: 80px;
}

/* Mobile recipe body - single column */
.recipe-body {
  display: block;
  padding: 0 20px 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--heading);
  margin: 24px 0 16px;
}

/* Mobile ingredients list */
.ingredients-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

.ingredient-item {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.ingredient-item:last-child {
  border-bottom: none;
}

.ingredient-checkbox {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.ingredient-text {
  flex: 1;
  font-size: 16px;
  line-height: 1.4;
}

/* Mobile instructions */
.instructions-list {
  counter-reset: step;
  margin: 0;
  padding: 0;
  list-style: none;
}

.instruction-item {
  position: relative;
  padding: 16px 0 16px 50px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  line-height: 1.5;
}

.instruction-item:last-child {
  border-bottom: none;
}

.instruction-item::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =============================================================================
   GROCERY LISTS - MOBILE FIRST
   ============================================================================= */

.gl-container {
  display: block;
  padding: 16px;
}

.gl-card {
  width: 100%;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.gl-head {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}

.gl-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--heading);
  text-align: center;
}

.gl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.gl-btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gl-btn--primary {
  background: var(--accent);
  color: white;
}

.gl-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

/* Mobile grocery list items */
.gl-row {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.gl-row:last-child {
  border-bottom: none;
}

.gl-check {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
}

.gl-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.gl-text {
  min-width: 0;
  padding-top: 12px;
}

.gl-name {
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  font-size: 16px;
}

.gl-meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 4px;
  line-height: 1.3;
}

.gl-more {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
}

/* =============================================================================
   FORMS - MOBILE FIRST
   ============================================================================= */

/* Mobile-friendly form inputs */
input, select, textarea {
  width: 100%;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* Prevent zoom on iOS */
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  height: auto;
  min-height: 100px;
  padding: 16px;
  resize: vertical;
}

/* Mobile form labels */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 16px;
}

/* Mobile form buttons */
.btn, button[type="submit"] {
  width: 29%;
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 22px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

/* =============================================================================
   MODALS - MOBILE FIRST
   ============================================================================= */

.fs-modal__panel {
  width: 95vw;
  max-width: 95vw;
  max-height: 90vh;
  margin: 16px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fs-modal__header {
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fs-modal__title {
  font-size: 18px;
  font-weight: 800;
  color: var(--heading);
  margin: 0;
}

.fs-modal__body {
  padding: 20px;
  overflow: auto;
  flex: 1;
}

.fs-modal__footer {
  padding: 16px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* =============================================================================
   RECIPES INDEX - MOBILE FIRST
   ============================================================================= */

.recipes-index {
  padding: 16px;
}

.recipes-index-head {
  margin-bottom: 24px;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--heading);
  margin: 0 0 16px;
  text-align: center;
}

.index-search {
  display: flex;
  gap: 8px;
}

.index-search-input {
  flex: 1;
  height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
}

.index-search-btn {
  height: 44px;
  padding: 0 20px;
  border: none;
  border-radius: 22px;
  background: var(--accent);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

/* Mobile recipe grid */
.recipes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.recipe-card-item {
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rc-thumb-wrap {
  display: block;
  text-decoration: none;
}

.rc-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.rc-thumb.placeholder {
  height: 200px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: var(--muted);
}

/*.rc-body {*/
/*  padding: 12px;*/
/*}*/

.rc-title {
  margin: 0px 13px 0px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}

.rc-title a {
  color: var(--heading);
  text-decoration: none;
  min-height: auto;
  min-width: auto;
  display: inline;
}

.rc-actions {
  display: flex;
  gap: 8px;
}

.rc-btn {
  flex: 1;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rc-btn--primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.rc-btn--danger {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}

/* =============================================================================
   TABLET STYLES (768px and up)
   ============================================================================= */

@media (min-width: 768px) {
  /* Navigation improvements for tablet */
  .fs-nav {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
  }
  
  .fs-nav__left,
  .fs-nav__center,
  .fs-nav__right {
    width: auto;
  }
  
  .fs-nav__center {
    flex: 1;
    max-width: 600px;
    margin: 0 24px;
  }
  
  /* Recipe header side-by-side on tablet */
  .recipe-header {
    flex-direction: row;
    text-align: left;
    align-items: flex-start;
    gap: 24px;
  }
  
  .recipe-image {
    flex-shrink: 0;
  }
  
  .recipe-info {
    flex: 1;
  }
  
  .recipe-title {
    font-size: 28px;
  }
  
  /* Recipe meta horizontal on tablet */
  .recipe-meta {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }
  
  .recipe-actions {
    flex-direction: row;
    width: auto;
  }
  
  /* Recipe grid 2 columns on tablet */
  .recipes-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
  
  /* Grocery list improvements */
  .gl-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .gl-title {
    text-align: left;
  }
  
  .gl-actions {
    justify-content: flex-end;
  }
  
  /* Modal improvements */
  .fs-modal__panel {
    width: 90vw;
    max-width: 600px;
    margin: 32px;
  }
  
  /* Form improvements */
  .btn, button[type="submit"] {
    width: auto;
    min-width: 120px;
  }
  
  /* Footer improvements for tablet */
  .mobile-footer__inner {
    max-width: 800px;
    padding: 0 32px;
  }
  
  .mobile-footer__brand {
    text-align: center;
  }
  
  .mobile-footer__links {
    gap: 20px 32px;
  }
  
  .mobile-footer__bottom {
    margin-top: 16px;
  }
}

/* =============================================================================
   DESKTOP STYLES (1024px and up)
   ============================================================================= */

@media (min-width: 1024px) {
  /* Container max-widths for desktop */
  .recipe-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 32px 20px;
  }
  
  .gl-container {
    display: flex;
    justify-content: center;
    padding: 28px 16px;
  }
  
  .gl-card {
    width: min(840px, 94vw);
  }
  
  /* Recipe body two-column on desktop */
  .recipe-body {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 40px;
    padding: 0 28px 28px;
  }
  
  .recipe-title {
    font-size: 32px;
  }
  
  .recipe-image img {
    width: 160px;
    height: 160px;
  }
  
  /* Recipe grid 3 columns on desktop */
  .recipes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Navigation search full width on desktop */
  .fs-nav__center {
    max-width: 720px;
  }
  
  /* Modal improvements for desktop */
  .fs-modal__panel {
    width: 80vw;
    max-width: 720px;
  }
  
  /* Grocery list row improvements */
  .gl-row {
    grid-template-columns: 28px 1fr auto;
  }
  
  /* Footer improvements for desktop */
  .mobile-footer__inner {
    max-width: 1200px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
  }
  
  .mobile-footer__brand {
    text-align: left;
    flex: 1;
  }
  
  .mobile-footer__links {
    justify-content: center;
    flex: 2;
  }
  
  .mobile-footer__theme {
    flex: 1;
    justify-content: flex-end;
  }
  
  .mobile-footer__bottom {
    display: none; /* Move copyright to brand section on desktop */
  }
}

/* =============================================================================
   LARGE DESKTOP STYLES (1200px and up)
   ============================================================================= */

@media (min-width: 1200px) {
  /* Recipe grid 4 columns on large desktop */
  .recipes-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Larger containers */
  .recipe-container {
    max-width: 1200px;
  }
}

/* =============================================================================
   MOBILE FOOTER STYLES
   ============================================================================= */

.mobile-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 32px 0 20px;
}

.mobile-footer__inner {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-footer__brand {
  text-align: center;
}

.mobile-footer__title {
  font-size: 20px;
  font-weight: 800;
  color: var(--heading);
  margin: 0 0 4px;
}

.mobile-footer__tagline {
  font-size: 14px;
  color: var(--muted);
  margin: 0;
}

.mobile-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px 24px;
}

.mobile-footer__link {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 0;
  min-height: auto;
  min-width: auto;
  display: inline;
}

.mobile-footer__link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.mobile-footer__theme {
  /*display: flex;*/
  justify-content: center;
}

.theme-selector {
  position: relative;
}

.theme-selector__btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  min-height: auto;
  min-width: auto;
}

.theme-selector__btn:hover {
  background: var(--border);
}

.theme-selector__icon {
  font-size: 16px;
}

.theme-selector__label {
  font-weight: 500;
}

.theme-selector__caret {
  font-size: 12px;
  transition: transform 0.2s ease;
}

.theme-selector__btn[aria-expanded="true"] .theme-selector__caret {
  transform: rotate(180deg);
}

.theme-selector__menu {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  min-width: 200px;
  z-index: 50;
}

.theme-selector__item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: auto;
  min-width: auto;
}

.theme-selector__item:hover {
  background: var(--border);
}

.mobile-footer__bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.mobile-footer__copyright {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

/* =============================================================================
   ACCESSIBILITY AND TOUCH IMPROVEMENTS
   ============================================================================= */

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .recipe-card,
  .gl-card,
  .fs-modal__panel {
    border: 2px solid var(--border);
  }
}

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

/* Print styles */
@media print {
  .fs-nav,
  .recipe-controls,
  .recipe-actions,
  .gl-actions {
    display: none !important;
  }
  
  .recipe-container,
  .gl-container {
    max-width: none;
    padding: 0;
  }
  
  .recipe-card,
  .gl-card {
    box-shadow: none;
    border: 1px solid #000;
  }
}


.signin-btn {
      /*display: flex;*/
      /*align-items: center;*/
      justify-content: center;
      width: 100%;
}