:root {
    --primary: #1f4b3f;
    --primary-light: #2e6e5b;
    --accent: #d9a441;
    --bg: #faf7f2;
    --text: #2b2b2b;
    --muted: #6b6b6b;
    --border: #e4ded2;
    --danger: #b3261e;
    --success: #1e7a34;
    --pending: #a86a00;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-header {
    background: var(--primary);
    color: #fff;
    padding: 40px 0 30px;
}
.site-header h1 { margin: 0 0 6px; font-size: 28px; }
.site-header .tagline { margin: 0; opacity: 0.85; }

main.container { padding-top: 30px; padding-bottom: 60px; }

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s ease, transform .15s ease;
}
.product-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }

.product-image { aspect-ratio: 3/4; background: #eee6d8; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.placeholder-img { font-size: 48px; opacity: .5; }

.product-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-body h2 { margin: 0; font-size: 18px; }
.product-body .author { margin: 0; color: var(--muted); font-size: 13px; }
.product-body .description { margin: 4px 0 0; font-size: 14px; color: #444; flex: 1; }

.product-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.price { font-weight: 700; font-size: 18px; color: var(--primary); }
.out-of-stock { color: var(--danger); font-size: 13px; font-weight: 600; }

.btn-buy {
    background: var(--accent);
    color: #26210f;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-size: 14px;
    transition: filter .15s ease;
}
.btn-buy:hover { filter: brightness(0.94); }
.btn-block { width: 100%; text-align: center; }

.empty-state { color: var(--muted); text-align: center; padding: 60px 0; }

.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 13px; }

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fbe9e7; color: var(--danger); border: 1px solid #f3c6c1; }
.alert-success { background: #e7f6ea; color: var(--success); border: 1px solid #bfe6c9; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; z-index: 100;
}
.modal-box {
    background: #fff; border-radius: var(--radius); padding: 28px;
    width: 100%; max-width: 420px; position: relative;
}
.modal-close {
    position: absolute; top: 12px; right: 16px; background: none; border: none;
    font-size: 22px; cursor: pointer; color: var(--muted);
}
.modal-box h3 { margin-top: 0; }
.modal-box form label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 600; color: #444; }
.modal-box form input {
    width: 100%; padding: 10px 12px; margin-top: 5px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 14px;
}
.secure-note { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

/* Status pages */
.status-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.status-box { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; text-align: center; max-width: 420px; }
.status-icon { font-size: 40px; width: 72px; height: 72px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.status-success .status-icon { background: #e7f6ea; color: var(--success); }
.status-failed .status-icon { background: #fbe9e7; color: var(--danger); }
.status-cancel .status-icon { background: #f2f0ea; color: var(--muted); }
.status-box h1 { font-size: 20px; margin-bottom: 8px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.badge-paid, .badge-success { background: #e7f6ea; color: var(--success); }
.badge-pending, .badge-badge-pending { background: #fdf1dc; color: var(--pending); }
.badge-failed, .badge-cancelled { background: #fbe9e7; color: var(--danger); }
