/**
 * fishDetailStyles.css
 *
 * Styles specifically for the Fish Detail page (fishDetail.html).
 * Assumes global styles (typography, colors, basic layout) are in styles.css.
 */

/* --- Global Page Container --- */
.container {
    max-width: 1600px; /* Consider moving max-width to styles.css if consistent */
    margin: 0 auto;
    padding: 0 2rem; /* Horizontal padding */
}

/* --- Common Section Spacing --- */
.fish-detail,
.fish-details-grid,
.related-images, /* Renamed from .related-videos */
.safety-guidelines { /* Assuming .safety-guidelines section is used */
    margin-top: 2rem;
    margin-bottom: 2rem;
}

/* --- Common Section Heading Styles --- */
/* Applies to most H2s within the main content sections */
.fish-info h2, /* Safety Info heading */
.details-card h2,
.related-images h2,
.safety-guidelines h2 {
    font-size: 1.5rem; /* Standardized heading size */
    margin-bottom: 1rem;
    color: #1e293b; /* Consider CSS Variables for colors */
}


/* --- Fish Detail Top Section --- */
/* Fish Navigation Arrows (Google-style) */
.fish-detail {
    position: relative; /* For positioning navigation arrows */
}

.fish-navigation {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
    padding: 10px;
}

.nav-arrows-container {
    display: flex;
    gap: 8px;
}

.fish-nav-arrow {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    color: #5f6368;
    font-size: 0.9rem;
    text-decoration: none; /* ADD THIS */

}

.fish-nav-arrow:hover {
    background-color: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.fish-nav-arrow:active {
    background-color: #f1f3f4;
    transform: scale(0.95);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .fish-navigation {
        padding: 5px;
    }
}

/* Hide navigation on very small screens */
@media (max-width: 480px) {
    .fish-nav-arrow {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

.fish-detail-container {
    display: flex;
    flex-wrap: wrap; /* Keep wrapping for responsiveness */
    gap: 2rem;
    /* align-items: flex-start; */ /* REMOVE or change back */
    align-items: stretch; /* CHANGE BACK - Makes columns try to be same height */
}

.fish-image {
    flex: 1 1 400px;
    background-color: #ffffff;
    border-radius: 8px;
    display: flex; /* Keep flex for centering */
    justify-content: center;
    align-items: center;
    height: 100%; /* Stretch to fill the full height of the parent container */
    overflow: hidden;
    position: relative; /* For loading indicator */
}



/* Ensure the image container maintains its size even when image is hidden */
.fish-image img {
    /* Combined styles */
    position: relative; /* Position above the loading indicator */
    z-index: 1; /* Ensure image appears above loading indicator */
    display: block;
    width: auto;
    height: auto;
    max-width: 100%; /* Allow image to fill container width if needed */
    max-height: 100%; /* Allow image to fill container height if needed */
    object-fit: contain;
    padding: 1rem; /* Add some padding so image doesn't touch edges */
    box-sizing: border-box;
}


.fish-info {
    flex: 1 1 400px;
    display: flex; /* ADDED: Use flexbox to manage internal layout */
    flex-direction: column; /* ADDED: Stack children vertically */
    /* The height will be determined by align-items: stretch from parent */
    /* Add overflow hidden in case content calculation is tricky, though inner scroll should handle it */
    overflow: hidden;
}

.fish-info h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
    line-height: 1.2;
    flex-shrink: 0; /* ADDED: Prevent title from shrinking */
}

.scientific-name {
    color: #64748b;
    margin-bottom: 1.5rem;
    font-style: italic;
    display: block;
    flex-shrink: 0; /* ADDED: Prevent from shrinking */
}

/* Optional Fish Tags (if used later) */
.fish-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    background-color: #f1f5f9;
    color: #475569;
    font-size: 0.875rem;
    white-space: nowrap;
}


/* --- Safety Info Table & Legend --- */
.safety-info {
    flex-grow: 1; /* ADDED: Allow safety info to grow vertically */
    overflow-y: auto; /* ADDED: Make THIS section scrollable if needed */
    min-height: 0; /* ADDED: Flexbox trick to allow shrinking properly */
    padding-right: 5px; /* ADDED: Space for scrollbar if it appears */
    /* Consider adding a max-height here if you DON'T want stretch,
       e.g., max-height: 485px; to match image conceptually */
}

/* Add a little space above the safety table within its scrolling container */
.safety-info h2 {
    margin-top: 1rem; /* Add space above heading */
}

/* Ensure table and legend styles are fine */
.safety-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

#safetyLegend {
    /* Keep legend styles, ensure margin-top pushes it below table */
    margin-top: 15px;
    /* ... other legend styles ... */
}

