/**
 * Main Stylesheet
 *
 * This file contains all the styles for the PromptSite project,
 * including base styles, layout, components, and responsive media queries.
 *
 * @package PromptSite
 * @version 1.0.0
 */


/* ==========================================================================
   1. Root Variables & Global Styles
   ========================================================================== */

/**
 * :root
 * Defines global CSS variables for colors, fonts, and other theme properties.
 * This makes it easy to maintain a consistent design system.
 */
:root {
    --primary-color: #007bff;        /* A strong, primary blue */
    --primary-color-dark: #0056b3;   /* A darker shade for hover states */
    --secondary-color: #e9ecef;      /* Light grey for backgrounds, borders */
    --background-color: #f8f9fa;     /* Main page background */
    --card-background: #ffffff;      /* Background for cards */
    --text-color: #343a40;           /* Main text color */
    --text-color-light: #6c757d;     /* Lighter text for secondary info */
    --border-color: #dee2e6;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/**
 * Global Resets
 * A simple reset to ensure consistent box-sizing and remove default margins/paddings.
 */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/**
 * Body Styles
 * Sets the base font, colors, and background for the entire document.
 */
body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/**
 * Container
 * A utility class to center content and provide a max-width.
 */
.container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
}

/**
 * Anchor Tag Styles
 * Removes default underline and sets a smooth color transition.
 */
a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.2s ease-in-out;
}

a:hover {
    color: var(--primary-color-dark);
}

/**
 * Unordered List Styles
 * Removes default list styling.
 */
ul {
    list-style-type: none;
}


/* ==========================================================================
   2. Layout Styles (Header, Main Wrapper, Sidebar, Content)
   ========================================================================== */

/**
 * .site-header
 * Styles for the top navigation bar. Uses Flexbox for alignment.
 */
.site-header {
    background-color: var(--card-background);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    gap: 10px;
}

.site-logo a {
    font-size: 24px;
    font-weight: 500; /* We will control bolding with spans */
    color: var(--text-color);
    letter-spacing: 1px;
    text-decoration: none; /* Ensure no underline */
    display: inline-block; /* Helps with consistent behavior */
}

/* Style for the first part of the logo ("PROMPT") */
.logo-part-one {
    font-weight: 500; /* Regular weight */
    color: var(--text-color); /* Default text color (black/dark grey) */
}

/* Style for the second part of the logo ("VERSE") */
.logo-part-two {
    font-weight: 700; /* Bold */
    color: var(--primary-color); /* Main blue color */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px; /* Adds space between buttons */
}

/**
 * .main-wrapper
 * The main container for the sidebar and content area. Uses Flexbox for the side-by-side layout.
 */
.main-wrapper {
    display: flex;
    gap: 30px;
    margin-top: 30px;
}

/**
 * .sidebar
 * The left column for navigation and search.
 */
.sidebar {
    width: 280px;
    flex-shrink: 0; /* Prevents the sidebar from shrinking */
}

/**
 * .main-content
 * The right column that holds the main content and prompt grid.
 */
.main-content {
    flex-grow: 1; /* Allows the main content to take up the remaining space */
}


/* ==========================================================================
   3. Component Styles
   ========================================================================== */

/**
 * Buttons
 * Defines styles for primary and secondary action buttons.
 */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background-color: var(--primary-color-dark);
    color: #fff;
}

.btn-secondary {
    background-color: #fff;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/**
 * Sidebar Components
 */
.sidebar-block {
    margin-bottom: 30px;
}

.block-title {
    font-size: 18px;
    margin-bottom: 15px;
}

.search-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
}

.category-list li {
    margin-bottom: 10px;
}

.category-list a {
    color: var(--text-color-light);
    font-size: 15px;
}

.category-list a:hover {
    color: var(--primary-color);
}

/**
 * Main Content Navigation
 */
