/* Opepři – mobile-first stylesheet, no build step */
:root {
	--bg: #f5f4f1;
	--surface: #fff;
	--text: #1d1d1f;
	--muted: #6b6b70;
	--border: #e3e1dc;
	--accent: #d6301e;
	--accent-dark: #a81f11;
	--hot: #e2421e;
	--cold: #2c7fd6;
	--ok: #2f8a3b;
	--warn: #b7791f;
	--radius: 10px;
	--shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
	--font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.5 var(--font); color: var(--text); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--accent-dark); }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
code, .code { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.inline { display: inline; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.empty { padding: 2rem; text-align: center; color: var(--muted); background: var(--surface); border-radius: var(--radius); }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; color: var(--text); text-decoration: none; }
.user-nav { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { color: var(--text); text-decoration: none; font-size: .95rem; }
.nav-link:hover { color: var(--accent); }
.category-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.category-nav::-webkit-scrollbar { display: none; }
.category-nav a { flex: none; padding: 4px 12px; border-radius: 999px; background: var(--bg); color: var(--text); text-decoration: none; font-size: .875rem; }
.category-nav a.active, .category-nav a:hover { background: var(--accent); color: #fff; }

main.wrap { padding-top: 16px; padding-bottom: 32px; min-height: 60vh; }

/* Buttons & forms */
.btn, button.btn, input[type=submit] {
	display: inline-block; padding: 10px 18px; border: 0; border-radius: 8px; background: var(--text); color: #fff;
	font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: #000; color: #fff; }
.btn-accent, input[type=submit].btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-small { padding: 6px 12px; font-size: .9rem; }
.btn-big { display: block; width: 100%; padding: 14px 20px; font-size: 1.1rem; text-align: center; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-ok { background: var(--ok); }
.btn-danger { background: #8b1d12; }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: inherit; }

form .field { margin-bottom: 14px; }
form label { display: block; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=url], input[type=number], input[type=date], input[type=search], select, textarea {
	width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: #fff;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form-row { display: grid; gap: 12px; }
.error, .form-errors { color: var(--accent-dark); font-size: .9rem; }
ul.form-errors { padding-left: 1.2rem; }
.help { color: var(--muted); font-size: .85rem; margin-top: 2px; }

/* Flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: #e8f4ea; color: #1e5b28; }
.flash-error { background: #fbe6e3; color: #8b1d12; }
.flash-info { background: #e7f0fb; color: #1f4f86; }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tabs a { padding: 8px 16px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; background: var(--surface); border: 1px solid var(--border); }
.tabs a.active { background: var(--text); color: #fff; border-color: var(--text); }

/* Deal card */
.deal-list { display: grid; gap: 10px; }
.deal-card { display: flex; gap: 12px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; }
.deal-card.is-expired { opacity: .65; }
.deal-card-image { flex: none; width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; overflow: hidden; text-decoration: none; }
.deal-card-image img { width: 100%; height: 100%; object-fit: contain; }
.image-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), #f08a24); }
.deal-card-body { flex: 1; min-width: 0; }
.deal-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.deal-card-title { font-size: 1rem; margin: 6px 0 4px; overflow-wrap: anywhere; }
.deal-card-title a { color: var(--text); text-decoration: none; }
.deal-card-title a:hover { color: var(--accent); }
.deal-card-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.shop-link { font-weight: 600; text-decoration: none; }
.price { font-weight: 800; color: var(--accent); font-size: 1.1rem; }
.price-original { color: var(--muted); margin-left: 6px; }
.discount { margin-left: 6px; background: var(--accent); color: #fff; padding: 1px 6px; border-radius: 6px; font-size: .8rem; font-weight: 700; vertical-align: 2px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: .75rem; font-weight: 700; background: var(--bg); }
.badge-expired { background: #444; color: #fff; }
.badge-warn { background: #fdf0d8; color: var(--warn); }
.badge-ok { background: #e8f4ea; color: var(--ok); }

/* Vote box */
.vote-box { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: #fff; }
.vote-btn { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--bg); font-size: 1.1rem; font-weight: 700; cursor: pointer; line-height: 1; color: var(--muted); }
.vote-down:hover, .vote-down.active { background: var(--cold); color: #fff; }
.vote-up:hover, .vote-up.active { background: var(--hot); color: #fff; }
.temperature { min-width: 46px; text-align: center; font-weight: 800; }
.vote-box.hot .temperature { color: var(--hot); }
.vote-box.cold .temperature { color: var(--cold); }
.vote-box.big .vote-btn { width: 38px; height: 38px; }
.vote-box.big .temperature { font-size: 1.3rem; min-width: 60px; }

/* Paginator */
.paginator { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; gap: 8px; }

/* Deal detail */
.deal-detail { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 16px; }
.deal-detail-image { background: #fff; border-radius: 8px; text-align: center; }
.deal-detail-image img { max-height: 360px; object-fit: contain; }
.deal-detail-image .image-placeholder { height: 220px; border-radius: 8px; font-size: 4rem; }
.deal-detail h1 { margin: 8px 0; overflow-wrap: anywhere; }
.deal-detail .price { font-size: 1.6rem; }
.deal-facts { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 4px; }
.coupon { display: flex; gap: 8px; align-items: stretch; margin: 12px 0; }
.coupon code { flex: 1; padding: 10px 12px; border: 2px dashed var(--accent); border-radius: 8px; font-size: 1.1rem; font-weight: 700; text-align: center; background: #fff8f6; }
.deal-description { white-space: pre-line; overflow-wrap: anywhere; }
.expired-banner { padding: 12px 14px; border-radius: 8px; background: #444; color: #fff; font-weight: 600; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }

/* Comments */
.comments { margin-top: 24px; }
.comment { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow); }
.comment-head { display: flex; gap: 8px; align-items: baseline; font-size: .875rem; margin-bottom: 4px; }
.comment-body { overflow-wrap: anywhere; }
.comment.is-deleted { opacity: .6; font-style: italic; }

/* Generic page */
.page { background: var(--surface); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.section-title { margin-top: 28px; font-size: 1.2rem; }
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.page-header img { width: 56px; height: 56px; object-fit: contain; background: #fff; border-radius: 8px; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 20px 0; font-size: .9rem; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }

/* Tables (admin) */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--bg); font-weight: 700; white-space: nowrap; }

@media (min-width: 720px) {
	h1 { font-size: 1.9rem; }
	.deal-card { padding: 14px 16px; }
	.deal-card-image { width: 130px; height: 130px; }
	.deal-card-title { font-size: 1.15rem; }
	.deal-detail { grid-template-columns: 340px 1fr; padding: 24px; }
	.form-row { grid-template-columns: 1fr 1fr; }
	.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
}
