/* ================================================================
   AAWEA Prompts Platform — Design System
   Color: #7C3AED (brand purple) / #EDE9FE (light purple) / #F6F4FA (bg)
   ================================================================ */

/* ── CSS Variables ─────────────────────────────────────────────── */
:root {
    --ph-purple:      #7C3AED;
    --ph-purple-dark: #5B21B6;
    --ph-purple-lite: #EDE9FE;
    --ph-purple-bg:   #F6F4FA;
    --ph-border:      #E3DFF0;
    --ph-shadow:      rgba(124, 58, 237, 0.09);
    --ph-shadow-hover:rgba(124, 58, 237, 0.18);
    --ph-text:        #1A1530;
    --ph-muted:       #6B7280;
    --ph-prompt-bg:   #FEFCE8;
    --ph-white:       #FFFFFF;
    --ph-radius:      12px;
    --ph-radius-sm:   8px;
    --ph-radius-pill: 100px;
}

/* ── Page background ───────────────────────────────────────────── */
.ph-page { background: var(--ph-white); }
.ph-section { padding: 56px 0; }
.ph-section-alt { background: var(--ph-purple-bg); }

/* ── Hero ──────────────────────────────────────────────────────── */
.ph-hero {
    background: var(--ph-white);
    border-bottom: 1px solid var(--ph-border);
    padding: 60px 0 44px;
}
.ph-hero-badge {
    display: inline-block;
    background: var(--ph-purple-lite);
    color: var(--ph-purple);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-pill);
    padding: 4px 16px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    margin-bottom: 16px;
}
.ph-hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -.02em;
    color: var(--ph-text);
    margin-bottom: 12px;
}
.ph-hero-sub {
    font-size: 15px;
    color: var(--ph-muted);
    max-width: 560px;
    margin: 0 auto 28px;
    text-align: center;
}

/* ── Search bar ────────────────────────────────────────────────── */
.ph-search-wrap { max-width: 520px; margin: 0 auto 28px; position: relative; }
.ph-search-wrap form { display: flex; gap: 8px; }
.ph-search-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid var(--ph-border);
    border-radius: var(--ph-radius-sm);
    font-size: 15px;
    outline: none;
    transition: border-color .2s;
    color: var(--ph-text);
}
.ph-search-input:focus { border-color: var(--ph-purple); }
.ph-search-btn {
    background: var(--ph-purple);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--ph-radius-sm);
    font-weight: 800;
    font-size: 14px;
    cursor: pointer;
    transition: background .15s;
}
.ph-search-btn:hover { background: var(--ph-purple-dark); }

/* Autocomplete dropdown */
.ph-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-sm);
    box-shadow: 0 8px 24px var(--ph-shadow);
    z-index: 100;
}
.ph-suggestion-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    text-decoration: none;
    color: var(--ph-text);
    border-bottom: 1px solid var(--ph-border);
    transition: background .1s;
}
.ph-suggestion-item:last-child { border-bottom: none; }
.ph-suggestion-item:hover { background: var(--ph-purple-bg); }
.ph-suggestion-item img {
    width: 36px; height: 36px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--ph-border);
}
.ph-suggestion-item span { font-weight: 700; font-size: 14px; }

/* ── Filter pills row ──────────────────────────────────────────── */
.ph-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 28px;
}
.ph-pill {
    border: 1.5px solid var(--ph-border);
    background: var(--ph-white);
    color: var(--ph-text);
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 700;
    border-radius: var(--ph-radius-pill);
    text-decoration: none;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.ph-pill:hover {
    border-color: var(--ph-purple);
    color: var(--ph-purple);
    background: var(--ph-purple-lite);
}
.ph-pill.active,
.ph-pill[aria-current="true"] {
    background: var(--ph-purple);
    color: #fff;
    border-color: var(--ph-purple);
}
.ph-tag-btn {
    border: 1.5px solid var(--ph-border);
    background: var(--ph-white);
    color: var(--ph-muted);
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--ph-radius-pill);
    cursor: pointer;
    transition: all .15s;
}
.ph-tag-btn.active {
    background: var(--ph-purple);
    color: #fff;
    border-color: var(--ph-purple);
}

/* ── Section headings ──────────────────────────────────────────── */
.ph-section-title {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--ph-text);
    letter-spacing: -.02em;
    margin: 0;
}
.ph-section-badge {
    background: var(--ph-purple-lite);
    color: var(--ph-purple);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-pill);
    padding: 2px 12px;
    font-size: 11px;
    font-weight: 800;
}

/* ── Masonry grid (JS-driven flex columns — see masonry-columns.js) ── */
/* column-count kept as no-JS fallback only; JS overrides with flex.    */
.ph-masonry {
    column-count: 4;
    column-gap: 20px;
}
@media (max-width: 1200px) { .ph-masonry { column-count: 3; } }
@media (max-width: 900px)  { .ph-masonry { column-count: 2; } }
@media (max-width: 560px)  { .ph-masonry { column-count: 1; } }

/* JS-driven masonry column */
.masonry-col { min-width: 0; }