.category-navigation ul {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.category-navigation a {
    color: var(--text-color-light);
    font-weight: 500;
    padding: 5px 0;
    border-bottom: 2px solid transparent;
}

.category-navigation a.active,
.category-navigation a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/**
 * Prompt Grid and Cards
 * Uses CSS Grid for a responsive, auto-fitting layout.
 */
.prompt-grid {
    display: grid;
    /* On small screens, use auto-fill. On screens > 1200px, force 4 columns. */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Add a new media query for larger screens to enforce 4 columns */
@media (min-width: 1200px) {
    .prompt-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.prompt-card {
    position: relative;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.prompt-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.card-image {
    position: relative; /* Required for positioning child elements */
    overflow: hidden; /* Ensures child elements don't spill out */
}

.card-image img {
    width: 100%;
    height: auto; /* height: auto is important */
    display: block;
    aspect-ratio: 1 / 1; /* Make it a square. Change if you prefer another ratio like 4/3 */
    object-fit: cover; /* Ensures the image covers the area without distortion */
    background-color: #eee; /* A light grey background for the placeholder area */
}

/* NEW: Styles for the view count overlay */
.view-count-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    backdrop-filter: blur(5px); /* Adds a nice frosted glass effect */
    z-index: 2; /* Ensures it's on top of the image */
}

.card-body {
    padding: 15px;
    /* justify-content is no longer needed as there's only one element */
    border-bottom: 1px solid var(--secondary-color);
}

.prompt-text {
    font-size: 14px;
    color: var(--text-color-light);
    display: -webkit-box;
    -webkit-line-clamp: 4; /* Increased from 2 to 4 for more text */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5; /* Slightly increased line-height for readability */
    min-height: 84px; /* 14px * 1.5 line-height * 4 lines */
}

.view-count {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color-light);
    background-color: var(--secondary-color);
    padding: 2px 8px;
    border-radius: 12px;
}

.card-footer {
    display: flex;
    justify-content: space-around;
    padding: 8px; /* Slightly reduced padding */
    background-color: #fcfcfc;
}

.card-action-btn {
    display: flex;
    align-items: center;
    justify-content: center; /* Center the icon inside the button */
    /* gap: 8px; */ /* No longer needed as text is removed */
    background-color: var(--secondary-color);
    border: none;
    color: var(--text-color-light);
    cursor: pointer;
    font-size: 14px; /* Slightly larger icon size */
    padding: 8px; /* Padding can be symmetrical now */
    border-radius: 6px;
    width: 40px; /* Give a fixed width */
    height: 36px; /* Give a fixed height */
    transition: all 0.2s ease;
    text-decoration: none; /* For the <a> tag */
}

.card-action-btn:hover {
    background-color: #d4dae0;
    color: var(--primary-color);
}

/* Style for the "Login to..." message for guests */
.login-prompt {
    width: 100%;
    text-align: center;
    padding: 5px 0; /* Add some vertical padding */
}

.login-prompt a {
    color: var(--text-color-light);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.login-prompt a:hover {
    color: var(--primary-color);
}

/* Remove old view-count style as it's no longer used in the card body */
.view-count {
    /* This class is no longer used, you can safely remove it or leave it empty */
}


/* ==========================================================================
   4. Responsive Styles
   ========================================================================== */

/**
 * Tablet and smaller desktops
 * @media (max-width: 1024px)
 */
@media (max-width: 1024px) {
    .container {
        max-width: 960px;
    }
}

/**
 * Mobile devices
 * @media (max-width: 768px)
 */
@media (max-width: 768px) {
    .main-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
    }
    
    .site-header .container {
        flex-direction: column;
        gap: 15px;
    }

    .category-navigation ul {
        flex-wrap: wrap; /* Allows items to wrap to the next line */
        gap: 15px;
    }

    .prompt-grid {
        grid-template-columns: 1fr; /* Single column layout on mobile */
    }
}

/**
 * Share Popup Component
 * Styles for the dynamically created social share popup.
 */
.share-popup {
    position: absolute; /* Changed to absolute to position relative to viewport */
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100; /* Ensures it appears on top of other elements */
}

.share-popup a {
    color: var(--text-color);
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 5px;
}

.share-popup a:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

/* ==========================================================================
   5. Form & Authentication Pages
   ========================================================================== */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 50px;
    padding-bottom: 50px;
}

.form-wrapper {
    background-color: var(--card-background);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 100%;
    max-width: 450px;
    border: 1px solid var(--border-color);
}

.form-wrapper h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--text-color);
}

/* Re-using admin form styles for consistency */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #374151;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.form-actions {
    margin-top: 30px;
}

