/*
 * Shop - Main Stylesheet
 *
 * Simple, clean styling for the storefront. Provides a minimal reset,
 * a centered container layout, navigation header, product card grid,
 * forms, buttons, and flash message boxes. Mobile-friendly via a single
 * responsive breakpoint at 640px.
 */

/* ---------- Reset / Normalize ---------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #1f2933;
    background-color: #f5f7fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover,
a:focus {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    margin: 0 0 0.5em;
    line-height: 1.25;
}

p {
    margin: 0 0 1em;
}

/* ---------- Container ---------- */
.container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 1.25rem;
}

/* ---------- Site Header ---------- */
.site-header {
    background-color: #1f2933;
    color: #f5f7fa;
}

.site-header__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.site-header__brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f5f7fa;
}

.site-header__brand:hover,
.site-header__brand:focus {
    text-decoration: none;
    color: #ffffff;
}

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.site-nav__link {
    color: #cbd2d9;
}

.site-nav__link:hover,
.site-nav__link:focus {
    color: #ffffff;
    text-decoration: none;
}

/* ---------- Main Layout ---------- */
main.container {
    flex: 1 0 auto;
}

/* ---------- Site Footer ---------- */
.site-footer {
    background-color: #1f2933;
    color: #cbd2d9;
    padding: 1rem 0;
    margin-top: 2rem;
}

.site-footer .container {
    padding-top: 0;
    padding-bottom: 0;
}

/* ---------- Flash Messages ---------- */
.flash {
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.flash--error {
    background-color: #fde8e8;
    color: #9b1c1c;
    border-color: #f8b4b4;
}

.flash--success {
    background-color: #def7ec;
    color: #03543f;
    border-color: #84e1bc;
}

/* ---------- Product Grid (Cards) ---------- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    padding: 0;
    list-style: none;
}

.product-card {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.product-card__title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.product-card__description {
    color: #52606d;
    flex: 1;
    margin-bottom: 1rem;
}

.product-card__price {
    font-weight: 600;
    color: #1f2933;
    margin-bottom: 1rem;
}

/* ---------- Product Detail ---------- */
.product-detail {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.product-detail__price {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1rem 0;
}

.product-detail__note {
    background-color: #fffbea;
    border: 1px solid #fce96a;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    color: #8d2b0b;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    text-decoration: none;
    background-color: #e4e7eb;
    color: #1f2933;
}

.btn:hover,
.btn:focus {
    text-decoration: none;
    background-color: #cbd2d9;
}

.btn-primary {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    color: #ffffff;
}

.btn-secondary {
    background-color: #ffffff;
    border-color: #cbd2d9;
    color: #1f2933;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background-color: #f5f7fa;
    border-color: #9aa5b1;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    color: #1f2933;
}

/* Scoped to .form-control / .form-group on purpose: the storefront views are
   styled with Tailwind, and bare element selectors here used to repaint every
   input on the site as a light-theme box. */
.form-control,
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1f2933;
    background-color: #ffffff;
    border: 1px solid #cbd2d9;
    border-radius: 4px;
}

.form-control:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-group textarea,
textarea.form-control {
    min-height: 6rem;
    resize: vertical;
}

/* ---------- Empty state ---------- */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #52606d;
}