/* ── Prompt card (masonry item) ────────────────────────────────── */
.ph-card {
    break-inside: avoid;
    margin-bottom: 20px;
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
    cursor: pointer;
    display: inline-block;
    width: 100%;
}
.ph-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--ph-shadow-hover);
}

/* Card image — preserves natural aspect ratio, no crop */
.ph-card-img {
    background: var(--ph-purple-bg);
    min-height: 120px;
}
.ph-card-img img,
.ph-card-img video {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity .3s;
}
.ph-card-img { position: relative; overflow: hidden; }
.ph-card-img .ph-rank-badge {
    position: absolute;
    top: 10px; left: 10px;
    background: var(--ph-purple-lite);
    color: var(--ph-purple);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-pill);
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 900;
}
.ph-card-img .ph-featured-badge {
    position: absolute;
    top: 10px; right: 10px;
    background: var(--ph-purple);
    color: #fff;
    border-radius: var(--ph-radius-pill);
    padding: 2px 10px;
    font-size: 10px;
    font-weight: 800;
}
.ph-card-img .ph-video-badge {
    position: absolute;
    bottom: 8px; right: 8px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
}

/* Card body */
.ph-card-body { padding: 14px 16px 6px; }
.ph-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--ph-text);
    line-height: 1.4;
    margin: 0 0 8px;
}
.ph-card-title a { color: inherit; text-decoration: none; }
.ph-card-title a:hover { color: var(--ph-purple); }

/* Model / category chips */
.ph-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: var(--ph-radius-pill);
    font-size: 10px;
    font-weight: 700;
    margin-right: 4px;
    margin-bottom: 4px;
}
.ph-chip-model {
    background: var(--ph-purple);
    color: #fff;
}
.ph-chip-cat {
    background: var(--ph-purple-lite);
    color: var(--ph-purple);
    border: 1px solid var(--ph-border);
}

/* Prompt preview snippet */
.ph-card-snippet {
    padding: 10px 16px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.6;
    color: #555;
    background: var(--ph-purple-bg);
    border-top: 1px solid var(--ph-border);
}

/* Card footer */
.ph-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 14px;
    border-top: 1px solid var(--ph-border);
}
.ph-card-stat { font-size: 12px; color: var(--ph-muted); font-weight: 600; }
.ph-card-link {
    font-size: 12px;
    font-weight: 700;
    color: var(--ph-purple);
    text-decoration: none;
}
.ph-card-link:hover { color: var(--ph-purple-dark); }

/* Card actions */
.ph-card-actions { display: flex; gap: 8px; padding: 0 16px 14px; }
.ph-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--ph-radius-sm);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    border: none;
}
.ph-btn-primary {
    flex: 1;
    background: var(--ph-purple);
    color: #fff;
}
.ph-btn-primary:hover { background: var(--ph-purple-dark); color: #fff; }
.ph-btn-outline {
    background: #fff;
    color: var(--ph-purple);
    border: 1.5px solid var(--ph-border);
}
.ph-btn-outline:hover {
    border-color: var(--ph-purple);
    background: var(--ph-purple-lite);
}

/* ── Model/Media index cards ───────────────────────────────────── */
.ph-model-card {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    padding: 24px 20px;
    text-align: center;
    text-decoration: none;
    display: block;
    height: 100%;
    transition: transform .2s, box-shadow .2s;
}
.ph-model-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--ph-shadow-hover);
    text-decoration: none;
}
.ph-model-card h4 { font-weight: 800; font-size: 15px; color: var(--ph-text); margin-bottom: 6px; }
.ph-model-card p  { font-size: 12px; color: var(--ph-muted); line-height: 1.4; }
.ph-model-card .ph-model-cta { font-size: 13px; font-weight: 700; color: var(--ph-purple); margin-top: 14px; }

.ph-media-card {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    padding: 28px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s;
}
.ph-media-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px var(--ph-shadow-hover);
    text-decoration: none;
}
.ph-media-card h4 { font-weight: 800; font-size: 17px; color: var(--ph-text); margin-bottom: 4px; }
.ph-media-card p  { font-size: 13px; color: var(--ph-muted); margin: 0; }

/* ── No-image placeholder ──────────────────────────────────────── */
.ph-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    padding: 20px;
    text-align: center;
    font-size: 14px;
    background: linear-gradient(135deg, var(--ph-purple) 0%, #a855f7 100%);
}

/* ── Prompt detail page ────────────────────────────────────────── */
.ph-detail-cover {
    border: 2px solid var(--ph-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
    margin-bottom: 24px;
    background: #000;
}
.ph-detail-cover img,
.ph-detail-cover video {
    width: 100%;
    height: auto;
    max-height: 75vh;
    display: block;
    object-fit: contain;
    background: #000;
}

/* Prompt template box */
.ph-prompt-box {
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    overflow: hidden;
    margin-bottom: 32px;
    box-shadow: 0 4px 16px var(--ph-shadow);
}
.ph-prompt-box-header {
    background: var(--ph-purple-lite);
    border-bottom: 1px solid var(--ph-border);
    padding: 11px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 800;
    font-size: 13px;
    color: var(--ph-purple);
}
.ph-prompt-box-content {
    padding: 20px;
    background: var(--ph-prompt-bg);
    overflow-x: auto;
}
.ph-prompt-box-content pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    color: #1a1a1a;
    line-height: 1.7;
    font-weight: 500;
}

