/**
 * recipesStyles.css
 *
 * Styles specifically for the Recipes page (recipes.html).
 */

/* --- General Page Structure --- */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding-left: var(--container-left-padding);
    padding-right: var(--container-left-padding);
}

.recipes-page-container {
    padding-top: var(--spacing4);
    padding-bottom: var(--spacing6);
}

/* --- Recipes Header Area --- */
.recipes-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;  /* Changed from flex-end to flex-start */
    flex-wrap: wrap;
    gap: var(--spacing3);
    margin-bottom: var(--spacing5);
    padding-bottom: var(--spacing3);
}

.recipes-header-content {
    flex-grow: 1; /* Allow title/search to take available space */
}

.recipes-header h1 {
    font: var(--h1);
    color: var(--text-color);
    margin-bottom: var(--spacing3);
}

/* Search Bar */
.search-container {
    position: relative;
    max-width: 400px; /* Limit search bar width */
}

.search-container input[type="search"] {
    width: 100%;
    padding: var(--spacing3) var(--spacing4) var(--spacing3) var(--spacing3);
    border: 1px solid var(--text-secondary);
    border-radius: var(--radius-sm);
    background-color: var(--card-bg);
    font-size: 1.1rem;
}
.search-container input[type="search"]:focus {
    outline: none;
    border-color: var(--color-primary, #007bff);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}
/* Hide default clear button on search inputs (optional) */
.search-container input[type="search"]::-webkit-search-cancel-button,
.search-container input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* Add specific styles for the placeholder text */
.search-container input[type="search"]::placeholder {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.search-button {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50px; /* Width for icon button */
    border: none;
    background: transparent;
    color: var(--color-text-secondary, #64748b);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: color 0.2s ease;
}
.search-button:hover {
    color: var(--color-primary, #007bff);
}
.search-button .fa {
    font-size: 1.1rem;
}

/* Submit Recipe Button */
.submit-recipe-button {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing2);
    padding: var(--spacing3) var(--spacing4);
    background-color: var(--hero-button-bg);
    color: var(--card-bg);
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;  /* Add this to remove underline */
}
.submit-recipe-button:hover {
    background-color: var(--hero-button-hover);
    color: var(--card-bg);  /* Keep text color on hover */
    text-decoration: none;  /* Ensure no underline on hover */
}
.submit-recipe-button .fa {
    font-size: 1rem;
}


/* --- Recipes Grid --- */
.recipes-grid-section {
    /* No extra margin needed if header has margin-bottom */
}

.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing5);
    width: 100%;
    max-width: 100%;
}

@media (min-width: 1200px) {
    .recipes-grid {
        grid-template-columns: repeat(3, 1fr); /* Force 3 columns on larger screens */
    }
}

/* Individual Recipe Card */
.recipe-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--text-secondary);
    box-shadow: var(--shadow-sm);
    overflow: hidden; /* Add this to prevent child elements from breaking radius */
}
.recipe-card:hover {
    box-shadow: var(--shadow-md);
}

/* Make the whole card clickable */
.recipe-card-link {
    text-decoration: none;
    color: inherit; /* Inherit text color */
    display: flex;
    flex-direction: column;
    height: 100%; /* Make link fill the card */
    /* Remove any border-radius here if present */
}
.recipe-card-link:hover {
    text-decoration: none; /* Ensure no underline on hover */
    color: inherit;
}

.soft-alert-container {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--spacing3);
  width: 100%;
  margin: 0 0 var(--spacing5); /* Remove top margin */
  padding-block: var(--spacing3);
  /* Align content edges with .container across all widths */
  padding-inline: max(var(--container-left-padding), calc((100vw - 1600px) / 2 + var(--container-left-padding)));
  background: var(--card-bg); /* Remove gradient for a minimal look */
  border: 1px solid var(--button-hover);
  border-radius: 0; /* Sharp corners */
  box-shadow: none; /* Subtle or none as requested */
}

