/* Importing Google Fonts - Inter for clean typography */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* Base styles - applying font and ensuring full height */
body {
    font-family: 'Montserrat', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom right, #e0f2fe, #bbdefb); /* Soft blue gradient */
    color: #333; /* Darker text for better readability */
    margin: 0;
    padding: 20px; /* Add some padding around the body */
    box-sizing: border-box; /* Include padding in element's total width and height */
}

/* Main container styling */
.container {
    max-width: 960px; /* Max width for desktop screens */
    width: 100%;
    padding: 30px; /* More internal padding */
    background-color: #ffffff;
    border-radius: 16px; /* Slightly more rounded corners */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); /* Softer, deeper shadow */
    box-sizing: border-box;
}

/* Header styling */
header {
    text-align: center;
    margin-bottom: 40px; /* More space below header */
}

header h1 {
    font-size: 3.5rem; /* Larger main heading */
    font-weight: 800; /* Extra bold */
    color: #1a202c; /* Darker almost black for heading */
    margin-bottom: 10px;
    letter-spacing: -0.03em; /* Tighten letter spacing for headings */
}

header p {
    font-size: 1.25rem; /* Larger subheading */
    color: #4a5568; /* Medium gray for subheading */
    line-height: 1.6;
}

/* Category section headings */
h2 {
    font-size: 2.25rem; /* Category heading size */
    font-weight: 700; /* Bold */
    color: #2d3748; /* Darker gray for category headings */
    margin-bottom: 25px; /* More space below category heading */
    text-align: center;
}

/* Scrollable gallery container */
.flex.overflow-x-auto {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth; /* Smooth scroll on click/drag */
    padding: 20px; /* Padding inside the scrollable area */
    background-color: #f8fafc; /* Lighter background for gallery */
    border-radius: 12px; /* Rounded corners for gallery container */
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05); /* Subtle inner shadow */
}

/* Hide scrollbar for a cleaner look */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}
.hide-scrollbar {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Additional custom styles for copy protection */
.no-select {
    -webkit-touch-callout: none; /* iOS Safari */
    -webkit-user-select: none;   /* Safari */
    -khtml-user-select: none;    /* Konqueror HTML */
    -moz-user-select: none;      /* Old versions of Firefox */
    -ms-user-select: none;       /* Internet Explorer/Edge */
    user-select: none;           /* Non-prefixed version, currently supported by Chrome, Edge, Opera and Firefox */
    -webkit-user-drag: none;     /* Disable drag on WebKit browsers */
    -moz-user-drag: none;        /* Disable drag on Firefox */
}

.image-card {
    position: relative; /* Needed for absolute positioning of overlay */
    cursor: pointer; /* Indicate that the card is clickable */
    height: 200px; /* Fixed height for cards without text. Adjust as needed. */
    display: flex; /* Use flex to ensure image fills available space */
    align-items: center;
    justify-content: center;
    overflow: hidden; /* Hide overflow if image is larger than card */
    /* Add back some styling that was previously from Tailwind for visual consistency */
    flex-shrink: 0; /* Prevents shrinking in flex container */
    width: 280px; /* Fixed width for each card */
    margin-right: 24px; /* Space between cards */
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e2e8f0;
}
/* Ensure the last card doesn't have right margin */
.image-card:last-child {
    margin-right: 0;
}
/* Hover effects for image card */
.image-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-card img {
    width: 100%;
    height: 100%; /* Make image fill the height of the card */
    object-fit: cover; /* Cover the entire area, cropping if necessary */
    border-radius: 12px; /* Apply border-radius to the image to match card */
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; /* Completely transparent */
    z-index: 10; /* Ensure it's above the image */
    pointer-events: auto; /* This div will capture pointer events (clicks, right-clicks, drags) */
    cursor: pointer; /* Cursor over the overlay to indicate clickability */
}

/* Fullscreen Modal Styles */
.fullscreen-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9); /* Dark overlay */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000; /* Ensure it's on top of everything */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.fullscreen-modal.visible {
    opacity: 1;
    visibility: visible;
}

