/* Dashboard Fitness-Home */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --bg: #0f172a;
    --panel: #1e293b;
    --panel2: #263449;
    --border: #334155;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --primary: #3b82f6;
    --green: #22c55e;
    --orange: #f97316;
    --yellow: #eab308;
    --red: #ef4444;
}
body {
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- Login ---------- */
.login-screen {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-box {
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
    padding: 40px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.login-box h1 { font-size: 22px; margin-bottom: 8px; }
.login-box p { margin-bottom: 20px; }
.login-box input {
    width: 100%; padding: 12px 14px; margin-bottom: 14px;
    background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font-size: 15px;
}
.login-error { margin-top: 12px; color: var(--red); font-size: 14px; }

/* ---------- Przyciski ---------- */
.btn {
    padding: 9px 16px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--panel2); color: var(--text); font-size: 14px;
    cursor: pointer; transition: filter .15s;
}
.btn:hover { filter: brightness(1.2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-warn { background: var(--orange); border-color: var(--orange); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 14px 24px; background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; }
.tabs { display: flex; gap: 6px; flex: 1; }
.tab {
    padding: 8px 18px; border-radius: 8px; border: none;
    background: transparent; color: var(--muted); font-size: 14px; cursor: pointer;
}
.tab.active { background: var(--panel2); color: var(--text); font-weight: 600; }
.soon { font-size: 10px; background: var(--border); border-radius: 10px; padding: 2px 7px; margin-left: 4px; }

/* ---------- Layout ---------- */
.tab-panel { max-width: 1280px; margin: 24px auto; padding: 0 20px; }
.card {
    background: var(--panel); border: 1px solid var(--border);
    border-radius: 14px; padding: 22px; margin-bottom: 20px;
}
.card h2 { font-size: 17px; margin-bottom: 8px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }

/* ---------- Automat ---------- */
.automat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin: 16px 0;
}
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .4px; }
.field input {
    width: 100%; padding: 9px 12px; background: var(--bg); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.field .value { font-size: 15px; font-weight: 600; padding: 9px 0; }
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.switch { position: relative; width: 52px; height: 28px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; inset: 0; background: var(--border); border-radius: 28px;
    cursor: pointer; transition: background .2s;
}
.slider::before {
    content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
    background: #fff; top: 3px; left: 3px; transition: transform .2s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(24px); }

.preview-box {
    margin-top: 16px; padding: 14px; background: var(--bg);
    border: 1px solid var(--border); border-radius: 10px; font-size: 14px; line-height: 1.6;
}
.preview-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13px; }
.preview-table th, .preview-table td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.logs-box {
    margin-top: 16px; padding: 14px; background: #000; color: #7dd3fc;
    border-radius: 10px; font-size: 12px; max-height: 320px; overflow: auto; white-space: pre-wrap;
}

/* ---------- Statystyki ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
    background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
    padding: 18px; text-align: center;
}
.stat-num { font-size: 30px; font-weight: 700; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- Tabela ---------- */
.table-toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filters { display: flex; gap: 6px; }
.chip {
    padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border);
    background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
#search {
    flex: 1; min-width: 220px; padding: 9px 14px; background: var(--bg);
    color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.loading { padding: 30px; text-align: center; color: var(--muted); }
.table-wrap { overflow-x: auto; }
#offers-table { width: 100%; border-collapse: collapse; font-size: 14px; }
#offers-table th {
    text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px;
    text-transform: uppercase; letter-spacing: .4px; border-bottom: 2px solid var(--border);
    cursor: pointer; user-select: none; white-space: nowrap;
}
#offers-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
#offers-table tbody tr:hover { background: var(--panel2); }
.pname { font-weight: 500; max-width: 480px; }
.pid { font-size: 12px; color: var(--muted); }
.col-promo { color: var(--green); font-weight: 600; }
.excl { margin-left: 4px; }
.row-zero { opacity: .45; }
.checkline { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); margin-top: 12px; cursor: pointer; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 12px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: rgba(34,197,94,.15); color: var(--green); }
.badge-yellow { background: rgba(234,179,8,.15); color: var(--yellow); }
.badge-orange { background: rgba(249,115,22,.15); color: var(--orange); }
.badge-red { background: rgba(239,68,68,.15); color: var(--red); }
.badge-gray { background: rgba(148,163,184,.15); color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-orange { background: var(--orange); }
.dot-red { background: var(--red); }
.dot-gray { background: var(--muted); }

/* ---------- Modul Zdjecia ---------- */
.photo-row {
    display: flex; align-items: center; gap: 18px;
    padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.photo-meta { width: 340px; flex-shrink: 0; }
.photo-strip { display: flex; gap: 10px; flex-wrap: wrap; }
.photo-strip.strip-busy { opacity: .4; pointer-events: none; }
.thumb {
    position: relative; width: 150px; height: 150px; border-radius: 10px;
    border: 2px solid var(--border); overflow: hidden; cursor: grab;
    background: var(--bg); flex-shrink: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.thumb-main { border-color: var(--green); }
.thumb-star { border-color: var(--yellow); }
.thumb-btn {
    position: absolute; top: 4px; right: 4px; width: 26px; height: 26px;
    border-radius: 50%; border: none; cursor: pointer; font-size: 13px;
    background: rgba(0,0,0,.7); color: var(--yellow); display: none;
}
.thumb:hover .thumb-btn { display: block; }
.thumb-btn:hover { background: var(--yellow); color: #000; }
.thumb-flag { align-self: center; font-size: 12px; color: var(--yellow); white-space: nowrap; }
.thumb-nr {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0,0,0,.65); font-size: 11px; padding: 2px 6px; text-align: center;
}
#photo-pager { justify-content: center; align-items: center; margin-top: 14px; }

/* ---------- Toasty ---------- */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 12px 18px; border-radius: 10px; background: var(--panel);
    border: 1px solid var(--border); font-size: 14px; opacity: 0;
    transform: translateY(10px); transition: all .3s; max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: var(--green); }
.toast-error { border-color: var(--red); }

@media (max-width: 720px) {
    .topbar { flex-wrap: wrap; gap: 10px; }
    .pname { max-width: 220px; }
}
