:root {
    --bg-color: #0b0f19;
    --app-bg: linear-gradient(135deg, #101525, #070a12);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --text-color: #ffffff;
    --text-dim: #949ca8;
    --accent-color: #ab47bc;
    --accent-glow: rgba(171, 71, 188, 0.3);
    --topbar-bg: rgba(16, 21, 37, 0.88);
}

/* Light Theme Variables */
body.light-mode {
    --bg-color: #f0f4f8;
    --app-bg: linear-gradient(135deg, #e2e8f0, #cbd5e1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --text-color: #1e293b;
    --text-dim: #64748b;
    --topbar-bg: rgba(255, 255, 255, 0.88);
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--app-bg);
    z-index: -1;
    transition: all 0.3s ease;
}

/* No outer box: navbar, content and footer are direct children of body,
   stacked vertically like Project A. Only their own cards keep a box. */

/* Navbar — floating pill, like Project A, in Project B colours */
.navbar {
    position: sticky;
    top: 14px;
    z-index: 100;
    width: 70%;
    margin: 14px auto 0;
    padding: 18px 30px;
    background: var(--topbar-bg);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    box-shadow: var(--glass-shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-wrap: wrap;
    gap: 15px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-placeholder {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--accent-color), #6a1b9a);
    border-radius: 14px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px var(--accent-glow);
    color: #fff;
}

.brand-name {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 0 10px var(--accent-glow);
}

.nav-links {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-color);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
}

.utilities {
    display: flex;
    align-items: center;
    gap: 15px;
}

.search-box {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}

/* The search field deliberately has no focus outline or glow: when it is
   active, it should look exactly as it does when it is not. */
.search-box:focus-within {
    border-color: var(--glass-border);
    box-shadow: none;
}
#searchInput:focus, #searchInput:focus-visible {
    outline: none;
    box-shadow: none;
}

.search-box input {
    background: transparent;
    border: none;
    color: var(--text-color);
    outline: none;
    width: 150px;
}

.theme-toggle {
    cursor: pointer;
    padding: 0;
    font: inherit;
    color: var(--text-color);
    width: 45px;
    height: 45px;
    background: var(--glass-bg);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--glass-border);
    transition: all 0.4s ease;
}