.safety-table th,
.safety-table td {
    padding: 0.4rem 1rem; /* Adjust padding */
    font-size: 0.9em; /* Adjust font size */
    color: #374151; /* Slightly darker grey text for cells */
    text-align: left;
    border-bottom: 1px solid #e5e7eb; /* Lighter border color */
    vertical-align: middle;
}

.safety-table th {
    font-weight: 600; /* Semi-bold headers */
    background-color: transparent; /* No header background */
    color: #1f2937; /* Darker header text */
    border-bottom-width: 2px; /* Thicker bottom border for header */
    border-bottom-color: #d1d5db; /* Slightly darker border for header */
    white-space: nowrap;
}

/* Specific column alignments */
.safety-table th:nth-child(1), /* Area Header */
.safety-table td:nth-child(1) { /* Area Cells */
    text-align: left;
    padding-left: 0.5rem; /* Less left padding */
}

.safety-table th:nth-child(2), /* Status column header */
.safety-table td:nth-child(2) { /* Status column cells */
    text-align: center;
}

.safety-table th:nth-child(3), /* Contaminants column header */
.safety-table td:nth-child(3) { /* Contaminants column cells */
    text-align: right;
    padding-right: 0.5rem; /* Less right padding */
}

/* Row Backgrounds */
.safety-table tbody tr {
    background-color: #ffffff; /* Default white background */
}
.safety-table tbody tr:nth-child(even) {
    background-color: #f9fafb; /* Very light grey for even rows */
}
/* Optional: Hover effect */
.safety-table tbody tr:hover {
    background-color: #f3f4f6;
}

/* Alternating row colors (optional, uncomment if desired) */
/* .safety-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}
.safety-table tbody tr:nth-child(odd) {
    background-color: #ffffff; /* Or keep default */
/* } */

/* Remove bottom border from last row for cleaner look */
.safety-table tbody tr:last-child td {
    border-bottom: none;
}

/* Safety Badges (Pill-shaped) */
.safety-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
    vertical-align: middle;
}

.safety-badge.green {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.safety-badge.yellow {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.safety-badge.orange {
    background-color: #fed7aa;
    color: #92400e;
    border: 1px solid #fdba74;
}

.safety-badge.red {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.safety-badge.unknown {
    background-color: #e5e7eb;
    color: #374151;
    border: 1px solid #d1d5db;
}

/* Status Dots (kept for backward compatibility, but not used in table) */
.status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle; /* Better vertical alignment */
    margin: 0 auto; /* Helps centering within the centered cell */
    /* margin-right removed, centering handles spacing */
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.2); /* Add thin outline to all dots */
}
/* Standardized Status Dot Colors */
.status-dot.green {
    background-color: #28a745; /* No Restrictions */
    border-color: gray; /* Darker green border */
}
.status-dot.yellow {
    background-color: #ffd647; /* 1/week - Updated yellow */
    border-color: gray; /* Darker yellow border */
}
.status-dot.orange {
    background-color: #fc6e00; /* 1/month - Updated orange */
    border-color: gray; /* Darker orange border */
}
.status-dot.red {
    background-color: white; /* Keep original red background */
    position: relative; /* For positioning the prohibited symbol */
    width: 16px; /* Slightly larger to accommodate symbol */
    height: 16px;
}

/* Add prohibited symbol to red status dots */
.status-dot.red::before {
    content: "🚫"; /* Unicode prohibited symbol */
    position: absolute;
    top: 56%;
    left: 54%;
    transform: translate(-50%, -50%);
    font-size: 14px; /* Smaller symbol for the dot */
    line-height: 1;
    color: white; /* White symbol on red background for contrast */
}
.status-dot.unknown {
    background-color: #adb5bd; /* Data N/A */
    border-color: gray; /* Darker gray border */
}

/* Safety Legend */
#safetyLegend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px; /* row-gap column-gap */
    align-items: center;
    justify-content: center; /* Center the legend items horizontally */
    margin: 15px auto 0; /* Center the legend with auto margins and add top margin */
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #f8f8f8;
    max-width: fit-content; /* Make the legend only as wide as its content */
}
/* Legend Title Removed from HTML, use aria-label */
/* #safetyLegend h4 { ... } */

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.85em;
}
/* Adjust status dot margin within legend item */
.legend-item .status-dot {
    margin-right: 6px; /* Space between dot and text */
    margin-left: 0; /* Ensure no extra left margin */
}


