/*
  Shared stylesheet for all pages.
  Previously this whole block was duplicated inline in every HTML file;
  keeping it here means the backend templates only need one <link> tag.
*/

body {
    font-family: Arial, sans-serif;
    max-width: 1050px;
    margin: 40px auto;
    padding: 0 16px;
    background: #111;
    color: #eee;
}

nav {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

a {
    color: #8ab4ff;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

input, textarea, select, button {
    padding: 10px;
    margin: 6px 0;
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    border: 1px solid #444;
    background: #222;
    color: #eee;
}

textarea {
    min-height: 120px;
}

button {
    cursor: pointer;
    background: #2d5cff;
    border: none;
    font-weight: bold;
}

button.danger {
    background: #9b2226;
}

button.secondary {
    background: #3a3a3a;
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.card {
    border: 1px solid #333;
    padding: 18px;
    border-radius: 16px;
    margin: 12px 0;
    background: #1b1b1b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    overflow: hidden;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 16px;
    align-items: start;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

th, td {
    border-bottom: 1px solid #333;
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

.muted {
    color: #aaa;
    font-size: 14px;
}

.pill {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 999px;
    background: #2a2a2a;
    color: #ddd;
    font-size: 13px;
}

.visible {
    background: #173d24;
}

.hidden {
    background: #49341b;
}

.row-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.row-actions form {
    margin: 0;
}

.row-actions button {
    width: auto;
    padding: 8px 12px;
}

label {
    display: block;
    margin: 6px 0;
}

label input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.description {
    white-space: normal;
    line-height: 1.45;
}

.seller-avatar {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #333;
    background: #222;
}

.location-card-image {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #333;
    background: #222;
    margin-bottom: 12px;
}

.admin-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #333;
    background: #222;
    margin-right: 6px;
    vertical-align: middle;
}

.card h2,
.card h3 {
    overflow-wrap: anywhere;
}

.public-listing-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
}

.public-listing-image {
    display: block;
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #333;
    background: #222;
}

.public-listing-body {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.public-listing-body h3 {
    margin-top: 8px;
    margin-bottom: 8px;
    line-height: 1.25;
}

.public-listing-body p {
    line-height: 1.45;
}

.listing-preview {
    display: block;
}

.listing-thumb {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 14px;
    border: 1px solid #333;
    background: #222;
}

.listing-preview-body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.product-hero-wrap {
    width: 100%;
    margin: 12px 0 18px 0;
    border-radius: 18px;
    overflow: hidden;
    background: #181818;
    border: 1px solid #333;
}

.product-hero {
    display: block;
    width: 100%;
    height: 360px;
    object-fit: contain;
    background: #181818;
}

.top-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0 20px 0;
}

.top-links a {
    background: #222;
    border: 1px solid #333;
    padding: 8px 12px;
    border-radius: 999px;
}

.top-links a.active {
    background: #2d5cff;
    color: #fff;
    border-color: #2d5cff;
}

.buy-button {
    width: auto;
    display: inline-block;
    padding: 12px 28px;
    font-size: 16px;
    background: #1f9d55;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-weight: bold;
}

.buy-button:hover {
    text-decoration: none;
}

/* Checkout page: two payment methods, deliberately styled apart */

.payment-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
    max-width: 640px;
}

.payment-option {
    border: 1px solid #333;
    border-top: 4px solid transparent;
    border-radius: 16px;
    padding: 20px;
    background: #1b1b1b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.payment-option-wallet {
    border-top-color: #2d5cff;
}

.payment-option-transfer {
    border-top-color: #1f9d55;
}

.payment-option-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.payment-option-icon {
    font-size: 28px;
    line-height: 1;
}

.payment-option-header h3 {
    margin: 0 0 4px 0;
}

.payment-option-header p {
    margin: 0;
}

.payment-option-wallet .buy-button {
    background: #2d5cff;
}

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

.crypto-tab {
    width: auto;
    padding: 8px 14px;
    background: #222;
    font-weight: normal;
}

.crypto-tab.active {
    background: #1f9d55;
    font-weight: bold;
}

/* Each currency's full payment form is server-rendered and works standalone
   (no JS required). assets/checkout.js just hides all but one when it's
   available — progressive enhancement, not a requirement to pay. */
.crypto-panel + .crypto-panel {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #333;
}

.crypto-panel.js-hidden {
    display: none;
}

.qr-box {
    width: 180px;
    margin: 0 auto 16px auto;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #333;
    overflow: hidden;
    display: block;
}

.transfer-detail {
    margin: 0 0 16px 0;
}

.transfer-detail-label {
    display: block;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 6px;
}

.transfer-detail-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.transfer-detail-value {
    flex: 1;
    display: block;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 10px;
    font-family: "Courier New", monospace;
    font-size: 14px;
    overflow-wrap: anywhere;
    color: #eee;
}

.transfer-detail-row .copy-button {
    width: auto;
    padding: 10px 14px;
}

.transfer-detail-amount {
    padding: 14px;
    background: #12281c;
    border: 1px solid #1f9d55;
    border-radius: 12px;
}

.transfer-amount-value {
    font-size: 20px;
    font-weight: bold;
    color: #6fe3a0;
    border-color: #1f9d55;
    background: #0e1f16;
}

.transfer-amount-unit {
    width: auto;
    background: #1f9d55;
    color: #fff;
    font-weight: bold;
}

.transfer-detail-amount > p.muted {
    margin: 8px 0 0 0;
}

.tx-hash-form {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid #333;
}

.tx-hash-form button[type="submit"] {
    width: auto;
    padding: 10px 18px;
}

.status-message {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #173d24;
    color: #bdf0d0;
}

/* Product page: pack/variant selector, price summary, buy button */

.pack-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0 16px 0;
}

/* .pack-option is a <label> bound to a hidden radio (see .pack-radio below), so
   the purchase flow works with zero JS — it doesn't inherit the base `button`
   rule's border/color, so those are repeated here explicitly. */
.pack-option {
    width: auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    background: #222;
    font-weight: normal;
    border: 1px solid #444;
    border-radius: 8px;
    color: #eee;
    cursor: pointer;
}

.pack-option-price {
    font-size: 13px;
    color: #aaa;
}

.pack-radio {
    display: none;
}

.pack-radio:checked + .pack-option,
.pack-option.active {
    background: #2d5cff;
    font-weight: bold;
}

.pack-radio:checked + .pack-option .pack-option-price,
.pack-option.active .pack-option-price {
    color: #dce6ff;
}

.price-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
    margin: 16px 0;
}

.price-summary .total-price {
    font-size: 24px;
    font-weight: bold;
}

.crypto-estimate {
    font-size: 13px;
}

.buy-button-large {
    display: block;
    width: 100%;
    max-width: 320px;
    padding: 16px 28px;
    font-size: 18px;
    text-align: center;
    border-radius: 999px;
    box-shadow: 0 8px 20px rgba(31, 157, 85, 0.35);
}

.amount-due {
    font-size: 18px;
}

.amount-due strong {
    color: #fff;
}

@media (max-width: 700px) {
    body {
        margin-top: 20px;
    }

    .listing-preview {
        gap: 12px;
    }

    .listing-thumb {
        width: 100%;
        height: 180px;
    }

    .public-listing-image {
        height: 220px;
    }

    .location-card-image {
        height: 130px;
    }

    .product-hero {
        height: 260px;
    }

    .qr-box {
        width: 140px;
    }

    .payment-option {
        padding: 16px;
    }

    table, thead, tbody, th, td, tr {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        border: 1px solid #333;
        border-radius: 12px;
        padding: 10px;
        margin: 12px 0;
        background: #1b1b1b;
    }

    td {
        border-bottom: none;
        padding: 8px 0;
    }
}
