/* --- Global Styles & Custom Scrollbar --- */
body {
    scrollbar-width: thin;
    scrollbar-color: #444444 #1E1E1E;
}
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #1E1E1E;
}
::-webkit-scrollbar-thumb {
    background-color: #444444;
    border-radius: 10px;
    border: 2px solid #1E1E1E;
}
::-webkit-scrollbar-thumb:hover {
    background-color: #555555;
}

/* --- Full Page Loader Animation --- */
#loader .loader-spinner {
    width: 56px;
    height: 56px;
    border: 6px solid #444;
    border-bottom-color: #ff0000;
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Sidebar & Navigation --- */
.category-link.active {
    background-color: #ff0000;
    color: white;
    font-weight: 600;
}
.category-link.active i {
    color: white;
}

/* --- Sub-Category Filter Bar --- */
#sub-category-bar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
#sub-category-bar::-webkit-scrollbar {
    display: none;
}
.sub-category-btn.active {
    background-color: #ff0000;
    color: white;
    border-color: #ff0000;
}

/* --- NEW: Prompt Card --- */
.prompt-card {
    content-visibility: auto; /* Only renders when near viewport */
    contain-intrinsic-size: 300px 450px; /* Estimates size before render */
    background-color: #2D2D2D;
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    transition: transform 0.2s ease, border-color 0.2s ease;
    will-change: transform; /* Tells GPU to prepare for animation */
}

/* 2. Faster Hover Rendering */
.prompt-card:hover {
    transform: translateY(-4px);
    border-color: #ff0000;
}

/* 3. Media Placeholder styling */
.lazy-media {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    background: #121212;
}

/* 4. Fix for text overflow (Prevents cards from stretching) */
.card-title {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-description {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.prompt-card .card-platforms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #444444; /* gray-600 */
}

.platform-tag {
    background-color: #444444; /* gray-600 */
    color: #E5E7EB; /* gray-200 */
    font-size: 0.75rem; /* text-xs */
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px; /* rounded-full */
}

/* --- Modal Specific Styles --- */
/* Custom styling for the readonly textarea to remove default browser outlines */
#modal-prompt-textarea {
    outline: none;
    box-shadow: none;
}
#modal-prompt-textarea::-webkit-scrollbar {
    width: 6px;
}
#modal-prompt-textarea::-webkit-scrollbar-thumb {
    background-color: #444444;
    border-radius: 10px;
}

/* --- Responsive Sidebar for Mobile --- */
@media (max-width: 767px) {
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        height: 100vh;
        border-radius: 0;
        box-shadow: 0 0 20px rgba(0,0,0,0.5);
    }
    #sidebar.show {
        transform: translateX(0);
    }
}

/* In assets/css/style-prompt.css */

/* ... (keep all existing styles) ... */

/* --- NEW: Prompt Card Media --- */
.prompt-card .card-reference-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #121212; /* gray-900 */
    border-radius: 0.375rem; /* rounded-md */
    overflow: hidden;
    margin-bottom: 1rem;
}
.prompt-card .card-reference-media img,
.prompt-card .card-reference-media video {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

/* --- NEW: Lightbox Styles --- */
#lightbox-content img,
#lightbox-content video {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

/* In assets/css/style-prompt.css */

/* --- ADD THIS ENTIRE BLOCK AT THE END OF THE FILE --- */

/* --- Responsive Card Adjustments for Mobile --- */
@media (max-width: 640px) { /* This targets mobile screens (sm breakpoint in Tailwind) */
    .prompt-card {
        padding: 0.5rem; /* Slightly reduce padding */
    }

    .prompt-card h3 {
        font-size: 1rem; /* Reduce title font size */
        line-height: 1.4; /* Adjust line height for better readability */
        align-items: center;
    }

    .prompt-card p {
        font-size: 0.875rem; /* text-sm */
        
        /* The following lines will limit the text to 2 lines and add "..." */
        display: -webkit-box;
        -webkit-line-clamp: 1;
        line-clamp: 1;
        -webkit-box-orient: vertical;  
        overflow: hidden;
    }
}

/* In assets/css/style-prompt.css */

/* --- ADD THIS ENTIRE BLOCK AT THE END OF THE FILE --- */

/* --- Fix for Reference Media Sizing --- */

/* This targets the media on the main grid cards */
.prompt-card .card-reference-media img,
.prompt-card .card-reference-media video {
    object-fit: contain; /* This is the key change: from cover to contain */
}

/* This targets the media inside the modal preview */
#modal-reference-preview img,
#modal-reference-preview video {
    object-fit: contain; /* This ensures the modal preview also uses the correct fit */
}

/* In assets/css/style-prompt.css */

/* --- ADD THIS AT THE END OF THE FILE --- */

/* --- Load More Button --- */
#load-more-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Styling for the sidebar footer area */
#sidebar-footer-nav .category-link, 
#sidebar-footer-nav a {
    font-size: 0.9rem;
    opacity: 0.8;
}

#sidebar-footer-nav a:hover {
    opacity: 1;
}

/* Ensure the shop link icon is smaller */
.bx-link-external {
    font-size: 0.75rem;
    color: #9CA3AF; /* gray-400 */
}