/* Main Grid Layout */
.prompts-grid {
    column-count: 4;
    column-gap: 16px;
    padding-bottom: 4rem;
}

@media (max-width: 1600px) {
    .prompts-grid {
        column-count: 4;
    }
}

@media (max-width: 1200px) {
    .prompts-grid {
        column-count: 3;
    }
}

@media (max-width: 900px) {
    .prompts-grid {
        column-count: 2;
        column-gap: 12px;
    }
}

@media (max-width: 480px) {
    .prompts-grid {
        column-count: 2;
        column-gap: 8px;
    }
}

/* Prompt Card */
.prompt-card {
    break-inside: avoid;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    box-shadow: var(--shadow-sm);
}

@media (max-width: 480px) {
    .prompt-card {
        margin-bottom: 8px;
        border-radius: 6px;
    }
}

.prompt-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: #baa89b;
}

.card-image-wrapper {
    position: relative;
    overflow: hidden;
    /* Aspect ratio is handled by the image itself seamlessly in masonry */
}

.card-image {
    width: 100%;
    display: block;
    transition: transform 0.5s ease;
}

.prompt-card:hover .card-image {
    transform: scale(1.05);
}

.card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 3rem 1.5rem 1.5rem;
    opacity: 1;
    transition: var(--transition);
}

.card-title {
    color: white;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.card-badge {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Minimal Heart Button */
/* Minimal Heart Button */
.heart-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.4);
    /* Translucent Black */
    backdrop-filter: blur(4px);
    border: none;
    padding: 6px 10px;
    height: 32px;
    min-width: 32px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
}

.heart-btn i {
    color: rgba(255, 255, 255, 0.8);
    /* Default light grey/white */
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.heart-btn .like-count {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-body);
}

.heart-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.heart-btn.liked i {
    color: #ef4444;
    /* Red Icon when liked */
}

.heart-btn.active i {
    color: #ef4444;
    font-weight: 900;
}

.heart-btn.active .like-count {
    color: white;
}

.heart-btn:hover i {
    color: #ff4757;
}

/* Video Badge */
.video-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(139, 111, 78, 0.9);
    color: white;
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 5;
}

/* Creator Credit */
.prompt-creator-credit {
    position: absolute;
    bottom: 15px;
    right: 15px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    font-weight: 400;
    z-index: 5;
    pointer-events: none;
    font-family: var(--font-body);
}

/* Card Info at Bottom */
.card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    transition: all 0.3s ease;
}

.card-info .card-title {
    color: white;
    font-family: var(--font-heading);
    font-size: 1rem;
    margin-bottom: 6px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Glassy Category Badge */
.card-category-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: 20px;
    text-transform: capitalize;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    margin-top: 8px;
}

/* Video Badge */
.card-type-badge.video {
    background: rgba(139, 111, 78, 0.9);
    color: white;
    font-size: 0.65rem;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Mobile Tweaks */
@media (max-width: 480px) {
    .prompts-grid {
        column-gap: 6px;
        /* Reduced gap */
    }

    .prompt-card {
        margin-bottom: 6px !important;
        /* Reduced bottom margin */
    }

    .card-info {
        padding: 30px 10px 10px;
        /* Reduced padding */
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95), transparent);
        /* Stronger gradient for readibility */
    }

    .card-info .card-title {
        font-family: 'Inter', sans-serif !important;
        /* Inter font */
        font-size: 0.8rem;
        /* Smaller font */
        margin-bottom: 4px;
        /* Reduced gap between title and category */

        /* Truncate to 1 line with ellipsis */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .card-category-badge {
        font-size: 0.6rem;
        padding: 3px 8px;
        margin-top: 4px;
        /* Reduced top margin */
        border-width: 0.5px;
    }

    /* Hide category for landscape images (JS will add .landscape class) */
    .prompt-card.landscape .card-category-badge {
        display: none;
    }
}

/* Explore Page (Route) */
.explore-page-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

@media (max-width: 1100px) {
    .explore-page-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .explore-page-grid {
        grid-template-columns: 1fr;
    }
}

/* Variable height card logic */
.explore-page-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    height: auto;
    /* Let content define height */
    min-height: 0;
    /* Reset */
    text-align: left;
    display: block;
    width: 100%;
}

.explore-page-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.explore-page-card-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.explore-page-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 18px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
}

.explore-page-card-title {
    color: #fff;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    line-height: 1.15;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.explore-page-card-sub {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
}

.explore-empty {
    width: 100%;
    padding: 26px;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.6);
    text-align: center;
}

/* Modal Styles */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    /* Darker backdrop */
    z-index: 9999;
    /* Max z-index to cover everything */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    backdrop-filter: blur(8px);
    /* Add blur for premium feel */
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-primary);
    width: 100%;
    max-width: 1100px;
    height: 85vh;
    border-radius: 12px;
    display: flex;
    overflow: hidden;
    position: relative;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.modal-backdrop.active .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.modal-body {
    display: flex;
    width: 100%;
    height: 100%;
}

.modal-image-container {
    flex: 1.4;
    background-color: #0c0c0c;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-details {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-primary);
}

.prompt-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 20px;
}

.modal-header {
    margin-bottom: 2rem;
}

.category-badge {
    background: rgba(139, 111, 78, 0.1);
    color: #8b7355;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 12px;
    display: inline-block;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    color: var(--text-heading);
    line-height: 1.25;
}

.prompt-tabs {
    display: flex;
    gap: 4px;
    background: #f0f0f0;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.prompt-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    color: #666;
    transition: all 0.2s ease;
}

.prompt-tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.prompt-tab.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.json-code {
    background: #1a1a1a;
    color: #00E5FF;
    /* Match the cyan theme */
    font-family: var(--font-code);
    font-size: 0.85rem;
}

.modal-meta-row {
    margin-top: auto;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.meta-stats {
    display: flex;
    gap: 15px;
}

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

/* Mobile Adjustments */
@media (max-width: 900px) {
    .modal-backdrop {
        padding: 0;
    }

    .modal-content {
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        flex-direction: column;
    }

    .modal-body {
        flex-direction: column;
    }

    .modal-image-container {
        flex: 0 0 45%;
        max-height: 45%;
    }

    .modal-details {
        flex: 1;
        padding: 1.5rem;
    }

    .modal-title {
        font-size: 1.4rem;
    }

    .modal-close {
        top: 15px;
        right: 15px;
        width: 32px;
        height: 32px;
    }
}