.form-actions .btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
}

.auth-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-color-light);
}

.auth-switch a {
    font-weight: 500;
}

/* Alert Boxes for Frontend */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    border: 1px solid transparent;
}

.alert p:last-child {
    margin-bottom: 0;
}

.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.header-right .welcome-message {
    display: flex;
    align-items: center;
    font-weight: 500;
    color: var(--text-color);
}

/* ==========================================================================
   6. Toast Notification Styles
   ========================================================================== */

.toast-notification {
    position: fixed; /* Stays in place even when scrolling */
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%); /* Centers the element horizontally */
    background-color: #28a745; /* A success green color */
    color: #fff;
    padding: 12px 25px;
    border-radius: 25px; /* Pill shape */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-size: 15px;
    font-weight: 500;
    z-index: 9999; /* Ensures it's on top of everything */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, bottom 0.3s ease, visibility 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* The state when the notification is visible */
.toast-notification.show {
    bottom: 30px; /* Moves up slightly */
    opacity: 1;
    visibility: visible;
}


/* Styling for the dynamic page heading (e.g., search results) */
.page-heading {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}


/* ==========================================================================
   7. Pagination Styles
   ========================================================================== */

.pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.pagination ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

.pagination li {
    /* No styles needed here directly */
}

.pagination a {
    display: block;
    padding: 10px 15px;
    background-color: var(--card-background);
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    border-right: 1px solid var(--border-color);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pagination li:last-child a {
    border-right: none;
}

.pagination a:hover {
    background-color: #e9ecef;
}

.pagination a.active {
    background-color: var(--primary-color);
    color: #fff;
    cursor: default;
}

/* ==========================================================================
   8. Prompt Detail Page Styles
   ========================================================================== */

.prompt-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 40px;
    margin-bottom: 40px;
}

.prompt-image-column img {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.prompt-info-column h1 {
    font-size: 28px;
    margin-bottom: 20px;
}

.prompt-category a {
    display: inline-block;
    background-color: var(--secondary-color);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-color-light);
    margin-bottom: 15px;
}

.prompt-category a:hover {
    background-color: #d4dae0;
    color: var(--text-color);
}

.prompt-full-text {
    background-color: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    font-size: 16px;
    line-height: 1.7;
    white-space: pre-wrap; /* Preserves line breaks from the database */
}

.prompt-actions {
    display: flex;
    gap: 15px;
}

.prompt-actions .btn {
    width: auto;
    padding: 10px 20px;
}

/* Make prompt text in card a clickable link */
.prompt-text-link {
    text-decoration: none;
}
.prompt-text-link:hover .prompt-text {
    color: var(--primary-color);
}

/* Responsive adjustments for detail page */
@media (max-width: 768px) {
    .prompt-detail-container {
        grid-template-columns: 1fr; /* Stack columns on mobile */
    }
}

/* Style for login prompt on the detail page */
.login-prompt-detail {
    width: 100%;
    text-align: left;
    background-color: #f1f5f9;
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}
.login-prompt-detail a {
    color: var(--text-color);
    font-weight: 500;
    text-decoration: none;
}
.login-prompt-detail a:hover {
    color: var(--primary-color);
}

/* ==========================================================================
   9. Related Prompts Section Styles
   ========================================================================== */

.related-prompts-section {
    padding: 60px 0;
    background-color: #f8f9fa; /* A slightly different background */
    border-top: 1px solid var(--border-color);
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-color);
}

/* Make the related prompts grid use 4 columns on desktop */
.related-prompts-section .prompt-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

@media (min-width: 1200px) {
    .related-prompts-section .prompt-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Remove footer from related cards for a cleaner look */
.related-prompts-section .prompt-card .card-footer {
    display: none;
}

/* ==========================================================================
   10. Header Navigation & Shop Page Styles
   ========================================================================== */

/* --- Header Main Navigation --- */
.site-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 40px;
}

.main-navigation ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 30px;
}

.main-navigation a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    font-size: 16px;
    padding: 5px 0;
    position: relative;
    transition: color 0.2s ease;
}

.main-navigation a:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.main-navigation a:hover,
.main-navigation a.active {
    color: var(--primary-color);
}