/* --- Details Grid Section (Nutrition, Regulations) --- */
.fish-details-grid {
    display: grid;
    /* grid-template-columns: repeat(3, 1fr); */ /* Original had 3 cols, adjust if needed */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Responsive columns */
    gap: 1.5rem;
}

.details-card {
    background-color: #f8fafc;
    border-radius: 8px;
    padding: 1.5rem; /* Consistent padding */
    border: 1px solid #e2e8f0; /* Added subtle border */
}

/* Nutrition Card - using DL */
.nutrition-card dl {
    margin: 0; /* Remove default dl margin */
    padding: 0;
}
.nutrition-card .detail-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0; /* Vertical padding */
    border-bottom: 1px solid #e2e8f0;
}
.nutrition-card dt { /* Term (e.g., Calories) */
    color: #475569;
    padding-right: 1rem; /* Space before value */
}
.nutrition-card dd { /* Description (e.g., 176.8 kcal) */
    margin-left: 0; /* Reset default dd margin */
    font-weight: 500; /* Slightly bolder value */
    color: #1e293b;
    text-align: right;
}
.nutrition-card .detail-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* Regulations Card */
.regulation-item {
    display: flex;
    align-items: flex-start; /* Align icon top with first line of text */
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}
.regulation-item:last-child {
    margin-bottom: 0; /* Reset margin if needed, padding handles spacing */
    padding-bottom: 0;
    border-bottom: none;
}
.regulation-item img {
    width: 24px;
    height: 24px;
    margin-top: 0.1em; /* Fine-tune vertical alignment with text */
    flex-shrink: 0;
}
.regulation-item span { /* The text part */
    color: #475569;
}
.regulation-item span span { /* The actual value span */
    font-weight: 500;
    color: #1e293b;
}
.restrictions-item span span { /* Allow restrictions value to wrap */
     white-space: normal;
}


/* --- Related Images Section --- */
/* Uses styles provided previously, slightly adjusted */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    min-height: 100px; /* Placeholder height */
}

.images-grid img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

.images-grid a {
    display: block;
    transition: transform 0.2s ease-in-out;
}
.images-grid a:hover {
    transform: scale(1.03);
}

/* Message styles within grid */
#imagesLoadingMsg,
#imagesErrorMsg {
    grid-column: 1 / -1; /* Span full width */
    text-align: center;
    color: #666;
    padding: 20px;
    background-color: #f8f8f8; /* Light background for messages */
    border-radius: 5px;
}

/* Unsplash attribution link style */
.images-grid + p { /* Selects the P added after the grid for attribution */
     text-align: center;
     font-size: 0.8em;
     margin-top: 15px;
     color: #666;
}
.images-grid + p a {
    color: #475569;
    text-decoration: underline;
}


/* --- Safety Guidelines Section (If used) --- */
.safety-guidelines {
    background-color: #f8fafc;
    border-radius: 8px;
    padding: 2rem; /* Consistent padding */
    border: 1px solid #e2e8f0;
}

.guidelines-grid {
    display: grid;
    /* grid-template-columns: repeat(2, 1fr); */ /* Keep 2 columns? */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* Responsive */
    gap: 1.5rem;
}

.guideline-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #fff; /* Give items a background */
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

.guideline-item img {
    width: 20px;
    height: 20px;
    opacity: 0.7; /* Slightly increased opacity */
    flex-shrink: 0;
}
.guideline-item span {
    color: #334155;
    font-size: 0.9em;
}

