/**
 * Prompt Gallery Styles
 */

/* Category Filter Buttons */
.category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-filter-btn {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.category-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(133, 234, 128, 0.5);
}

.category-filter-btn.active {
    background: linear-gradient(135deg, rgba(133, 234, 128, 0.3), rgba(133, 234, 128, 0.1));
    border-color: #85EA80;
    color: #85EA80;
}

.category-filter-btn .badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.category-filter-btn.active .badge {
    background: rgba(133, 234, 128, 0.3);
}

/* Active-category filter bar (replaces full category list when a category is selected) */
.pg-filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 6px 2px;
}

.pg-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.pg-back-btn:hover {
    background: rgba(133, 234, 128, 0.15);
    border-color: rgba(133, 234, 128, 0.6);
    color: #85EA80;
}

.pg-back-btn .material-icons {
    font-size: 18px;
}

.pg-filter-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    font-weight: 600;
    color: #85EA80;
}

.pg-filter-label .material-icons {
    font-size: 16px;
}

/* Light-mode overrides */
body.active-light-mode .pg-back-btn {
    border-color: rgba(0, 0, 0, 0.15);
    background: rgba(0, 0, 0, 0.04);
    color: #333;
}

body.active-light-mode .pg-back-btn:hover {
    background: rgba(133, 234, 128, 0.15);
    border-color: #85EA80;
    color: #2a7a27;
}

body.active-light-mode .pg-filter-label {
    color: #2a7a27;
}


.prompt-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .prompt-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
}

/* Prompt Gallery Item */
.prompt-gallery-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.prompt-gallery-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(133, 234, 128, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Prompt Thumbnail */
.prompt-thumbnail {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.prompt-thumbnail img,
.prompt-thumbnail video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.prompt-gallery-item:hover .prompt-thumbnail img,
.prompt-gallery-item:hover .prompt-thumbnail video {
    transform: scale(1.05);
}

.prompt-thumbnail .placeholder-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.3);
    font-size: 48px;
}

.prompt-thumbnail .placeholder-icon .material-icons {
    font-size: 48px;
}

/* Featured Badge */
.featured-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.featured-badge .material-icons {
    font-size: 16px;
}

/* Prompt Info */
.prompt-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.prompt-text {
    color: #fff;
    font-size: 13px;
    line-height: 1.4;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.prompt-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.meta-item .material-icons {
    font-size: 14px;
}

.category-tag {
    background: rgba(133, 234, 128, 0.2);
    color: #85EA80;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Loading State */
.loading-state {
    padding: 40px 20px;
}

.loading-state .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3em;
}

/* Error State */
.error-state {
    padding: 40px 20px;
}

/* Load More Button */
.load-more-prompts {
    padding: 10px 24px;
    border-radius: 8px;
    background: rgba(133, 234, 128, 0.1);
    border: 1px solid #85EA80;
    color: #85EA80;
    font-weight: 600;
    transition: all 0.3s ease;
}

.load-more-prompts:hover {
    background: rgba(133, 234, 128, 0.2);
    transform: translateY(-2px);
}

/* Light Mode Styles */
body.active-light-mode .category-filter-btn {
    border-color: #dee2e6;
    background: #f8f9fa;
    color: #212529;
}

body.active-light-mode .category-filter-btn:hover {
    background: #e9ecef;
    border-color: var(--color-primary);
}

body.active-light-mode .category-filter-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

body.active-light-mode .category-filter-btn .badge {
    background: rgba(0, 0, 0, 0.1);
}

body.active-light-mode .category-filter-btn.active .badge {
    background: rgba(255, 255, 255, 0.3);
}

body.active-light-mode .prompt-gallery-item {
    background: #fff;
    border-color: #dee2e6;
}

body.active-light-mode .prompt-gallery-item:hover {
    background: #f8f9fa;
    border-color: var(--color-primary);
}

body.active-light-mode .prompt-thumbnail {
    background: #e9ecef;
}

body.active-light-mode .prompt-text {
    color: #212529;
}

body.active-light-mode .prompt-meta {
    color: #6c757d;
}

body.active-light-mode .load-more-prompts {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

body.active-light-mode .load-more-prompts:hover {
    opacity: 0.9;
}

/* ============================================================
   Full-Screen Prompt Gallery Modal (pgm-*)
   ============================================================ */

.pgm-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

.pgm-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    margin: 20px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    overflow: hidden;
}

/* -- Header -- */
.pgm-header {
    flex-shrink: 0;
    padding: 20px 24px 0;
    background: #1a1a2e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.pgm-title-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.pgm-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pgm-title-icon {
    color: #85EA80;
    font-size: 22px;
}

.pgm-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

.pgm-search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.pgm-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 20px;
    pointer-events: none;
    z-index: 1;
}

