/* ============================================================
   PrzetargiPro — design system
   Exact match of TODO/styles.css — adapted for Symfony/Twig
   ============================================================ */

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

:root {
  --bg:           #0f172a;
  --bg-elevated:  #020617;
  --accent:       #10b981;
  --accent-soft:  rgba(16, 185, 129, 0.1);
  --accent-strong:#34d399;
  --text:         #e5e7eb;
  --text-muted:   #9ca3af;
  --border-subtle:rgba(148, 163, 184, 0.3);
  --card-bg:      rgba(15, 23, 42, 0.9);
  --radius-lg:    18px;
  --radius-md:    12px;
  --shadow-soft:  0 18px 45px rgba(15, 23, 42, 0.75);
}

/* ── Base ────────────────────────────────────────────── */

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #1f2937 0, #020617 55%, #000 100%);
  color: var(--text);
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Topbar ──────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  background: linear-gradient(to right, rgba(15,23,42,0.95), rgba(15,23,42,0.85));
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  backdrop-filter: blur(16px);
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 0, var(--accent-strong), var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #022c22;
  box-shadow: 0 0 0 1px rgba(34,197,94,0.5), 0 12px 30px rgba(34,197,94,0.45);
}

.logo-text {
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.logo-text span {
  color: var(--accent-strong);
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  justify-content: center;
}

.nav-item {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: 0.18s all ease-out;
  text-decoration: none;
}

.nav-item:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.6);
  background: rgba(15,23,42,0.7);
}

.nav-item.active {
  color: #ecfdf5;
  border-color: rgba(34, 197, 94, 0.7);
  background: linear-gradient(to right, rgba(16,185,129,0.18), rgba(34,197,94,0.18));
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.25), 0 15px 40px rgba(16, 185, 129, 0.35);
}

.topbar-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.topbar-user {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Main layout ─────────────────────────────────────── */

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px clamp(16px, 4vw, 32px) 32px;
  max-width: 1240px;
  margin: 0 auto;
}

/* ── Sidebar ─────────────────────────────────────────── */

.sidebar {
  background: radial-gradient(circle at top, rgba(15,23,42,0.95), rgba(15,23,42,0.98));
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-self: start;
  position: sticky;
  top: calc(14px + 52px); /* below topbar */
}

.sidebar h2 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.sidebar label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Content panel ───────────────────────────────────── */

.content {
  background: linear-gradient(145deg, rgba(15,23,42,0.98), rgba(15,23,42,0.96));
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: var(--shadow-soft);
  padding: 20px 22px 24px;
  min-height: 540px;
  position: relative;
  overflow: hidden;
}

.content::before {
  content: "";
  position: absolute;
  inset: -120px;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,0.16), transparent 55%),
    radial-gradient(circle at bottom left, rgba(16,185,129,0.18), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
}

.content > * {
  position: relative;
  z-index: 1;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.panel-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Inputs & Selects ────────────────────────────────── */

.sidebar input,
.sidebar select,
.nip-form input,
.ad-form input,
.ad-form textarea,
.ad-form select {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(15,23,42,0.9);
  padding: 8px 12px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: border 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.ad-form textarea {
  border-radius: 16px;
  resize: vertical;
  min-height: 96px;
}

.sidebar input:focus,
.sidebar select:focus,
.nip-form input:focus,
.ad-form input:focus,
.ad-form textarea:focus,
.ad-form select:focus {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4), 0 0 0 6px rgba(16, 185, 129, 0.15);
  background: rgba(15,23,42,0.96);
}

/* ── Buttons ─────────────────────────────────────────── */

.btn-primary {
  padding: 9px 16px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #022c22;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(16, 185, 129, 0.45);
  transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.1s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 22px 40px rgba(16, 185, 129, 0.6);
  color: #022c22;
}

.btn-primary-full {
  width: 100%;
  margin-top: 4px;
}

.btn-ghost {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.16s all ease;
  text-decoration: none;
  display: inline-block;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(248, 250, 252, 0.9);
  background: rgba(15,23,42,0.85);
}

.btn-auth {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: 0.16s all ease;
  text-decoration: none;
  display: inline-block;
}

.btn-auth:hover {
  color: var(--text);
  border-color: rgba(248, 250, 252, 0.9);
}

/* ── Hint box ────────────────────────────────────────── */

.hint-box {
  border-radius: var(--radius-md);
  padding: 10px 11px;
  background: radial-gradient(circle at top, rgba(16,185,129,0.08), rgba(15,23,42,0.95));
  border: 1px solid rgba(34, 197, 94, 0.5);
  margin-top: 6px;
}

.hint-box h3 {
  font-size: 0.85rem;
  margin-bottom: 4px;
  color: var(--accent-strong);
}

.hint-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Cards ───────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  background: rgba(15,23,42,0.96);
  border-radius: var(--radius-md);
  padding: 14px 14px 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 10px 30px rgba(15,23,42,0.6);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card h2,
.card h3 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.card h2 a,
.card h3 a {
  color: var(--text);
  transition: color 0.15s;
}

.card h2 a:hover,
.card h3 a:hover {
  color: var(--accent-strong);
}

.card .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.card-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
}