/* Sidebar cards */
.ph-sidebar-card {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px var(--ph-shadow);
}
.ph-sidebar-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--ph-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 4px;
}
.ph-sidebar-val { font-size: 14px; font-weight: 700; color: var(--ph-text); }

/* Stats grid */
.ph-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}
.ph-stat-item {
    background: var(--ph-white);
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-sm);
    padding: 12px 14px;
}
.ph-stat-label { font-size: 10px; font-weight: 700; color: var(--ph-muted); text-transform: uppercase; letter-spacing: .04em; }
.ph-stat-value { font-size: 20px; font-weight: 900; color: var(--ph-purple); margin-top: 2px; }

/* Author avatar */
.ph-author-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--ph-purple);
    color: var(--ph-purple-lite);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 20px;
    flex-shrink: 0;
}

/* Inline action buttons (Like / Save / Share) */
.ph-action-row { display: flex; gap: 8px; margin-bottom: 16px; }
.ph-action-btn {
    flex: 1;
    border: 1.5px solid var(--ph-border);
    background: var(--ph-white);
    color: var(--ph-purple);
    padding: 9px 6px;
    font-size: 12px;
    font-weight: 800;
    border-radius: var(--ph-radius-sm);
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}
.ph-action-btn:hover, .ph-action-btn.active {
    background: var(--ph-purple);
    color: #fff;
    border-color: var(--ph-purple);
}
.ph-action-btn-icon {
    border: 1.5px solid var(--ph-border);
    background: var(--ph-white);
    color: var(--ph-purple);
    padding: 9px 14px;
    border-radius: var(--ph-radius-sm);
    cursor: pointer;
    transition: all .15s;
    font-size: 16px;
    font-weight: 800;
}
.ph-action-btn-icon:hover {
    border-color: var(--ph-purple);
    background: var(--ph-purple-lite);
}

/* Run / CTA box */
.ph-run-box {
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius);
    padding: 24px;
    background: var(--ph-white);
    box-shadow: 0 4px 16px var(--ph-shadow);
}
.ph-run-box h4 { font-weight: 900; font-size: 18px; margin: 0 0 8px; color: var(--ph-text); }
.ph-run-box p  { font-size: 14px; color: var(--ph-muted); margin-bottom: 16px; }
.ph-btn-cta {
    display: block;
    background: var(--ph-purple);
    color: #fff;
    text-align: center;
    padding: 14px;
    font-weight: 900;
    font-size: 15px;
    border-radius: var(--ph-radius-sm);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background .15s;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.ph-btn-cta:hover { background: var(--ph-purple-dark); color: #fff; }

/* Lightbox */
#ph-lightbox {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.88);
    backdrop-filter: blur(6px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
#ph-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: var(--ph-radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
#ph-lightbox-close {
    position: absolute; top: 20px; right: 24px;
    color: #fff; font-size: 32px; cursor: pointer;
    background: none; border: none; line-height: 1;
}

/* Infinite scroll spinner */
.ph-loader { text-align: center; padding: 40px 0; }

/* Empty state */
.ph-empty {
    text-align: center;
    padding: 80px 20px;
    border: 2px dashed var(--ph-border);
    border-radius: var(--ph-radius);
    background: var(--ph-purple-bg);
}
.ph-empty-icon { font-size: 48px; margin-bottom: 16px; }
.ph-empty h4 { font-weight: 800; color: var(--ph-text); }
.ph-empty p  { color: var(--ph-muted); }

/* Breadcrumb */
.ph-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ph-muted);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ph-breadcrumb a { color: var(--ph-muted); text-decoration: none; }
.ph-breadcrumb a:hover { color: var(--ph-purple); }
.ph-breadcrumb .sep { color: #ccc; }
.ph-breadcrumb .current { color: var(--ph-text); }

/* Community generations grid */
.ph-community-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
@media (max-width: 768px) { .ph-community-grid { grid-template-columns: repeat(4, 1fr); } }
.ph-gen-card {
    border: 1px solid var(--ph-border);
    border-radius: var(--ph-radius-sm);
    overflow: hidden;
    position: relative;
    cursor: zoom-in;
    transition: all .2s;
}
.ph-gen-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px var(--ph-shadow-hover); }
.ph-gen-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.ph-gen-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,.8) 0%, transparent 100%);
    display: flex; justify-content: center; gap: 6px;
    padding: 12px 6px;
    opacity: 0; transition: opacity .2s;
}
.ph-gen-card:hover .ph-gen-overlay { opacity: 1; }

/* Search highlight in results */
.ph-result-count { font-weight: 900; font-size: 1.4rem; color: var(--ph-text); margin-bottom: 24px; text-align: center; }
.ph-result-count em { color: var(--ph-purple); font-style: normal; }