.fullscreen-modal img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain; /* Ensure the whole image is visible */
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    -webkit-user-select: none; /* Disable selection on full image */
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-user-drag: none; /* Disable drag on full image */
    -moz-user-drag: none;
}

.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
    z-index: 1001; /* Above image */
}

.close-button:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.image-card .p-3 {
    padding: 15px; /* Padding inside the text area of the card */
    flex-grow: 1; /* Allow text area to grow */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.image-card h3 {
    font-size: 1.15rem; /* Image title size */
    font-weight: 600; /* Semi-bold */
    color: #2d3748;
    margin-bottom: 5px;
    white-space: nowrap; /* Prevent title from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis for long titles */
}

.image-card p.text-xs {
    font-size: 0.75rem; /* Smaller text for source */
    color: #718096;
    margin-top: auto; /* Push source to bottom if space allows */
}

/* Navigation Arrows for Modal */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s ease;
    z-index: 1002; /* Above image */
}

.nav-arrow:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

.nav-arrow.left {
    left: 20px;
}

.nav-arrow.right {
    right: 20px;
}

/* Loading and error messages */
#overall-loading-message,
#overall-error-message,
.gallery-loading-message,
.gallery-error-message {
    font-size: 1.1rem;
    color: #5a67d8; /* A nice blue for loading */
    text-align: center;
    padding: 20px;
}

#overall-error-message,
.gallery-error-message {
    color: #e53e3e; /* Red for errors */
}

/* Footer styling */
footer {
    text-align: center;
    margin-top: 40px; /* More space above footer */
    font-size: 0.9rem;
    color: #718096;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    header h1 {
        font-size: 2.5rem; /* Adjust heading size for smaller screens */
    }
    header p {
        font-size: 1rem;
    }
    h2 {
        font-size: 1.75rem;
    }
    .container {
        padding: 20px;
        border-radius: 12px;
    }
    /* Mobile specific adjustments for image cards */
    .image-card {
        flex: 0 0 240px; /* Smaller card width on mobile */
        margin-right: 16px; /* Space between cards */
        height: 160px; /* Smaller card height on mobile */
    }
    .image-card img {
        height: 100%; /* Ensure image fills new card height */
    }
    
    /* Adjust modal arrows for smaller screens */
    .nav-arrow {
        width: 45px; /* Smaller width */
        height: 45px; /* Smaller height */
        font-size: 2rem; /* Smaller font size */
    }
    .nav-arrow.left {
        left: 15px; /* Closer to edge */
    }
    .nav-arrow.right {
        right: 15px; /* Closer to edge */
    }
}

@media (max-width: 480px) {
    .image-card {
        /* On very small screens, make cards almost full width and stack them */
        flex: 0 0 calc(100% - 40px); /* Full width minus 20px padding on each side of .flex.overflow-x-auto */
        margin-right: 0; /* No horizontal margin when stacked */
        margin-bottom: 20px; /* Add vertical margin for spacing between stacked cards */
        height: 180px; /* Slightly taller for better mobile viewing */
    }
    .flex.overflow-x-auto {
        flex-wrap: nowrap; /* Ensure horizontal scroll on small screens */
        padding-bottom: 10px; /* Adjust padding for scrollbar */
        justify-content: flex-start; /* Align cards to the start for scrolling */
        padding-left: 20px; /* Add padding to the left of the first card */
        padding-right: 20px; /* Add padding to the right of the last card */
    }
    /* Ensure the last card on very small screens also has bottom margin if stacked */
    .image-card:last-child {
        margin-bottom: 40px;
    }

    /* Further adjust modal arrows for very small screens */
    .nav-arrow {
        width: 40px; /* Even smaller width */
        height: 40px; /* Even smaller height */
        font-size: 1.8rem; /* Even smaller font size */
    }
    .nav-arrow.left {
        left: 10px; /* Very close to edge */
    }
    .nav-arrow.right {
        right: 10px; /* Very close to edge */
    }
}