/* Marketplace (bb) stylesheet.
 *
 * This is a thin re-skin layer: it imports the shared design tokens and
 * reusable components (colors, gradients, glass-panel look, .btn,
 * .badge, .auth-form, fonts, background animation, ...) from the main
 * Romp theme and maps the marketplace's existing bb-* class names onto
 * that same visual language. Class names are kept stable so none of the
 * marketplace templates need to change - only the look does.
 */
@import url("../css/style.css");

* { box-sizing: border-box; }

/* ── Reusable utility classes (#90) ──────────────────────────────────────
 * Replace repeated inline magic values with named utilities.
 * Templates should use these instead of style="..." attributes.
 * ─────────────────────────────────────────────────────────────────────── */

/* Glass sub-panel (rgba(255,255,255,0.04) background, glass border, 8px radius) */
.bb-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 14px;
    margin-top: 12px;
}

/* Moderator section accent (purple left border) */
.bb-panel-mod {
    border-left: 3px solid #6f42c1;
    margin-bottom: 12px;
    padding: 10px 14px;
}

/* Digital-goods section accent (indigo left border) */
.bb-panel-dg {
    border-left: 3px solid #6366f1;
}

/* Offer/deal action section accent (green left border) */
.bb-panel-action {
    border-left: 3px solid #4ade80;
}