/* ---------- Responsive Breakpoint ---------- */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .site-header__inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .site-nav {
        width: 100%;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Auth Forms (login / register) ---------- */
.auth-page {
    max-width: 420px;
    margin: 2rem auto;
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 2rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.auth-page h1 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.auth-page .form-group {
    margin-bottom: 1rem;
}

.auth-page .form-group label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.auth-page small {
    display: block;
    margin-top: 0.25rem;
    color: #52606d;
    font-size: 0.875rem;
}

.auth-page .btn {
    width: 100%;
    margin-top: 0.5rem;
    justify-content: center;
}

.auth-page .auth-footer {
    margin-top: 1rem;
    text-align: center;
    color: #52606d;
    font-size: 0.9rem;
}

.error {
    background-color: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f8b4b4;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

/* ---------- Status Badges ---------- */
.status-badge {
    display: inline-block;
    padding: 0.2em 0.65em;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.status-badge--pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge--paid {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge--expired {
    background-color: #f3f4f6;
    color: #374151;
}

.status-badge--manual_review {
    background-color: #ffedd5;
    color: #9a3412;
}

/* ---------- Order Detail ---------- */
.order-detail {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.order-detail h1 {
    margin-bottom: 0.5rem;
}

.order-detail .order-status-row {
    margin-bottom: 1.25rem;
}

.order-detail dl {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    gap: 0.5rem 1rem;
    margin: 0 0 1.25rem;
}

.order-detail dt {
    font-weight: 500;
    color: #52606d;
    font-size: 0.9rem;
}

.order-detail dd {
    margin: 0;
    word-break: break-all;
    font-size: 0.9rem;
}

.order-detail .delivery-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e4e7eb;
}

.order-detail .delivery-section h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.order-detail pre {
    background-color: #f5f7fa;
    border: 1px solid #e4e7eb;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ---------- Payment Page ---------- */
.payment-page {
    max-width: 600px;
    margin: 1.5rem auto;
}

.payment-page h1 {
    margin-bottom: 1.25rem;
}

.product-summary {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.product-summary h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.product-summary .product-description {
    color: #52606d;
    margin: 0;
    font-size: 0.9rem;
}

.amount-breakdown {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.amount-breakdown .amount-line {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
    color: #52606d;
}

.amount-breakdown .discount-line {
    color: #065f46;
}

.amount-breakdown .amount-total {
    margin: 0.75rem 0 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #1f2933;
}

.wallet-details {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.wallet-details .network-label {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #52606d;
}

.wallet-details .wallet-label {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.wallet-address-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.wallet-address {
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    background-color: #f5f7fa;
    border: 1px solid #e4e7eb;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
    word-break: break-all;
    flex: 1;
}

.copy-btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    background-color: #e4e7eb;
    border: 1px solid #cbd2d9;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.copy-btn:hover {
    background-color: #cbd2d9;
}

.payment-note {
    background-color: #fffbea;
    border: 1px solid #fce96a;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    color: #8d2b0b;
    font-size: 0.9rem;
}

.countdown-wrapper {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    font-size: 1rem;
    text-align: center;
}

.countdown-wrapper p {
    margin: 0;
}

#countdown {
    font-weight: 700;
    font-size: 1.2rem;
    font-variant-numeric: tabular-nums;
    color: #2563eb;
}

#countdown.is-urgent {
    color: #dc2626;
}

/* Verify section */
.verify-section {
    margin-bottom: 1.25rem;
}

.verify-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.verify-btn:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.verify-btn:disabled {
    background-color: #9aa5b1;
    cursor: not-allowed;
}

.verify-message {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1.4em;
    color: #52606d;
    text-align: center;
}

/* Manual verification section */
.manual-section {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.manual-section h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    /* Markup carries Tailwind text-white — unreadable on this white panel. */
    color: #1f2933 !important;
}

.manual-section label {
    color: #374151 !important;
}

.manual-section p {
    font-size: 0.9rem;
    color: #52606d;
    margin-bottom: 0.75rem;
}

.manual-toggle-btn {
    background: none;
    border: 1px solid #2563eb;
    color: #2563eb;
    border-radius: 4px;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
    cursor: pointer;
}

.manual-toggle-btn:hover {
    background-color: #eff6ff;
}

.manual-submit-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    color: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: filter 0.2s ease;
}

.manual-submit-btn:hover {
    filter: brightness(1.1);
}

.manual-form {
    margin-top: 1rem;
}

/* Manual-review inputs carry Tailwind utility classes from the markup
 * (bg-transparent + text-white), which are invisible on this white panel.
 * Force readable contrast regardless of the Tailwind build. */
.manual-form input[type="text"],
.manual-form textarea {
    background-color: #f5f7fa !important;
    color: #1f2933 !important;
    border: 1px solid #cbd2d9 !important;
    border-radius: 8px;
}

.manual-form input[type="text"]::placeholder,
.manual-form textarea::placeholder {
    color: #7b8794 !important;
}

.manual-form input[type="text"]:focus,
.manual-form textarea:focus {
    outline: none;
    border-color: #7c3aed !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.manual-form .form-row {
    margin-bottom: 0.75rem;
}

.manual-form .form-row label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.manual-form .optional {
    font-weight: 400;
    color: #9aa5b1;
    font-size: 0.85rem;
}

.manual-submit-btn {
    padding: 0.5rem 1.25rem;
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* The markup stacks Tailwind's btn-gradient (light gradient) under the
 * panel's own solid blue — keep the latter winning so the white label
 * stays readable. */
.manual-submit-btn.btn-gradient {
    background-image: linear-gradient(135deg, #7c3aed, #6366f1);
    background-color: #2563eb;
}

.manual-submit-btn:hover {
    filter: brightness(1.1);
}    font-size: 0.95rem;
    cursor: pointer;
}

.manual-submit-btn:hover {
    background-color: #1d4ed8;
}

.support-link {
    text-align: center;
    font-size: 0.9rem;
    color: #52606d;
    margin-top: 1rem;
}

/* ---------- Payment Success / Delivery ---------- */
.payment-success {
    max-width: 600px;
    margin: 1.5rem auto;
}

.payment-success h1 {
    color: #065f46;
    margin-bottom: 0.5rem;
}

.payment-success .thanks {
    color: #52606d;
    margin-bottom: 1.25rem;
}

.payment-success .product-line,
.payment-success .order-reference {
    font-size: 0.95rem;
    color: #52606d;
    margin-bottom: 0.25rem;
}

.delivery-text {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.25rem;
    margin: 1.25rem 0;
}

.delivery-text h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.delivery-text-box pre {
    background-color: #f5f7fa;
    border: 1px solid #e4e7eb;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0;
}

.delivery-download {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.25rem;
    margin: 1.25rem 0;
}

.delivery-download h2 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}

.download-note {
    font-size: 0.85rem;
    color: #52606d;
    margin-top: 0.5rem;
}

.empty-delivery {
    color: #52606d;
    font-size: 0.95rem;
}

/* ---------- Payment Expired ---------- */
.payment-expired {
    max-width: 520px;
    margin: 2rem auto;
    text-align: center;
}

.payment-expired h1 {
    color: #9b1c1c;
    margin-bottom: 0.75rem;
}

.payment-expired .order-reference {
    font-size: 0.9rem;
    color: #52606d;
    margin-bottom: 0.75rem;
}

/* ---------- Guest Token Pages ---------- */
.guest-orders {
    max-width: 640px;
    margin: 1.5rem auto;
}

.guest-orders h1 {
    margin-bottom: 0.25rem;
}

.guest-orders .guest-hint {
    color: #52606d;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.guest-orders .order {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.guest-orders .order h2 {
    font-size: 1.05rem;
    margin-bottom: 0.75rem;
}

.guest-orders dl {
    display: grid;
    grid-template-columns: minmax(130px, 180px) 1fr;
    gap: 0.4rem 1rem;
    margin: 0 0 1rem;
}

.guest-orders dt {
    font-weight: 500;
    color: #52606d;
    font-size: 0.875rem;
}

.guest-orders dd {
    margin: 0;
    font-size: 0.875rem;
    word-break: break-all;
    color: #1a202c;
}

.guest-orders .order h2,
.guest-orders .order dt {
    color: #1a202c;
}

.guest-orders pre {
    background-color: #f5f7fa;
    border: 1px solid #e4e7eb;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin: 0.5rem 0;
    color: #1a202c;
}

.guest-orders dd {
    word-break: break-all;
}

.guest-expired {
    max-width: 480px;
    margin: 3rem auto;
    text-align: center;
}

.guest-expired h1 {
    margin-bottom: 0.75rem;
}

/* ---------- Support Page ---------- */
.support-page {
    max-width: 640px;
    margin: 1.5rem auto;
}

.support-content {
    background-color: #ffffff;
    border: 1px solid #e4e7eb;
    border-radius: 6px;
    padding: 1.5rem;
    line-height: 1.7;
    color: #1f2933;
}

/* ---------- Storefront Toolbar ---------- */
.storefront-toolbar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.storefront-toolbar input[type="search"] {
    flex: 1;
    min-width: 200px;
}

.storefront-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.storefront-categories .btn.is-active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}

.storefront-pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

/* ---------- Utility ---------- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- Responsive additions ---------- */
@media (max-width: 640px) {
    .payment-page,
    .payment-success,
    .payment-expired,
    .guest-orders,
    .guest-expired,
    .support-page {
        margin: 1rem 0;
    }

    .order-detail dl,
    .guest-orders dl {
        grid-template-columns: 1fr;
    }

    .wallet-address-row {
        flex-direction: column;
        align-items: stretch;
    }

    .copy-btn {
        width: 100%;
        text-align: center;
    }

    .auth-page {
        margin: 1rem 0;
        padding: 1.25rem;
    }
}
