@import './base.css';

/* Global styles */
:root {
  --color-background: #FFE8F0;
  --color-background-b: color-mix(in srgb, var(--color-background) 90%, #6B4C5C 10%);
  --color-border: #C08080;
  --color-text: #4A2E3E;
  --color-primary: #FF99CC;
  --color-checked: #7CB896;
  --color-tertiary: #8FC4FF;
  --color-tertiary-b: #FFC080;
  --color-tertiary-c: #A8C994;
  --color-success: #7CB896;
  --color-danger: #E88080;
  --color-warning: #FFD99F;
  --color-info: #8FC4FF;
  --color-light: #FFF0F5;
  --color-dark: #4A2E3E;
  --color-accent: #E01545;

  --global-margin: 1.5rem;
}

#app {
  /* max-width: 1280px; */
  margin: 0 auto;
  padding: var(--global-margin);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: hidden;

  font-weight: normal;
}

/* Base Page layout */
.page {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-x: hidden;
}

.page > h1 {
  text-align: center;
  margin-bottom: 1em;
}

.page > .content {
  margin: 0 auto;
  max-width: 800px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  margin-right: auto;
}

/* Global styles */

input::placeholder {
  color: var(--color-text);
}

input {
  color: var(--color-text);
}

a {
  text-decoration: none;
  color: var(--color-primary);
  transition: 0.4s;
}

@media (hover: hover) {
  a:hover {
    color: var(--color-accent);
    background-color: var(--color-background);
  }
}

/* For seo purposes so there is always an h1 title to the page */
.visually-hidden {
  position: absolute !important;
  height: 1px; 
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* Legacy support for existing id */
#default-title {
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0;
  padding: 0;
  margin: -1px;
}

/* SEO: Hide skeleton loading for crawlers */
html[data-crawler="true"] .skeleton {
  display: none !important;
}

/* SEO: Ensure content is visible for crawlers */
html[data-crawler="true"] [v-if],
html[data-crawler="true"] [v-show] {
  display: block !important;
  visibility: visible !important;
}

.skeleton {
  background: linear-gradient(90deg, var(--color-background) 25%, var(--color-background-b) 37%, var(--color-background) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.2s linear infinite;
  border-radius: 1em;
}

.skeleton-content {
  height: 2.5em;
  margin-bottom: 1.5em;
}

.skeleton-recipe {
  height: 8em;
  margin-bottom: 1em;
}

.skeleton-title {
  height: 3em;
  margin: 2em 0 1em 0;
}

.skeleton-image {
  height: 20em;
  margin-bottom: 1.5em;
}

.skeleton-section {
  height: 4em;
  margin-bottom: 1em;
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

/* Filter styles from original Vue app */

.filters-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.35);
  z-index: 998;
  transition: background 0.2s;
  backdrop-filter: blur(2px);
}

@keyframes filterMenuFadeIn {
  from { opacity: 0; transform: translateX(60px);}
  to { opacity: 1; transform: translateX(0);}
}

.filters-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.2rem;
}

.close-icon-btn {
  background: none;
  border: none;
  padding: 0.2rem;
  border-radius: 50%;
  transition: background 0.15s;
  cursor: pointer;
  display: flex;
  align-items: center;
}
.close-icon-btn:hover, .close-icon-btn:focus {
  background: #000A;
}

.close-icon {
  width: 2rem;
  height: 2rem;
  display: block;
}

.slide-right-enter-active,
.slide-right-leave-active {
  transition: all 0.3s ease;
}

.slide-right-enter-from,
.slide-right-leave-to {
  transform: translateX(100%);
  opacity: 0;
}

.slide-right-enter-to,
.slide-right-leave-from {
  transform: translateX(0);
  opacity: 1;
}

@media (max-width: 800px) {

  nav {
    font-size: 14px;
    text-align: center;
    margin: auto;
  }

  .burger-menu-wrapper {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.5em;
  }
}

/* Max width for main content on large screens */
.page, .content, .latest-recipes, .title-with-icons, .recipe-details, .recipe-content, .recipe, .more-noms {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1200px) {
  .page, .content, .latest-recipes, .title-with-icons, .recipe-details, .recipe-content, .recipe, .more-noms {
    max-width: 1100px;
  }
}

/* For images that should not stretch too wide */
img, .recipe-image {
  max-width: 100%;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

/* Prevent any element from causing horizontal overflow */
* {
  max-width: 100%;
  box-sizing: border-box;
}

/* Specific fixes for elements that might overflow */
iframe {
  max-width: 100%;
  box-sizing: border-box;
}