/* Typography utilities */
.bb-text-sm  { font-size: 0.9rem; }
.bb-text-xs  { font-size: 0.8rem; }
.bb-text-secondary { color: var(--text-secondary, #ccc); }

/* Semantic colour utilities */
.bb-text-success { color: #4ade80; }   /* green — released, accepted, free */
.bb-text-warn    { color: #f59e0b; }   /* amber — queued, pending */
.bb-text-mod     { color: #6f42c1; }   /* purple — moderator actions */
.bb-text-dg      { color: #6366f1; }   /* indigo — digital goods */
.bb-text-danger  { color: #e53e3e; }   /* red — required, destructive */

/* List-reset: removes bullet/padding from <ul>/<ol> */
.bb-list-clean {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* ---- Header / navigation -------------------------------------------- */

.bb-header {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 100;
    transition: transform 0.3s ease;
}

.bb-nav {
    position: relative;  /* positioning context for mobile dropdown (#88) */
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 22px;
    padding: 20px 50px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Specificity note: ".bb-nav a.bb-brand" (0,2,1) intentionally beats the
   generic ".bb-nav a" rule below (0,1,1), which would otherwise win and
   reset background/font-size/font-family back to the plain link styles -
   making this gradient-clipped logo text render invisible. */
.bb-nav a.bb-brand {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    margin-right: auto;
}

.bb-nav a,
.bb-link-button {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    cursor: pointer;
    transition: color 0.3s ease;
}

.bb-nav a::after,
.bb-link-button::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -6px;
    left: 0;
    background: var(--gradient);
    transition: width 0.3s ease;
}

.bb-nav a:hover,
.bb-link-button:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

.bb-nav a:hover::after,
.bb-link-button:hover::after {
    width: 100%;
}

.bb-inline-form {
    display: inline;
}

/* ---- Layout ------------------------------------------------------------ */

.bb-main {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    padding: 50px 24px;
    width: 100%;
    animation: fadeIn 1s ease-out;
}

.bb-footer {
    text-align: center;
    padding: 30px;
    border-top: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--muted-color);
    font-size: 0.9rem;
}

/* ---- Flash messages ------------------------------------------------- */

.bb-messages {
    list-style: none;
    padding: 0;
    margin: 0 0 24px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bb-message {
    padding: 14px 20px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
}

.bb-message.success { border-color: rgba(74, 222, 128, 0.4); color: var(--success-color); }
.bb-message.error   { border-color: rgba(248, 113, 113, 0.4); color: var(--danger-color); }

/* ADR 0038: test-currency mode banner — non-dismissable, always visible */
.bb-test-mode-banner {
    width: 100%;
    background: #7c3aed;
    color: #fff;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    letter-spacing: 0.01em;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.bb-badge {
    display: inline-block;
    background: var(--danger-gradient);
    color: #fff;
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 0.7rem;
    line-height: 1.4;
    margin-left: 2px;
}

/* ---- Cards --------------------------------------------------------- */

.bb-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 28px;
    box-shadow: var(--glass-shadow);
    margin-bottom: 24px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.bb-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

.bb-card h2,
.bb-card h3,
.bb-card h4 {
    font-family: 'Poppins', sans-serif;
    margin-top: 0;
}

.bb-card h2 a,
.bb-card h3 a,
.bb-card h4 a {
    color: inherit;
    text-decoration: none;
}

.bb-card h2 a:hover,
.bb-card h3 a:hover,
.bb-card h4 a:hover {
    color: var(--accent-hover);
}

/* Nested cards (e.g. offers / comments inside an announcement card) get a
   flatter look so the glass effect doesn't stack up. */
.bb-card .bb-card {
    background: rgba(255, 255, 255, 0.03);
    box-shadow: none;
    padding: 18px;
    margin-bottom: 14px;
}

.bb-card .bb-card:hover {
    transform: none;
    box-shadow: none;
}

.bb-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bb-meta {
    color: var(--muted-color);
    font-size: 0.875rem;
}

.bb-meta a {
    color: var(--accent-hover);
    text-decoration: none;
}

.bb-meta a:hover {
    text-decoration: underline;
}

/* ---- Status badges ---------------------------------------------------- */

.bb-status {
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted-color);
}

.bb-status-published,
.bb-status-accepted,
.bb-status-completed {
    color: var(--success-color);
    border-color: rgba(74, 222, 128, 0.4);
    background: rgba(74, 222, 128, 0.1);
}

.bb-status-draft,
.bb-status-pending {
    color: var(--warning-color);
    border-color: rgba(251, 191, 36, 0.4);
    background: rgba(251, 191, 36, 0.1);
}

.bb-status-sold,
.bb-status-in_progress {
    color: var(--info-color);
    border-color: rgba(96, 165, 250, 0.4);
    background: rgba(96, 165, 250, 0.1);
}

.bb-status-obsolete {
    color: var(--muted-color);
}

.bb-status-rejected,
.bb-status-canceled,
.bb-status-disputed,
.bb-status-flagged {
    color: var(--danger-color);
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.1);
}

/* ---- Forms ------------------------------------------------------------- */

.bb-form p {
    margin: 0 0 16px 0;
}

.bb-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #cbd5e1;
}

.bb-form input,
.bb-form textarea,
.bb-form select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-color);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.bb-form input:focus,
.bb-form textarea:focus,
.bb-form select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.bb-form select option {
    background: var(--bg-color);
    color: var(--text-color);
}

.bb-form ul.errorlist {
    color: var(--danger-color);
    font-size: 0.85rem;
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
}

.bb-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 16px;
}

/* ---- Buttons ------------------------------------------------------------ */

.bb-btn {
    display: inline-block;
    padding: 10px 24px;
    border-radius: 30px;
    background: var(--gradient);
    color: #fff;
    border: none;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bb-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.bb-btn:active {
    transform: translateY(1px);
}

.bb-btn-secondary {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--glass-border);
    box-shadow: none;
}

.bb-btn-secondary:hover {
    border-color: var(--accent-hover);
    color: var(--accent-hover);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.bb-btn-danger {
    background: var(--danger-gradient);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
}

.bb-btn-danger:hover {
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.55);
}

/* Subtle/destructive: used for "Delete" actions on your own content
   (announcements, comments). A full-size gradient .bb-btn-danger pill drew
   far more attention than deleting your own post/comment warrants - this
   variant stays muted and unobtrusive until hovered/focused, when it hints
   red to signal "careful". Pair with data-confirm (see
   static/js/confirm-dialog.js) so the action still needs a yes/no before
   anything happens. */
.bb-btn-subtle {
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    background: transparent;
    color: var(--muted-color);
    border: 1px solid var(--glass-border);
    box-shadow: none;
}

.bb-btn-subtle:hover,
.bb-btn-subtle:focus-visible {
    color: var(--danger-color);
    border-color: rgba(248, 113, 113, 0.4);
    background: rgba(248, 113, 113, 0.08);
    box-shadow: none;
    transform: none;
}

/* Moderator action button — purple (#6f42c1), matches mod panel accent (#90) */
.bb-btn-mod {
    background: #6f42c1;
    color: #fff;
    box-shadow: 0 4px 15px rgba(111, 66, 193, 0.35);
}

.bb-btn-mod:hover {
    box-shadow: 0 6px 20px rgba(111, 66, 193, 0.55);
}

/* ---- Comments ------------------------------------------------------- */

.bb-comment {
    border-left: 2px solid var(--glass-border);
    padding-left: 16px;
    margin-bottom: 16px;
}

.bb-replies {
    margin-left: 24px;
    margin-top: 12px;
}

.bb-comment details summary {
    cursor: pointer;
    color: var(--muted-color);
}

.bb-comment details[open] summary {
    margin-bottom: 10px;
}

.bb-comment .bb-form {
    margin-top: 10px;
}

/* ---- Pagination ------------------------------------------------------- */

.bb-pagination {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
}

/* ---- Misc --------------------------------------------------------------- */

.bb-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
}

.bb-grid {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* ── Announcement attachments ─────────────────────────────────────────────── */
.bb-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 16px 0;
}

.bb-attachment-image {
    margin: 0;
    max-width: 280px;
    flex: 0 0 auto;
}

.bb-attachment-image img {
    display: block;
    max-width: 280px;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
}

.bb-attachment-image figcaption {
    margin-top: 4px;
    font-size: 0.8rem;
    word-break: break-all;
}

.bb-attachment-file {
    align-self: center;
    width: 100%;
    padding: 6px 0;
}

.bb-attachment-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid var(--glass-border);
}

/* Thumbnail shown in the announcement list card (floats to the right) */
.bb-list-thumb-link {
    float: right;
    margin: 0 0 8px 12px;
    line-height: 0;
}

.bb-list-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--glass-border);
    transition: opacity 0.15s;
}