/* --- Recipes Card Section --- */
.recipes-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recipe-link {
    text-decoration: none;
    color: inherit;
}

.recipe-item {
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background-color: #ffffff;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.recipe-item:last-child {
    margin-bottom: 0;
}

.recipe-item:hover {
    background-color: #f8fafc;
    border-color: #cbd5e1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.recipe-item h3 {
    font-size: 0.95rem;
    margin: 0 0 0.3rem 0;
    color: #1e293b;
    line-height: 1.3;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

.recipe-item p {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.no-recipes {
    color: #94a3b8;
    font-style: italic;
    text-align: center;
    padding: 0.5rem 0;
    font-size: 0.9rem;
}

/* --- DNR Link Styling --- */
.dnr-link {
    color: #0066cc;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.dnr-link:hover {
    color: #0052a3;
    text-decoration: underline;
}

.dnr-link:visited {
    color: #663399;
}

/* --- Disclaimer Section --- */
.disclaimer-section {
    margin-top: 3rem;      /* More space above the disclaimer */
    margin-bottom: 3rem;   /* Space below before the footer */
    padding: 1.5rem 1rem;  /* Padding inside the section */
    border-top: 1px solid #dee2e6; /* Subtle top border */
    border-bottom: 1px solid #dee2e6; /* Subtle bottom border */
    background-color: #f8f9fa; /* Very light background (optional) */
    text-align: center;    /* Center the text */
}

.disclaimer-section p {
    font-size: 0.9em;      /* Slightly smaller font */
    color: #495057;        /* Muted, but readable text color */
    line-height: 1.6;      /* Comfortable line spacing */
    max-width: 800px;      /* Limit width for better readability on wide screens */
    margin: 0 auto;        /* Center the paragraph itself if max-width is applied */
}

/* Responsive adjustment for disclaimer padding */
@media (max-width: 768px) {
    .disclaimer-section {
        padding: 1rem 0.5rem;
        margin-top: 2rem;
        margin-bottom: 2rem;
    }
     .disclaimer-section p {
        font-size: 0.85em;
    }
}


/* --- Responsive Styles --- */
@media (max-width: 992px) { /* Adjusted breakpoint for details grid */
    .fish-details-grid {
        /* Switch to 2 columns earlier if needed, or keep auto-fit */
         grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }
     .fish-info h1 {
        font-size: 2rem; /* Reduce heading size */
    }
}


@media (max-width: 768px) {
    .container {
        padding: 0 1rem; /* Reduce padding on smaller screens */
    }

    .fish-detail-container {
        flex-direction: column; /* Stack image and info vertically */
        min-height: auto; /* Remove min-height */
    }

    .fish-image {
        max-height: 300px; /* Adjust max-height for stacked layout */
        min-height: 200px;
        flex-basis: auto; /* Reset flex basis */
    }
     .fish-info {
        flex-basis: auto; /* Reset flex basis */
    }

    .fish-details-grid {
        grid-template-columns: 1fr; /* Stack detail cards */
    }

    .images-grid { /* Adjust image grid columns */
         grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
     .images-grid img {
        height: 120px;
     }


    .guidelines-grid {
        grid-template-columns: 1fr; /* Stack guidelines */
    }

    .safety-table th,
    .safety-table td {
        padding: 0.5rem 0.75rem; /* Reduce table padding */
        font-size: 0.8rem; /* Reduce table font size */
    }
    #safetyLegend {
        gap: 6px 15px; /* Reduce legend gap */
        padding: 10px;
    }
    .legend-item {
        font-size: 0.8em; /* Reduce legend font size */
    }

    .fish-detail-container {
        /* On mobile, stack them, so stretch isn't relevant */
        align-items: normal; /* Reset alignment */
    }
     .fish-image {
         /* Reset image height constraints if needed for mobile */
         max-height: 300px;
         min-height: 200px;
     }
    .fish-info {
        /* Remove overflow handling when stacked */
        overflow: visible;
    }
    .safety-info {
         /* Remove overflow handling when stacked */
        overflow-y: visible;
        max-height: none; /* Ensure no max-height limits content */
        flex-grow: 0; /* Don't need it to grow */
        padding-right: 0; /* No scrollbar space needed */
    }

}