/* ── Status badges ───────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-green  { background: rgba(16,185,129,0.15); color: #6ee7b7; border: 1px solid rgba(16,185,129,0.3); }
.badge-yellow { background: rgba(234,179,8,0.15);  color: #fde047; border: 1px solid rgba(234,179,8,0.3); }
.badge-blue   { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.badge-gray   { background: rgba(148,163,184,0.12);color: #94a3b8; border: 1px solid rgba(148,163,184,0.25); }
.badge-red    { background: rgba(239,68,68,0.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,0.3); }
.badge-purple { background: rgba(168,85,247,0.15); color: #d8b4fe; border: 1px solid rgba(168,85,247,0.3); }

/* ── Table ───────────────────────────────────────────── */

.table-wrapper {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.4);
  overflow: hidden;
  background: rgba(15,23,42,0.96);
  box-shadow: 0 10px 26px rgba(15,23,42,0.6);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead {
  background: linear-gradient(to right, rgba(15,23,42,0.9), rgba(15,23,42,0.98));
}

th,
td {
  padding: 9px 12px;
  text-align: left;
}

th {
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(148, 163, 184, 0.5);
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: rgba(15,23,42,0.88);
}

tbody tr:hover {
  background: rgba(30,64,175,0.3);
}

td a {
  color: var(--text);
  transition: color 0.15s;
}

td a:hover {
  color: var(--accent-strong);
}

/* ── NIP form ────────────────────────────────────────── */

.nip-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
}

.nip-form label {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nip-result {
  margin-top: 4px;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: radial-gradient(circle at top, var(--accent-soft), rgba(15,23,42,0.98));
  border: 1px solid rgba(16,185,129,0.6);
  font-size: 0.9rem;
}

.nip-result h2 {
  font-size: 1.1rem;
  margin-bottom: 8px;
  color: var(--accent-strong);
}

.nip-result p {
  margin-bottom: 4px;
  color: var(--text-muted);
}

.nip-result p strong {
  color: var(--text);
}

.nip-result .note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(148,163,184,0.15);
  padding-top: 8px;
}

/* ── Ads — two column layout ─────────────────────────── */

.two-columns {
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(260px, 1.2fr);
  gap: 20px;
}

.ad-form {
  background: rgba(15,23,42,0.96);
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.45);
  padding: 14px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 26px rgba(15,23,42,0.6);
}

.ad-form h2 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.ad-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ads-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ads-list h2 {
  font-size: 1rem;
  margin-bottom: 6px;
}

/* ── Flash messages ──────────────────────────────────── */

.flash-wrapper {
  max-width: 1240px;
  margin: 0 auto;
  padding: 12px clamp(16px, 4vw, 32px) 0;
}

.flash {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.flash-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.4); color: #6ee7b7; }
.flash-danger,
.flash-error   { background: rgba(239,68,68,0.1);  border: 1px solid rgba(239,68,68,0.4);  color: #fca5a5; }
.flash-info    { background: rgba(59,130,246,0.1);  border: 1px solid rgba(59,130,246,0.4);  color: #93c5fd; }

/* ── Pagination ──────────────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
}

.page-link {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: 0.15s all;
}

.page-link:hover {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.7);
}

.page-link.active {
  color: #ecfdf5;
  border-color: rgba(34, 197, 94, 0.7);
  background: linear-gradient(to right, rgba(16,185,129,0.18), rgba(34,197,94,0.18));
}

/* ── Footer ──────────────────────────────────────────── */

.footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 32px) 24px;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 8px;
}

/* ── Login form ──────────────────────────────────────── */

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: rgba(15,23,42,0.96);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  padding: 32px 28px;
}

.login-box h1 {
  font-size: 1.3rem;
  margin-bottom: 4px;
  text-align: center;
}

.login-box .subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-group label {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.form-group input {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(15,23,42,0.9);
  padding: 9px 14px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  transition: border 0.16s ease, box-shadow 0.16s ease;
}

.form-group input:focus {
  border-color: rgba(34, 197, 94, 0.9);
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.4), 0 0 0 6px rgba(16, 185, 129, 0.15);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ── Empty state ─────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
  gap: 8px;
}

.empty-state .icon {
  font-size: 2.5rem;
  opacity: 0.4;
  margin-bottom: 4px;
}

/* ── Score bars ──────────────────────────────────────── */

.score-bar-wrap {
  margin-bottom: 10px;
}

.score-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.score-bar-label span:last-child {
  color: var(--text);
  font-weight: 500;
}

.score-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(148,163,184,0.15);
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(to right, var(--accent), var(--accent-strong));
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    order: 2;
    position: static;
  }

  .content {
    order: 1;
  }

  .two-columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    white-space: nowrap;
  }

  .topbar-auth {
    display: none;
  }
}