.bb-list-thumb:hover {
    opacity: 0.85;
}

.bb-attachments-existing {
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.bb-attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    flex-wrap: wrap;
}

.bb-remove-label {
    color: var(--danger, #e05);
    font-size: 0.85rem;
    cursor: pointer;
    margin-left: auto;
}

.bb-form-group {
    margin-bottom: 14px;
}

.bb-grid > * {
    flex: 1;
    min-width: 240px;
}

/* ------------------------------------------------------------------ */
/* ── Breadcrumb navigation (#87) ─────────────────────────────────────── */

.bb-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: var(--muted-color);
}

.bb-breadcrumb a {
    color: var(--muted-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.bb-breadcrumb a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.bb-breadcrumb-sep {
    color: var(--muted-color);
    opacity: 0.5;
}

.bb-breadcrumb-current {
    color: var(--text-color);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* ── CSS-only hamburger nav toggle (#88) ─────────────────────────────── */

/* Hide the actual checkbox — position off-screen not display:none so it
   still participates in the :checked state machine */
.bb-nav-toggle-check {
    position: absolute;
    left: -9999px;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Hamburger ☰ label — hidden on desktop, shown on narrow screens */
.bb-nav-hamburger {
    display: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.2s ease;
    margin-left: auto;
    order: 2;
}

.bb-nav-hamburger:hover {
    color: var(--accent-hover);
}

/* On desktop the links are just a flex row as before */
.bb-nav-links {
    display: contents; /* invisible wrapper — children participate in parent flex */
}

/* Responsive layout (tablets and phones)                              */
/*                                                                      */
/* .bb-nav has many items and wraps onto several lines on narrow       */
/* screens. Combined with .bb-header's `position: sticky`, that tall   */
/* wrapped nav stays pinned and permanently covers most of the page.   */
/* Drop the stickiness and shrink the header on small viewports so it  */
/* scrolls away normally, matching the main site's responsive header. */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .bb-nav {
        padding: 14px 20px;
        gap: 12px;
        flex-wrap: nowrap;   /* brand + hamburger on one line */
        align-items: center;
        justify-content: space-between;
    }

    .bb-nav a.bb-brand {
        flex: 1 1 auto;
        text-align: left;
        margin-right: 0;
        font-size: 1.25rem;
    }

    /* Show the hamburger button on mobile */
    .bb-nav-hamburger {
        display: block;
    }

    /* Collapse all nav links into a dropdown, hidden by default */
    .bb-nav-links {
        display: none;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--glass-bg);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid var(--glass-border);
        border-bottom: 1px solid var(--glass-border);
        padding: 8px 20px 16px;
        z-index: 99;
    }

    .bb-nav-links a,
    .bb-nav-links .bb-inline-form,
    .bb-nav-links .bb-link-button {
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid var(--glass-border);
        width: 100%;
    }

    .bb-nav-links a:last-child,
    .bb-nav-links .bb-inline-form:last-child {
        border-bottom: none;
    }

    /* Checkbox checked → show the dropdown */
    .bb-nav-toggle-check:checked ~ .bb-nav-links {
        display: flex;
    }

    .bb-main {
        padding: 30px 16px;
    }

    .bb-card {
        padding: 18px;
    }

    .bb-card .bb-card {
        padding: 14px;
    }
}

/* ── Search form collapsible filters & toggle switches (Web Designer update) ── */

.search-main-row input,
.search-main-row select {
    border-radius: 20px !important;
}

/* Custom Toggle Switch (Slider) */
.toggle-switch-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--muted-color);
    user-select: none;
    transition: color 0.2s ease;
}

.toggle-label.active {
    color: var(--text-color) !important;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    transition: .3s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--gradient);
    transition: .3s;
}

input:checked + .slider {
    background-color: rgba(59, 130, 246, 0.15);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Collapsible Panel styling */
.collapsible-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.collapsible-panel.unfolded {
    opacity: 1;
}

/* Cookie Consent Banner */
.cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 1000;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: var(--glass-shadow);
    animation: slideUp 0.5s ease-out;
}

.cookie-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.cookie-text {
    font-size: 0.9rem;
    color: #cbd5e1;
    line-height: 1.4;
}

@keyframes slideUp {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .cookie-banner {
        bottom: 12px;
        left: 12px;
        right: 12px;
        padding: 12px 16px;
    }
    .cookie-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    #accept-necessary-btn {
        width: 100%;
        text-align: center;
    }
}

