/* qr.borismek.se — mini-calc-tema (rivet-steel + rust-gold + Oswald/Source Code Pro) */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

body {
    font-family: 'Source Code Pro', monospace;
    color: #e8dcc8;
    background: #1a1a1a;
    min-height: 100vh;
    padding: 20px;
}

body::before {
    content: '';
    position: fixed;
    top: -5px;
    left: -5px;
    width: calc(100% + 10px);
    height: calc(100% + 10px);
    background: url('img/bg_borismek.webp') no-repeat top center;
    background-size: cover;
    z-index: -1;
}

a { color: #c9a84c; text-decoration: none; }
a:hover { color: #d4b85c; text-decoration: underline; }

/* ─── Page layout ─────────────────────────────────────────────────── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ─── Topbar ─────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 24px;
    border-bottom: 1px solid #4a4238;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 14px;
}
.brand {
    font-family: 'Oswald', sans-serif;
    font-weight: 700;
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.brand-main { color: #c9a84c; }
.brand-sep { color: #6a6358; margin: 0 6px; }
.brand-sub { color: #e8dcc8; font-weight: 600; }

.topnav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-family: 'Oswald', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.9rem;
}
.topnav a {
    color: #a09888;
    padding: 6px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}
.topnav a:hover {
    color: #c9a84c;
    border-bottom-color: #c9a84c;
    text-decoration: none;
}

/* ─── Card (riveted steel panel) ───────────────────────────────── */
.card, .results-card {
    background: linear-gradient(145deg, #3a3632, #2a2622, #33302c);
    border: 2px solid #5a5347;
    border-radius: 4px;
    padding: 32px 36px;
    z-index: 1;
    position: relative;
    box-shadow:
        0 0 0 1px #1a1714,
        0 8px 32px rgba(0,0,0,0.6),
        inset 0 1px 0 rgba(255,255,255,0.05);
    margin-bottom: 24px;
}

/* Corner rivets */
.card::before, .card::after,
.results-card::before, .results-card::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #8a7d6b, #4a4238);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.08);
}
.card::before, .results-card::before { top: 10px; left: 10px; }
.card::after, .results-card::after { top: 10px; right: 10px; }
.rivets-bottom::before, .rivets-bottom::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #8a7d6b, #4a4238);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.5), 0 1px 0 rgba(255,255,255,0.08);
}
.rivets-bottom::before { bottom: 10px; left: 10px; }
.rivets-bottom::after  { bottom: 10px; right: 10px; }

/* ─── Headings ───────────────────────────────────────────────────── */
h1 {
    font-family: 'Oswald', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #c9a84c;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.subtitle {
    color: #8a8078;
    font-size: 0.8rem;
    margin-bottom: 24px;
    letter-spacing: 0.02em;
}

.section-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #6a6358;
    margin-bottom: 12px;
    border-bottom: 1px solid #4a4238;
    padding-bottom: 6px;
}

/* ─── Form fields ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field.inline-field { margin-bottom: 0; }
label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #a09888;
}
label span {
    font-weight: 400;
    color: #6a6358;
}

.input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #4a4238;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(0,0,0,0.3);
    transition: border-color 0.2s;
}
.input-wrap:focus-within {
    border-color: #c9a84c;
    box-shadow: 0 0 0 2px rgba(201,168,76,0.15);
}
.input-wrap.inline { display: inline-flex; }
.input-wrap.textarea-wrap { padding: 0; }

input[type="number"], input[type="text"], select, textarea {
    border: none;
    outline: none;
    padding: 10px 12px;
    font-family: 'Source Code Pro', monospace;
    font-size: 1rem;
    background: transparent;
    color: #e8dcc8;
    width: 100%;
}
textarea {
    min-height: 110px;
    resize: vertical;
    font-size: 0.95rem;
}
input[type="number"] { width: 80px; text-align: center; }
input[type="text"]   { width: 100%; }
select               { padding-right: 24px; }

/* Inline-versioner är smala (t.ex. prefix-token-input på Indata-sektionen) */
.input-wrap.inline input[type="text"]   { width: 120px; }
.input-wrap.inline input[type="number"] { width: 80px; }

