body {
    background-color: #262C30;
    color: white;
}

/* Bootstrap's reboot.css sets pre/code to a dark charcoal (#212529) meant
   for a white page - on this dark theme that made fenced code blocks in
   published articles (views/blog/show.ejs's raw sanitizedHtml) and the
   article editor's live preview (.article-preview-panel) render as
   near-invisible dark-gray-on-dark-gray text. This overrides both with a
   proper dark code-block treatment instead of just fixing the color. */
pre {
    background-color: #1c1f24;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 12px 16px;
    color: #fff;
    overflow-x: auto;
}

code {
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    padding: 2px 5px;
    color: #4ade80;
}

/* Code inside a pre block already gets the block-level dark background
   above - without this it'd also get the inline treatment nested inside,
   double-boxing it and tinting the text green instead of white. */
pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.card-subtitle {
    color: rgba(255, 255, 255, 0.596);
    padding-top: 5px;
}

/* ============================================================
   Info cards (main site homepage: Blog/Store/Account tiles)
   ============================================================ */

.info-card {
    background-color: #2b2f36;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.info-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    transform: translateY(-2px);
}

.info-card h3 {
    color: #fff;
    margin-bottom: 10px;
}

.info-card p {
    color: rgba(255, 255, 255, 0.75);
    flex: 1;
}

.info-card .btn-primary {
    margin-top: auto;
    width: 100%;
}

/* ============================================================
   Comments (shared by article pages and product pages)
   ============================================================ */

.comment-item {
    background-color: #2b2f36;
    border-radius: 8px;
    padding: 12px 14px;
}

.comment-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
}

.comment-date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-left: 10px;
}

