/* ===== Roboty Ziemne — Panel admina. Motyw spójny z publiczną stroną. ===== */
:root {
    --bg: #121212;
    --surface: #1e1e1e;
    --surface-2: #242424;
    --border: #2e2e2e;
    --text: #ffffff;
    --muted: #b0b0b0;
    --accent: #fa4f00;
    --accent-hover: #e04600;
    --danger: #ff5a5a;
    --radius: 12px;
}

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

html, body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Topbar panelu ---------- */
.admin-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 1.5rem;
    padding: 0 clamp(1rem, 4vw, 2.5rem); height: 64px;
    background: #171717;
    border-bottom: 1px solid var(--border);
}
.admin-brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); }
.admin-brand:hover { color: var(--text); }
.admin-brand .mark {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 8px;
    background: var(--accent); color: #fff; font-weight: 800; font-size: .85rem; letter-spacing: .02em;
}
.admin-brand .mark-sub { font-size: .7rem; color: var(--muted); font-weight: 500; display: block; margin-top: -2px; }
.admin-nav { display: flex; gap: .35rem; margin-left: .5rem; }
.admin-nav a {
    color: var(--muted); font-weight: 600; font-size: .92rem;
    padding: .45rem .8rem; border-radius: 8px; transition: color .15s, background .15s;
}
.admin-nav a:hover { color: var(--text); background: var(--surface-2); }
.admin-nav a.active { color: var(--accent); }
.admin-spacer { flex: 1; }
.admin-user { color: var(--muted); font-size: .85rem; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-logout button {
    background: transparent; color: var(--muted); border: 1px solid var(--border);
    padding: .4rem .85rem; border-radius: 8px; font-weight: 600; font-size: .85rem; cursor: pointer;
    transition: border-color .15s, color .15s;
}
.admin-logout button:hover { color: var(--text); border-color: var(--muted); }

.admin-main { max-width: 1180px; margin: 0 auto; padding: clamp(1.25rem, 4vw, 2.5rem); }

/* ---------- Nagłówek sekcji ---------- */
.section-head { display: flex; align-items: baseline; gap: .75rem; margin-bottom: 1.5rem; }
.section-head h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); margin: 0; }
.section-head .count { color: var(--muted); font-size: .9rem; font-weight: 500; }

/* ---------- Pasek uploadu ---------- */
.upload-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .75rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1rem; margin-bottom: 1.75rem;
}
.upload-bar .field { flex: 1; min-width: 180px; }

/* ---------- Pola i przyciski ---------- */
.admin-main input[type="text"], .admin-main input:not([type]), .upload-bar input {
    width: 100%; background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
    padding: .55rem .7rem; border-radius: 8px; font: inherit; font-size: .9rem;
}
.admin-main input::placeholder { color: #6b6b6b; }
.admin-main input:focus, .upload-bar input:focus { outline: none; border-color: var(--accent); }

input[type="file"]::file-selector-button {
    background: transparent; color: var(--accent); border: 1px solid var(--accent);
    padding: .5rem .9rem; border-radius: 8px; font-weight: 600; cursor: pointer; margin-right: .6rem;
    transition: background .15s, color .15s;
}
input[type="file"]::file-selector-button:hover { background: var(--accent); color: #fff; }

.btn-accent {
    background: var(--accent); color: #fff; border: none; padding: .55rem 1.2rem;
    border-radius: 8px; font-weight: 700; font-size: .9rem; cursor: pointer; transition: background .15s;
}
.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }
.btn-accent:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Siatka zdjęć ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1.1rem; }
.photo-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s;
}
.photo-card:hover { border-color: #454545; transform: translateY(-2px); }
.photo-card > img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #000; }
.photo-card.hidden > img { opacity: .45; filter: grayscale(.4); }
.photo-card-body { padding: .75rem; display: flex; flex-direction: column; gap: .6rem; }
.photo-card-actions { display: flex; align-items: center; gap: .5rem; }

.pill {
    flex: 1; text-align: center; border: 1px solid var(--border); background: var(--surface-2);
    color: var(--muted); padding: .4rem .5rem; border-radius: 8px; font-weight: 600; font-size: .8rem; cursor: pointer;
    transition: all .15s;
}
.pill.on { color: var(--accent); border-color: rgba(250, 79, 0, .5); }
.pill:hover { border-color: var(--muted); color: var(--text); }
.icon-btn {
    background: transparent; border: 1px solid var(--border); color: var(--muted);
    width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: .9rem; transition: all .15s;
}
.icon-btn:hover { color: var(--danger); border-color: rgba(255, 90, 90, .5); }

.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .4rem; background: #555; }
.status-dot.on { background: var(--accent); }

.error { color: var(--danger); font-weight: 600; margin: .5rem 0; }
.muted-note { color: var(--muted); font-size: .9rem; }

/* ---------- Logowanie / strony konta (MainLayout) ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card {
    width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 2.25rem;
}
.auth-card h1 { font-size: 1.5rem; margin: 0 0 .3rem; }
.auth-subtitle { color: var(--muted); font-size: .9rem; margin: 0 0 1.5rem; }
.auth-card .mb-3 { margin-bottom: 1rem !important; }
.auth-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.75rem; font-weight: 700; }
.auth-brand .mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 800; }
.auth-card .form-control, .auth-card input {
    background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.auth-card .form-control:focus { background: var(--surface-2); color: var(--text); border-color: var(--accent); box-shadow: none; }
.auth-card label, .auth-card .form-label { color: var(--muted); }
.auth-card .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.auth-card .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ---------- Blazor: walidacja / błędy / reconnect (przetłumaczone) ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); }
h1:focus { outline: none; }

.blazor-error-boundary { background: #b32121; padding: 1rem; color: #fff; border-radius: 8px; }
.blazor-error-boundary::after { content: "Wystąpił błąd."; }

@media (max-width: 640px) {
    .admin-topbar { gap: .75rem; }
    .admin-user { display: none; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