.soft-alert-icon {
  color: var(--text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  margin-top: 0.15em;
}

/* Image variant for soft alert icon */
.soft-alert-image {
  width: 42px; /* a tad bigger than the icon */
  height: 52px;
  object-fit: contain;
  display: inline-block;
}

@media (max-width: 576px) {
  .soft-alert-image {
    width: 28px;
    height: 28px;
  }
}


.soft-alert-message {
  color: var(--text-color);
  font-size: clamp(0.95rem, 0.92rem + 0.15vw, 1.05rem);
  line-height: 1.7;
  margin: 0; /* reset p defaults */
}

.soft-alert-message a {
  color: var(--color-primary, #007bff);
  text-decoration: underline;
}
.soft-alert-message a:hover {
  text-decoration: none;
}

@media (max-width: 576px) {
  .soft-alert-container {
    grid-template-columns: 1fr; /* Stack icon above text on small screens */
  }
  .soft-alert-icon {
    margin-top: 0;
  }
}

/* --- Accessible utility --- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* --- Modal Styles --- */
.modal { display: none; }
.modal[aria-hidden="false"] { display: block; }
.modal__overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  z-index: 10000; /* ensure overlay covers all page content */
}
.modal__dialog {
  position: fixed; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  background: var(--card-bg); color: var(--text-color);
  border: 1px solid var(--button-hover);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  max-width: min(90vw, 800px);
  max-height: 90vh;
  padding: var(--spacing3);
  display: flex; flex-direction: column; gap: var(--spacing3);
  z-index: 10001; /* above overlay */
}
.modal__close {
  position: absolute; top: 10px; right: 10px;
  width: 36px; height: 36px; /* larger, easier target */
  display: grid; place-items: center;
  background: rgba(0, 0, 0, 0.8); /* darker for visibility */
  color: #fff; /* bright icon */
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 9999px; /* circular */
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 10002; /* above dialog content like images */
}
.modal__close:hover,
.modal__close:focus,
.modal__close:focus-visible {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  transform: none;
  outline: none;
}
.modal__dialog img { width: 100%; height: auto; object-fit: contain; }

@media (max-width: 576px) {
  .modal__dialog { width: 92vw; max-width: 92vw; padding: var(--spacing3); }
}

/* Image Placeholder */
.recipe-image-placeholder {
    position: relative; /* required for absolute-positioned signature */
    height: var(--fish-image-height);
    background-color: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--text-secondary);
}

/* Signature overlay on card image */
.signature-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  max-width: 42%;
  max-height: 36%;
  opacity: 0.9;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
  pointer-events: none; /* clicks pass through to card link */
}
@media (max-width: 576px) {
  .signature-overlay { max-width: 50%; max-height: 34%; }
}
/* If using actual images: */
/*
.recipe-card img {
    height: 200px;
    width: 100%;
    object-fit: cover;
}
*/

/* Card Content Area */
.recipe-card-content {
    padding: var(--space-4, 1.25rem);
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Allow content to take remaining space */
}

.recipe-card-content h3 {
    font-size: 1.2rem; /* Recipe title size */
    font-weight: 600;
    margin-top: 0;
    margin-bottom: var(--space-2, 0.5rem);
    color: var(--text-color);
}

.recipe-card-content p {
    font-size: 0.9rem;
    color: var(--text-mid);
    line-height: 1.5;
    margin-bottom: var(--space-3, 1rem);
    flex-grow: 1; /* Allow description to push meta down */
}

/* Meta Info (Time, Likes) */
.recipe-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto; /* Push to bottom */
    padding-top: var(--space-3, 1rem);
}

.recipe-meta span {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1, 0.25rem);
}
.recipe-meta .fa {
    font-size: 1rem; /* Icon size */
}

/* No Results Message */
.no-results-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing4);
    color: var(--text-secondary);
    font-style: italic;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .recipes-header {
        /* Stack elements vertically if needed, or adjust alignment */
         align-items: flex-start;
    }
    .search-container {
        max-width: none; /* Allow search to take more width */
        width: 100%; /* Optional: make search full width */
        margin-bottom: var(--space-3, 1rem); /* Add space below search when wrapped */
    }
    .submit-recipe-button {
       margin-left: auto; /* Push button right if space allows */
       /* Or set width: 100% for full width button */
    }

    .recipes-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); /* Slightly narrower min to allow better fit */
    }
}

@media (max-width: 576px) {
     .recipes-grid {
        /* Force 1 column on small mobile */
        grid-template-columns: 1fr;
     }
     .recipe-image-placeholder {
        height: 180px; /* Adjust image height */
     }
     .recipe-card-content h3 {
        font-size: 1.1rem;
     }
}