.comment-body {
    color: rgba(255, 255, 255, 0.9);
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-delete-btn {
    background: none;
    border: none;
    padding: 0;
    color: #ff6b6b;
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
}

/* ============================================================
   Store product cards (index grid)
   ============================================================ */

.product-card {
    background-color: #2b2f36;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.product-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    transform: translateY(-2px);
}

.product-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card-body h5 a {
    color: #fff;
}

.product-card-body p {
    color: rgba(255, 255, 255, 0.75);
    flex: 1;
}

/* ============================================================
   LQIP (low-quality image placeholder) blur-up loading.

   A tiny (20x20px) blurred preview of the real image - generated
   server-side at upload time (see utils/imagePlaceholder.js) and stored
   directly on the Article/Product/Advertisement document as a data URI -
   shows immediately, stretched to fill the box, while the real full-size
   <img> is still downloading. The real image sits on top starting at
   opacity 0 and fades in once loaded (see public/scripts/image-skeleton.js),
   which naturally covers the placeholder beneath it - no separate fade-out
   needed for the placeholder itself.

   Usage: a position:relative "lqip-wrapper" containing, in this order, an
   <img class="lqip-placeholder"> (only rendered when a placeholder exists)
   and the real <img class="lqip-image">. Falls back gracefully to nothing
   extra when there's no placeholder (an image set by URL rather than
   upload, or an older item saved before this existed) - the real image
   just fades in over the wrapper's plain background instead.
   ============================================================ */
.lqip-wrapper {
    position: relative;
    overflow: hidden;
    background-color: #1c1f23;
}

.lqip-placeholder {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(16px);
    transform: scale(1.15);
}

.lqip-image {
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lqip-image.is-loaded {
    opacity: 1;
}

/* ============================================================
   Article login-gate (anonymous preview) - views/blog/show.ejs
   Shown only when an anonymous visitor's article was cut short by
   utils/truncateHtml.js; logged-in visitors always get the full article
   and never see this.
   ============================================================ */
.article-login-prompt {
    background-color: #2b2f36;
    color: #fff;
    border-radius: 10px;
    padding: 30px 20px;
    margin: 10px 0 40px;
    text-align: center;
}

.article-login-prompt h4 {
    margin-bottom: 8px;
}

.article-login-prompt p {
    color: #c7ccd1;
    margin-bottom: 16px;
}

/* ============================================================
   Admin dashboard
   ============================================================ */

.admin-stat-card {
    background-color: #2b2f36;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 20px;
    text-align: center;
}

.admin-stat-card .admin-stat-number {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
}

.admin-stat-card .admin-stat-label {
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 24px;
}

.admin-nav a {
    color: rgba(255, 255, 255, 0.85);
    background-color: #2b2f36;
    border-radius: 6px;
    padding: 8px 14px;
    text-decoration: none;
}

.admin-nav a:hover,
.admin-nav a.active {
    background-color: #3a4048;
    color: #fff;
    text-decoration: none;
}

.admin-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* ============================================================
   Account hub (My Account page)
   ============================================================ */

.account-hero-card {
    background-color: #2b2f36;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.account-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: #3a4048;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    font-weight: bold;
    overflow: hidden;
    flex-shrink: 0;
}

.account-avatar-lg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-hero-card h2 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 2px;
}

.account-email {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.account-view-profile-link {
    color: #4ade80;
    text-decoration: none;
    font-weight: 500;
    margin-left: auto;
    white-space: nowrap;
}

.account-view-profile-link:hover {
    color: #6ee7a0;
    text-decoration: none;
}

.account-tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 576px) {
    .account-tile-grid {
        grid-template-columns: 1fr;
    }
}

.account-tile {
    background-color: #2b2f36;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    text-decoration: none;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.account-tile:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.55);
    transform: translateY(-2px);
    text-decoration: none;
}

.account-tile-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background-color: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.account-tile-icon svg {
    width: 18px;
    height: 18px;
}

.account-tile-body {
    min-width: 0;
}

.account-tile-title {
    display: block;
    color: #4ade80;
    font-weight: 600;
    margin-bottom: 4px;
}

.account-tile-desc {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.account-logout-btn {
    width: 100%;
    background-color: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #ff6b6b;
    border-radius: 10px;
    padding: 14px 20px;
    text-align: left;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s ease;
}

.account-logout-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.account-logout-btn:hover {
    background-color: rgba(220, 53, 69, 0.15);
}

/* ============================================================
   Account settings page (collapsible row list)
   ============================================================ */

.settings-breadcrumb {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-bottom: 20px;
}

.settings-breadcrumb a {
    color: #4ade80;
    text-decoration: none;
}

.settings-breadcrumb a:hover {
    text-decoration: underline;
}

.settings-alert-success {
    background-color: rgba(74, 222, 128, 0.12);
    border: 1px solid rgba(74, 222, 128, 0.4);
    color: #4ade80;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
}

.settings-list {
    border: 1px solid #3a4048;
    border-radius: 10px;
    overflow: hidden;
    background-color: #2b2f36;
}

.settings-row {
    border-bottom: 1px solid #3a4048;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
}

.settings-row.is-expandable > .settings-row-header {
    cursor: pointer;
    list-style: none;
}

.settings-row.is-expandable > .settings-row-header::-webkit-details-marker {
    display: none;
}

.settings-row-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #3a4048;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.settings-row-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.settings-row-icon svg {
    width: 18px;
    height: 18px;
}

.settings-row.is-danger .settings-row-icon {
    color: #ff6b6b;
}

.settings-row-text {
    flex: 1;
    min-width: 0;
}

.settings-row-label {
    display: block;
    color: #4ade80;
    font-size: 12px;
}

.settings-row.is-danger .settings-row-label {
    color: #ff6b6b;
}

.settings-row-value {
    display: block;
    color: #fff;
    font-weight: 600;
}

.settings-row-chevron {
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.settings-row-chevron svg {
    width: 18px;
    height: 18px;
    display: block;
}

.settings-row[open] .settings-row-chevron {
    transform: rotate(180deg);
}

.settings-row-body {
    padding: 0 20px 20px 70px;
}

@media (max-width: 480px) {
    .settings-row-body {
        padding: 0 16px 16px 16px;
    }
}

.settings-row-body .form-group:last-child {
    margin-bottom: 0;
}

.settings-row-error {
    background-color: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.4);
    color: #ff8787;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    margin-bottom: 12px;
}

/* ============================================================
   404 page
   ============================================================ */

.not-found-container {
    max-width: 640px;
    padding-top: 32px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.not-found-mark {
    position: relative;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.not-found-mark svg {
    width: 68px;
    height: 68px;
    position: relative;
    z-index: 1;
}

.not-found-glow-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(74, 222, 128, 0.25);
    background: radial-gradient(circle at 50% 45%, rgba(74, 222, 128, 0.16) 0%, rgba(74, 222, 128, 0) 70%);
}

.not-found-glow-ring.r2 {
    inset: 12px;
    border-color: rgba(74, 222, 128, 0.15);
    background: none;
}

.not-found-code {
    font-size: 52px;
    font-weight: 800;
    color: #4ade80;
    line-height: 1;
    letter-spacing: -2px;
    margin-bottom: 4px;
}

.not-found-title {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.not-found-desc {
    color: rgba(255, 255, 255, 0.65);
    font-size: 14px;
    line-height: 1.5;
    max-width: 420px;
    margin-bottom: 20px;
}

.not-found-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Read-only star display (store grid + product page average). */
.star-rating {
    display: inline-flex;
    align-items: center;
}

.star-rating-symbol {
    color: rgba(255, 255, 255, 0.25);
    font-size: 16px;
    line-height: 1;
}

.star-rating-symbol.is-filled {
    color: #ffc107;
}

.star-rating-meta {
    margin-left: 6px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
}

/*
  Pure-CSS interactive star picker used on the "leave a review" form. The
  radios are rendered 5 down to 1 in the markup, then flipped back to
  left-to-right visual order with row-reverse - that's what lets a plain CSS
  sibling selector (~ , which only looks forward in DOM order) highlight
  "this star and every star before it" on hover or once one is checked.
*/
.star-input {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}

.star-input input {
    display: none;
}

.star-input label {
    cursor: pointer;
    font-size: 26px;
    color: rgba(255, 255, 255, 0.25);
    padding: 0 2px;
    margin: 0;
}

.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label {
    color: #ffc107;
}

/* ============================================================
   Dark form cards - shared by the article editor
   (views/blog/_form_fields.ejs, .article-form-card), the admin
   product form (views/admin/product-form.ejs, .admin-form-card), and
   the ad submission form (views/account/ad-form.ejs, .ad-form-card).
   Same look, different class names so each stays easy to find from
   its own view.
   ============================================================ */

.article-form-card,
.admin-form-card,
.ad-form-card {
    background-color: #2b2f36;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.article-form-card label,
.admin-form-card label,
.ad-form-card label {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
}

.article-form-card .form-control,
.admin-form-card .form-control,
.ad-form-card .form-control {
    background-color: #1c1f24;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #fff;
}

.article-form-card .form-control::placeholder,
.admin-form-card .form-control::placeholder,
.ad-form-card .form-control::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.article-form-card .form-control:focus,
.admin-form-card .form-control:focus,
.ad-form-card .form-control:focus {
    background-color: #1c1f24;
    border-color: #4ade80;
    color: #fff;
    box-shadow: 0 0 0 0.2rem rgba(74, 222, 128, 0.25);
}

/* Draft / "Put This Blog Live" publish-status control
   (views/blog/_form_fields.ejs) - two selectable rows rather than plain
   radio buttons, so the current status is obvious at a glance. The
   .selected class is applied server-side on first render (matching the
   article's current status) and kept in sync client-side as the admin
   clicks between the two. */
.article-status-option {
    display: block;
    background-color: #1c1f24;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.article-status-option:last-child {
    margin-bottom: 0;
}

.article-status-option input[type="radio"] {
    margin-right: 8px;
}

.article-status-option .status-title {
    color: #fff;
    font-weight: 700;
}

.article-status-option .status-hint {
    display: block;
    margin-left: 22px;
    color: rgba(255, 255, 255, 0.55);
    font-size: 13px;
}

.article-status-option.status-draft.selected {
    border-color: #f5a623;
    background-color: rgba(245, 166, 35, 0.08);
}

.article-status-option.status-live.selected {
    border-color: #4ade80;
    background-color: rgba(74, 222, 128, 0.08);
}

/* ============================================================
   Ad submission form extras (views/account/ad-form.ejs) - the live
   image preview box, and the numbered step badges + "Good to know"
   list on the public Advertise landing page (views/account/advertise.ejs).
   ============================================================ */

.ad-image-preview {
    background-color: #1c1f24;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
}

.ad-image-preview img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 6px;
}

.ad-step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(74, 222, 128, 0.15);
    color: #4ade80;
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.ad-good-to-know-list {
    padding-left: 1.2rem;
}

.ad-good-to-know-list li {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 8px;
}

.ad-good-to-know-list li:last-child {
    margin-bottom: 0;
}

/* ============================================================
   Ad preview tabs - shared by the live preview on
   views/account/ad-form.ejs and the static example on
   views/account/advertise.ejs. Lets someone see roughly how their ad
   will look in each of the three real placements
   (views/partials/AdSlot.ejs's 'info'/'article'/'product' variants)
   without needing jQuery/Bootstrap's JS (neither is loaded on these
   pages) - just a plain class-toggle tab switcher.
   ============================================================ */

.ad-preview-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ad-preview-tab {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.ad-preview-tab:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.ad-preview-tab.active {
    background-color: #4ade80;
    border-color: #4ade80;
    color: #1c1f24;
    font-weight: 600;
}

.ad-preview-stage {
    background-color: #1c1f24;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 24px;
    display: flex;
    justify-content: center;
}

.ad-preview-panel {
    display: none;
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
}

.ad-preview-panel.active {
    display: block;
}

/* Sits over an .article-image-wrapper or .lqip-wrapper (both already
   position: relative) when no image has been chosen yet. */
.ad-preview-no-image {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.85em;
    text-align: center;
    padding: 8px;
}

/* Ad title/description overflow guard - the model already caps these
   server-side (models/Advertisement.js: title 100 chars, body 300
   chars), but a full-length submission (or one long unbroken word, like
   a URL) could still overflow a narrow card without this. Wraps text
   normally and clamps it to a fixed number of lines with an ellipsis
   rather than growing the card or spilling past its edges. Used across
   all three AdSlot.ejs variants (home/blog/store) and their previews on
   the Submit an Ad / Advertise pages. Not applied to .article-title,
   which already has its own line-clamp for the ad's blog-grid placement. */
.ad-title {
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ad-description {
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* The file-versions table (admin product form) would otherwise render as
   Bootstrap's default white-background table sitting inside a dark card. */
.admin-form-card .table {
    color: #fff;
}

.admin-form-card .table th,
.admin-form-card .table td {
    border-color: rgba(255, 255, 255, 0.12);
    vertical-align: middle;
}

.markdown-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.markdown-toolbar .btn {
    font-family: 'Courier New', monospace;
}

.article-editor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.article-editor-col {
    flex: 1 1 320px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
}

/* Deliberately matches the actual published article page's body styling
   (a plain white-on-dark #262C30 block, see views/blog/show.ejs) rather
   than a generic "document preview" look - so what's shown here while
   writing is what the article will really look like once published. */
.article-preview-panel {
    background-color: #262C30;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 14px 16px;
    color: #fff;
    overflow-y: auto;
    flex: 1;
    min-height: 340px;
}

.article-preview-panel img {
    max-width: 100%;
}

.article-word-count {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    margin-top: 6px;
}