.pgm-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: #fff;
    padding: 10px 40px 10px 44px !important;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    height: auto !important;
}

.pgm-search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.pgm-search-input:focus {
    border-color: rgba(133, 234, 128, 0.6);
    background: rgba(255, 255, 255, 0.09);
}

.pgm-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: color 0.2s;
}

.pgm-search-clear:hover {
    color: #fff;
}

.pgm-close-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.pgm-close-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

/* -- Category Filters -- */
.pgm-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 16px;
    overflow-x: auto;
}

.pgm-categories-loading {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
}

.pgm-cat-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.pgm-cat-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(133, 234, 128, 0.4);
}

.pgm-cat-btn.active {
    background: rgba(133, 234, 128, 0.2);
    border-color: #85EA80;
    color: #85EA80;
}

/* Marketing Picks special button */
.pgm-cat-marketing {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1)) !important;
    border-color: rgba(255, 193, 7, 0.5) !important;
    color: #FFC107 !important;
}

.pgm-cat-marketing:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25), rgba(255, 152, 0, 0.2)) !important;
    border-color: #FFC107 !important;
}

.pgm-cat-marketing.active {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.35), rgba(255, 152, 0, 0.25)) !important;
    border-color: #FFC107 !important;
    color: #FFC107 !important;
}

.pgm-cat-badge {
    background: rgba(255, 255, 255, 0.15);
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
}

.pgm-cat-btn.active .pgm-cat-badge {
    background: rgba(133, 234, 128, 0.25);
}

/* -- Body -- */
.pgm-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.pgm-body::-webkit-scrollbar {
    width: 6px;
}

.pgm-body::-webkit-scrollbar-track {
    background: transparent;
}

.pgm-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

/* -- Grid -- */
.pgm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

/* -- Cards -- */
.pgm-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.pgm-card:hover {
    transform: translateY(-3px);
    border-color: rgba(133, 234, 128, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.pgm-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.pgm-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.pgm-card-thumb video.pgm-video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.pgm-card:hover .pgm-card-thumb img,
.pgm-card:hover .pgm-card-thumb video.pgm-video-thumb {
    transform: scale(1.04);
}

/* GIF hover-to-play */
.pgm-gif-thumb {
    background: rgba(0,0,0,0.4);
}

.pgm-gif-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: opacity 0.2s;
}

.pgm-gif-overlay .material-icons {
    font-size: 48px;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    filter: drop-shadow(0 0 6px rgba(0,0,0,0.5));
}

.pgm-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.2);
}

.pgm-card-placeholder .material-icons {
    font-size: 40px;
}

.pgm-card-body {
    padding: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pgm-card-text {
    color: rgba(255, 255, 255, 0.85);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.pgm-card-footer {
    margin-top: auto;
}

.pgm-card-cat {
    background: rgba(133, 234, 128, 0.15);
    color: #85EA80;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* -- Loading / Empty states -- */
.pgm-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.pgm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #85EA80;
    border-radius: 50%;
    animation: pgm-spin 0.75s linear infinite;
}

@keyframes pgm-spin {
    to { transform: rotate(360deg); }
}

.pgm-empty {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

/* -- Footer -- */
.pgm-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: #1a1a2e;
}

.pgm-load-more {
    padding: 10px 28px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* -- Light Mode -- */
body.active-light-mode .pgm-container {
    background: #fff;
    border-color: #e0e0e0;
}

body.active-light-mode .pgm-header,
body.active-light-mode .pgm-footer {
    background: #fff;
    border-color: #e0e0e0;
}

body.active-light-mode .pgm-title {
    color: #1a1a2e;
}

body.active-light-mode .pgm-search-input {
    background: #f5f5f5;
    border-color: #ddd;
    color: #1a1a2e;
}

body.active-light-mode .pgm-search-input:focus {
    border-color: var(--color-primary);
    background: #fff;
}

body.active-light-mode .pgm-close-btn {
    background: #f0f0f0;
    border-color: #ddd;
    color: #555;
}

body.active-light-mode .pgm-cat-btn {
    background: #f5f5f5;
    border-color: #ddd;
    color: #333;
}

body.active-light-mode .pgm-cat-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

body.active-light-mode .pgm-card {
    background: #fff;
    border-color: #e0e0e0;
}

body.active-light-mode .pgm-card:hover {
    border-color: var(--color-primary);
}

body.active-light-mode .pgm-card-text {
    color: #333;
}

/* -- Responsive -- */
@media (max-width: 640px) {
    .pgm-container {
        margin: 0;
        border-radius: 0;
    }

    .pgm-title {
        display: none;
    }

    .pgm-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}