.theme-toggle:hover {
    transform: rotate(180deg);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Hero — Project A layout, Project B colours. Headline + subtext only, no stats. */
.hero {
    position: relative;
    width: 95%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 72px 0 32px;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
}
.orb-a {
    width: 560px;
    height: 560px;
    top: -180px;
    right: -120px;
    background: rgba(171, 71, 188, 0.14);
}
.orb-b {
    width: 480px;
    height: 480px;
    top: 220px;
    left: -200px;
    background: rgba(106, 27, 154, 0.14);
}
.hero-inner {
    position: relative;
    z-index: 2;
}
h1.hero-h {
    font-family: "Space Grotesk", 'Segoe UI', sans-serif;
    font-weight: 700;
    letter-spacing: -0.035em;
    font-size: clamp(40px, 7.6vw, 108px);
    line-height: 0.98;
    max-width: 1000px;
    margin: 0;
    color: var(--text-color);
}
h1.hero-h .serif {
    font-family: "Instrument Serif", serif;
    font-style: italic;
    font-weight: 400;
    color: var(--accent-color);
    letter-spacing: -0.01em;
}
.hero-sub {
    margin-top: 28px;
    max-width: 600px;
    color: var(--text-dim);
    font-size: 18px;
    line-height: 1.65;
}
.hero-sub b {
    color: var(--text-color);
    font-weight: 600;
}

/* Plain info pages (Privacy, About, Contact, Terms) — no card, standard page layout */
.page {
    flex: 1;
    width: 95%;
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 0 16px;
}
.page h1 {
    font-size: 2rem;
    margin: 0 0 8px;
    color: var(--text-color);
}
.page h2 {
    font-size: 2rem;
    margin: 0 0 8px;
    color: var(--text-color);
}
.page h3 {
    font-size: 1.25rem;
    margin: 28px 0 8px;
    color: var(--text-color);
}
.page p {
    color: var(--text-dim);
    line-height: 1.7;
    margin: 0 0 16px;
    font-size: 1rem;
}
.page .contact-form {
    margin-top: 24px;
}
.form-btn {
    width: 100%;
    background: var(--accent-color);
    border: 1px solid var(--accent-color);
    color: #fff;
    border-radius: 12px;
    padding: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.form-btn:hover {
    box-shadow: 0 4px 15px var(--accent-glow);
}

/* Search + Categories toolbar — search on the left, filters beside it */
.filter-toolbar {
    width: 95%;
    max-width: 1300px;
    margin: 24px auto 0;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.filter-toolbar .search-box {
    flex: 0 0 260px;
}
.filter-toolbar .search-box input {
    width: 100%;
}

/* Categories Bar — its own section below the navbar, not inside a box */
.categories-bar {
    width: 95%;
    max-width: 1300px;
    margin: 24px auto 0;
    justify-content: center;
    padding: 0;
    display: flex;
    gap: 15px;
    border: 0;
    background: transparent;
    flex-wrap: wrap;
}
.filter-toolbar .categories-bar {
    width: auto;
    flex: 1;
    margin: 0;
    justify-content: flex-start;
}

.cat-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-dim);
    padding: 10px 24px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cat-btn:hover, .cat-btn.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    box-shadow: 0 4px 15px var(--accent-glow);
    transform: translateY(-2px);
}

/* Content — its own centered section, page scrolls normally */
.content {
    flex: 1;
    width: 95%;
    max-width: 1300px;
    margin: 0 auto;
    padding: 30px 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px var(--accent-glow);
    border-color: var(--accent-color);
}

.card-img {
    height: 160px;
    cursor: pointer;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background-size: cover !important;
    background-position: center !important;
}

.preview-overlay {
    opacity: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 600;
    transition: opacity 0.3s ease;
}

.card:hover .preview-overlay {
    opacity: 1;
}

.card-body {
    padding: 20px;
    flex: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.card h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-color);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card p {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.9rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Visible focus for keyboard users */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Load more row, below the prompt grid */
.loadmore-wrap {
    width: 95%;
    max-width: 1300px;
    margin: 0 auto;
    padding-bottom: 20px;
    text-align: center;
}

/* Prompt detail modal (homepage, opened from a card preview) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 400;
    padding: 24px;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    background-clip: padding-box;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    /* The outer box itself never scrolls: only the text inside does.
       Previously the scrollbar ran flush to the outer edge and squared
       off the top-right and bottom-right corners. */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 32px;
    position: relative;
}
.modal h3 {
    margin: 0 0 16px;
    color: var(--text-color);
    padding-right: 40px;
}
.modal-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 16px;
    margin: 0 0 16px;
}
.modal-text {
    white-space: pre-wrap;
    color: var(--text-dim);
    line-height: 1.7;
    margin: 0 0 24px;
    overflow-y: auto;
    min-height: 0;
    padding-right: 6px;
}
.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
}

.favorite-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-glow);
}

.favorite-btn.active {
    color: #ff5252;
    border-color: #ff5252;
    box-shadow: 0 0 10px rgba(255, 82, 82, 0.5);
}

/* Card footer: Copy Prompt button with the favourite heart next to it */
.card-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-footer .copy-btn {
    flex: 1;
    width: auto;
}

.card-footer .favorite-btn {
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 12px;
}

#filter-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-dim);
    padding: 20px 0;
    margin: 0;
}

.copy-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 10px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.copy-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: #fff;
}

/* Footer — its own section below the content, not inside a box */
.footer {
    width: 95%;
    max-width: 1300px;
    margin: 40px auto 0;
    padding: 20px 0;
    background: transparent;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-dim);
    flex-wrap: wrap;
    gap: 10px;
}

.footer-links a {
    color: var(--text-dim);
    text-decoration: none;
    margin-right: 15px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--text-color);
}

.copyright {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Admin Form CSS */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.form-group input, 
.form-group textarea, 
.form-group select {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px;
    color: var(--text-color);
    font-size: 0.95rem;
}

.form-group input:focus, 
.form-group textarea:focus, 
.form-group select:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Responsive Media Queries */
@media (max-width: 768px) {
    body {
        padding: 0 0 20px;
    }
    .navbar {
        width: calc(100% - 24px);
        padding: 12px 16px;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
    }
    .logo-section {
        flex: 1 1 auto;
    }
    .utilities {
        justify-content: flex-end;
    }
    .search-box {
        flex: 1;
    }
    .search-box input {
        width: 100%;
    }
    .filter-toolbar .search-box {
        flex: 1 1 100%;
    }
    .filter-toolbar .categories-bar {
        justify-content: center;
    }
    .nav-links {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    .hero {
        padding: 40px 0 24px;
    }
    .page {
        padding: 32px 0 8px;
    }
    .content {
        padding: 15px 0;
        grid-template-columns: 1fr;
    }
    .footer {
        flex-direction: column;
        text-align: center;
    }
}