.main-navigation a:hover:after,
.main-navigation a.active:after {
    transform: scaleX(1);
}

/* --- Shop Page Specific Styles --- */
.shop-container {
    padding-top: 40px;
    padding-bottom: 60px;
}

.shop-header {
    text-align: center;
    margin-bottom: 40px;
}

.shop-header h1 {
    font-size: 36px;
    margin-bottom: 10px;
}

.shop-header p {
    font-size: 18px;
    color: var(--text-color-light);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Product Grid & Cards --- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}

.product-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column; /* To make footer stick to bottom */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.product-image img {
    width: 450px;
    height: auto;
    display: block;
    object-fit: cover; /* Covers the area without stretching */
}

.product-info {
    padding: 25px;
    flex-grow: 1; /* Pushes the footer down */
}

.product-title {
    font-size: 22px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.product-description {
    font-size: 15px;
    color: var(--text-color-light);
    line-height: 1.7;
}

.product-description ul {
    list-style-type: disc;
    padding-left: 20px;
    margin-top: 15px;
}

.product-description li {
    margin-bottom: 8px;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
    background-color: #fcfcfc;
}

.product-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

.product-footer .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Responsive adjustments for shop page */
@media (max-width: 768px) {
    .product-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
    }

    .header-left {
        gap: 20px;
    }
    
    .main-navigation {
        display: none; /* A proper mobile menu would be needed for a real site */
    }
}

/* ==========================================================================
   11. Blog Styles
   ========================================================================== */

.blog-container {
    padding-top: 40px;
    padding-bottom: 60px;
}