input::placeholder, textarea::placeholder { color: #5a5347; }

/* Hide number spinners */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

/* ─── Token-row ──────────────────────────────────────────────────── */
.token-row {
    margin-top: 14px;
    background: rgba(0,0,0,0.25);
    border: 1px solid #4a4238;
    border-radius: 3px;
    padding: 12px 14px;
}
.token-row-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.token-label {
    font-size: 0.8rem;
    color: #a09888;
}

/* ─── Settings-row ───────────────────────────────────────────────── */
.settings-row {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
}
.settings-spacer { flex: 1; min-width: 8px; }

/* ─── Export-row ─────────────────────────────────────────────────── */
.export-row {
    display: none;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed #4a4238;
}
.export-row.visible { display: flex; }
.export-label {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8a8078;
    margin-right: 4px;
}

/* ─── Buttons ────────────────────────────────────────────────────── */
.btn-primary, .btn-secondary, button.btn-primary, button.btn-secondary {
    padding: 10px 14px;
    border-radius: 3px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(180deg, #c9a84c, #9a7a2c);
    color: #1a1714;
    border: 1px solid #d4b85c;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.btn-primary:hover {
    background: linear-gradient(180deg, #d4b85c, #b08a3c);
    box-shadow: 0 2px 12px rgba(201,168,76,0.3);
}
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: rgba(0,0,0,0.3);
    color: #a09888;
    border: 1px solid #5a5347;
}
.btn-secondary:hover {
    background: rgba(201,168,76,0.1);
    color: #c9a84c;
    border-color: #c9a84c;
}
.btn-secondary:active { transform: scale(0.98); }

.btn-danger {
    background: rgba(212,90,90,0.15);
    color: #d45a5a;
    border: 1px solid #d45a5a;
}
.btn-danger:hover {
    background: rgba(212,90,90,0.25);
}

/* ─── Results ────────────────────────────────────────────────────── */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #4a4238;
}
.results-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #c9a84c;
}
.stats {
    font-size: 0.8rem;
    color: #8a8078;
    transition: color 0.2s;
}
.stats.flash { color: #6ec07a; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.qr-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid #4a4238;
    border-radius: 3px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: border-color 0.15s, transform 0.15s;
}
.qr-card:hover {
    border-color: #c9a84c;
    transform: translateY(-2px);
}
.qr-card.saved {
    border-color: #6ec07a;
}
.qr-card-index {
    align-self: flex-start;
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6a6358;
}
.qr-wrap {
    background: #fff;
    padding: 8px;
    border-radius: 3px;
}
.qr-canvas {
    display: block;
    width: 140px;
    height: 140px;
    image-rendering: pixelated;
}
.qr-label {
    font-size: 0.75rem;
    color: #a09888;
    text-align: center;
    word-break: break-all;
    line-height: 1.3;
    max-height: 30px;
    overflow: hidden;
    width: 100%;
}
.qr-card-actions {
    display: flex;
    gap: 5px;
    width: 100%;
}
.qr-card-actions button {
    font-size: 0.75rem;
    padding: 6px 8px;
    flex: 1;
    justify-content: center;
}
.qr-card-actions button.icon-only { flex: 0 0 auto; padding: 6px 8px; }

.empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #6a6358;
    font-family: 'Source Code Pro', monospace;
    font-style: italic;
    font-size: 0.95rem;
}

/* ─── Footer ─────────────────────────────────────────────────────── */
footer {
    margin-top: 40px;
    padding: 20px 8px;
    border-top: 1px solid #4a4238;
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    color: #6a6358;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}
footer .bmac img {
    height: 38px;
    display: block;
    border-radius: 4px;
    transition: transform 0.15s, box-shadow 0.15s;
}
footer .bmac img:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(150,83,39,0.4);
}

/* ─── Mina koder-sida ────────────────────────────────────────────── */
.mina-info {
    background: rgba(0,0,0,0.25);
    border-left: 3px solid #c9a84c;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 0.85rem;
    line-height: 1.5;
}
.mina-info code {
    background: rgba(0,0,0,0.4);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 0.8rem;
    color: #c9a84c;
    word-break: break-all;
}
.mina-search {
    margin-bottom: 18px;
}
.mina-table {
    width: 100%;
    border-collapse: collapse;
}
.mina-table th, .mina-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #3a3632;
    font-size: 0.85rem;
}
.mina-table th {
    font-family: 'Oswald', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #8a8078;
    background: rgba(0,0,0,0.2);
}
.mina-table tr:hover td { background: rgba(201,168,76,0.05); }
.mina-table .qr-thumb { width: 60px; height: 60px; image-rendering: pixelated; }
.mina-table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.mina-table .actions button { font-size: 0.75rem; padding: 5px 8px; }

.flash {
    padding: 10px 14px;
    border-radius: 3px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.flash-ok { background: rgba(110,192,122,0.15); border-left: 3px solid #6ec07a; color: #b6e8be; }
.flash-error { background: rgba(212,90,90,0.15); border-left: 3px solid #d45a5a; color: #ffb6b6; }

/* ─── Mobile ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    body { padding: 12px; }
    .card, .results-card { padding: 18px 20px; }
    h1 { font-size: 1.2rem; }
    .topbar { padding: 10px 0 16px; }
    .brand { font-size: 1.3rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .settings-row { flex-direction: column; align-items: stretch; }
    .settings-spacer { display: none; }
    .btn-primary, .btn-secondary { font-size: 0.8rem; }
}