/* --- Blog Grid & Cards --- */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.post-card {
    text-decoration: none;
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}
.post-card-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}
.post-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.post-card-date {
    font-size: 12px;
    color: var(--text-color-light);
    margin-bottom: 10px;
}
.post-card-title {
    font-size: 18px;
    color: var(--text-color);
    margin-bottom: 10px;
    line-height: 1.4;
}
.post-card-excerpt {
    font-size: 14px;
    color: var(--text-color-light);
    line-height: 1.6;
    flex-grow: 1;
}
.read-more {
    margin-top: 15px;
    font-weight: 500;
    color: var(--primary-color);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.post-card:hover .read-more {
    text-decoration: underline;
}

/* --- Single Post Detail Page --- */
.post-container {
    max-width: 800px; /* Optimal reading width */
    margin: 40px auto;
}
.post-header {
    text-align: center;
    margin-bottom: 30px;
}
.post-header h1 {
    font-size: 42px;
    line-height: 1.2;
    margin-bottom: 15px;
}
.post-meta {
    font-size: 14px;
    color: var(--text-color-light);
}
.post-featured-image {
    margin-bottom: 30px;
}
.post-featured-image img {
    width: 100%;
    border-radius: var(--border-radius);
}
.post-body {
    font-size: 18px;
    line-height: 1.8;
}
.post-body h2, .post-body h3, .post-body h4 {
    margin-top: 40px;
    margin-bottom: 20px;
}
.post-body p { margin-bottom: 20px; }
.post-body ul, .post-body ol { padding-left: 25px; margin-bottom: 20px; }
.post-body li { margin-bottom: 10px; }
.post-body a { color: var(--primary-color); text-decoration: underline; }
.post-body strong { font-weight: 600; }

/* Responsive Adjustments for Blog */
@media (max-width: 1024px) {
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .blog-grid { grid-template-columns: 1fr; }
    .post-header h1 { font-size: 32px; }
}

/* ==========================================================================
   12. Post Footer (Tags & Share) Styles
   ========================================================================== */

.post-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.post-tags {
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.post-tags strong {
    font-weight: 500;
    color: var(--text-color);
}

.post-tags a {
    display: inline-block;
    background-color: var(--secondary-color);
    color: var(--text-color-light);
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.post-tags a:hover {
    background-color: var(--primary-color);
    color: #fff;
}

.post-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

.post-share strong {
    font-weight: 500;
    color: var(--text-color);
}

.share-buttons {
    display: flex;
    gap: 10px;
}

.share-buttons a {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: transform 0.2s ease;
}

.share-buttons a:hover {
    transform: translateY(-3px);
}

.share-btn-twitter { background-color: #1DA1F2; }
.share-btn-facebook { background-color: #1877F2; }
.share-btn-pinterest { background-color: #E60023; }
.share-btn-linkedin { background-color: #0A66C2; }
.share-btn-whatsapp { background-color: #25D366; }

/* ==========================================================================
   13. New Shop & Product Detail Styles
   ========================================================================== */

/* --- Simple Product Grid on Shop Page --- */
.product-grid-4-col {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.product-card-simple {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex; /* ADDED: Enable flexbox */
    flex-direction: column; /* ADDED: Stack children vertically */
}
.product-card-simple:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}
.product-card-link { 
    text-decoration: none; 
    display: flex; /* ADDED: Make the link a flex container */
    flex-direction: column; /* ADDED: Stack children vertically */
    height: 100%; /* ADDED: Make link fill the card */
}
.product-card-image img {
    width: 100%;
    display: block;
    aspect-ratio: 4 / 3; /* This was already there, but ensure it's correct */
    object-fit: cover;
    background-color: #eee;
}
.product-card-footer {
    background-color: var(--card-background);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

/* NEW: Style for the content area */
.product-card-content {
    background-color: var(--card-background);
    padding: 15px;
    flex-grow: 1; /* ADDED: This pushes the footer to the bottom */
}

.product-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.product-card-footer {
    background-color: var(--card-background);
    padding: 15px;
    border-top: 1px solid var(--border-color); /* Add a separator line */
    text-align: center; /* Align button to the center */
}

.product-card-footer .btn-sm { font-size: 12px; padding: 5px 12px; }

/* --- Product Detail Page --- */
.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin: 60px auto; /* This can remain or be slightly adjusted */
    margin-top: 40px; /* Reduced top margin as header has bottom margin */
}
.product-image-column img {
    width: 100%;
    border-radius: var(--border-radius);
}
.product-info-column h1 {
    font-size: 36px;
    margin-bottom: 20px;
}
.product-full-description {
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-color-light);
}
.product-full-description ul {
    list-style-type: disc;
    padding-left: 20px;
    margin: 20px 0;
}
.product-detail-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-price-detail {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}
.btn-lg {
    padding: 15px 30px;
    font-size: 18px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .product-grid-4-col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .product-grid-4-col { grid-template-columns: 1fr; }
    .product-detail-container { grid-template-columns: 1fr; gap: 30px; margin: 40px auto; }
}

/* NEW: Style for the full-width header */
.detail-page-header {
    text-align: center;
    margin: 40px auto;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}
.detail-page-header h1 {
    font-size: 42px;
    line-height: 1.2;
    margin: 0;
}

/* ==========================================================================
   14. Hierarchical Sidebar Category Styles
   ========================================================================== */

/* Style for the non-clickable parent category titles */
.sidebar-parent-category {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 25px; /* Add space above each new parent group */
    margin-bottom: 12px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-color);
}

/* First parent category doesn't need extra space at the top */
.sidebar-block > .sidebar-parent-category:first-of-type {
    margin-top: 0;
}

/* Adjust the list that comes after a parent title */
.sidebar-parent-category + .category-list {
    /* Styles for the sub-category list can be adjusted here if needed */
}

/* Minor adjustment for sub-category link styling for better readability */
.category-list a {
    color: var(--text-color-light);
    font-size: 15px;
    padding: 2px 0; /* Add a little vertical space */
    display: block; /* Make the whole area clickable */
}

/* ==========================================================================
   15. Lazy Loading Styles
   ========================================================================== */

/* Style for images that are about to be lazy-loaded */
img.lazy-load {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

/* Style for images after they have been loaded by the script */
img.lazy-load.loaded {
    opacity: 1;
}

/* ==========================================================================
   16. Favorite & Profile Page Styles
   ========================================================================== */

/* --- Favorite Button --- */
.favorite-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 3;
    transition: transform 0.2s ease, color 0.2s ease;
}
.favorite-btn:hover {
    transform: scale(1.1);
}
/* Style for when the prompt is favorited */
.favorite-btn.favorited {
    color: #ef4444; /* A bright red color */
}

/* --- Profile Page --- */
.profile-container {
    padding-top: 40px;
    padding-bottom: 60px;
}
.profile-header {
    text-align: center;
    margin-bottom: 40px;
}
.profile-header h1 {
    font-size: 36px;
    margin-bottom: 10px;
}
.profile-header p {
    font-size: 18px;
    color: var(--text-color-light);
    max-width: 600px;
    margin: 0 auto;
}
.favorite-category-group {
    margin-bottom: 50px;
}
.favorite-category-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}
.no-favorites-message {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--card-background);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
}
.no-favorites-message p {
    font-size: 18px;
    margin-bottom: 20px;
}

/* ==========================================================================
   17. AJAX Profile Page Styles
   ========================================================================== */

.profile-page-layout {
    display: grid;
    grid-template-columns: 280px 1fr; /* Sidebar and main content */
    gap: 40px;
    padding-top: 40px;
    padding-bottom: 60px;
}

.profile-sidebar {
    /* Styles for the sidebar container */
}
.sidebar-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
}
.profile-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.profile-category-list li {
    margin-bottom: 5px;
}
.profile-category-link {
    display: block;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text-color-light);
    border-radius: 6px;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.profile-category-link:hover {
    background-color: var(--secondary-color);
    color: var(--text-color);
}
.profile-category-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Make the prompt grid 4 columns inside the profile */
.profile-main-content .prompt-grid {
    grid-template-columns: repeat(4, 1fr);
}

/* Make cards in profile slightly smaller/compact */
.profile-main-content .prompt-card .card-body {
    padding: 12px;
}
.profile-main-content .prompt-card .prompt-text {
    font-size: 13px;
    -webkit-line-clamp: 3; /* Show 3 lines */
    min-height: 58.5px; /* 13px * 1.5 * 3 */
}

#loading-spinner {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: var(--text-color-light);
}

/* Responsive */
@media (max-width: 1024px) {
    .profile-page-layout { grid-template-columns: 1fr; }
    .profile-main-content .prompt-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
    .profile-main-content .prompt-grid { grid-template-columns: repeat(2, 1fr); }
}

/* assets/css/style.css dosyasının sonuna ekleyin */

.card-image {
    position: relative;
    overflow: hidden;
    background-color: #eee; /* Background for placeholder */
}

/* Common styles for both image and video */
.card-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease-in-out;
}

.card-image-static {
    z-index: 2; /* Image is on top by default */
}

.card-video-hover {
    z-index: 1; /* Video is underneath */
    opacity: 0; /* Hidden by default */
}

/* On hover over the card, hide the image and show the video */
.prompt-card:hover .card-image-static {
    opacity: 0;
}

.prompt-card:hover .card-video-hover {
    opacity: 1;
}

/* Style for both image and video in prompt detail page */
.prompt-detail-media {
    width: 100%;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    display: block;
}

/* ==========================================================================
   18. Related Prompts Section (FINAL & CORRECTED)
   ========================================================================== */

.related-prompts-section {
    padding: 60px 0;
    background-color: #f8f9fa;
    border-top: 1px solid var(--border-color);
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-color);
}

/* --- The Core Fix for The Image Area --- */

/* 1. Make the link inside the card image a positioned block with a fixed aspect ratio.
      This creates the "box" that the image and video will live inside. */
.related-prompts-section .card-image > a {
    display: block;
    position: relative;
    aspect-ratio: 1 / 1; /* Creates a square container. Change to 4/3 or 16/9 if you prefer. */
    background-color: #eee; /* This is the grey placeholder color that will now be visible. */
    border-radius: var(--border-radius); /* Ensure the container has rounded corners if the card does */
    overflow: hidden; /* Hide anything that spills out */
}

/* 2. Make both the image and the video absolutely positioned to fill this new container. */
.related-prompts-section .card-image .card-media {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 3. Re-apply the lazy loading fade-in effect to this specific structure. */
.related-prompts-section .card-image img.lazy-load {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.related-prompts-section .card-image img.lazy-load.loaded {
    opacity: 1;
}

/* 4. Ensure the grid and card structure are correctly defined. */
.related-prompts-section .prompt-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}
@media (max-width: 1024px) {
    .related-prompts-section .prompt-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .related-prompts-section .prompt-grid { grid-template-columns: 1fr; }
}
