/* =============================================================
   EroOpowiadania.pl - Global Styles
   Aesthetic: Dark luxury editorial — deep crimson & black
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

:root {
  --bg:         #0a0608;
  --bg2:        #120d0f;
  --bg3:        #1c1215;
  --border:     #2e1e23;
  --border2:    #3d2830;
  --primary:    #c41e3a;
  --primary-h:  #e02248;
  --primary-d:  #8b1528;
  --gold:       #c9a84c;
  --gold-h:     #e5c070;
  --text:       #e8dde0;
  --text-muted: #9a7f86;
  --text-dim:   #6b5058;
  --white:      #f5eeef;
  --radius:     6px;
  --radius-lg:  12px;
  --shadow:     0 4px 24px rgba(0,0,0,0.6);
  --shadow-lg:  0 8px 48px rgba(0,0,0,0.8);
  --trans:      all 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 18px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--trans); }
a:hover { color: var(--primary-h); }

img { max-width: 100%; display: block; }

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.3rem; }

p { margin-bottom: 1em; }

/* ===== LAYOUT ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.main-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  padding: 2rem 0;
}

@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
}

/* ===== HEADER ===== */
.site-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  gap: 1rem;
}

.site-logo {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
  white-space: nowrap;
}

.site-logo span {
  color: var(--primary);
}

.header-search {
  flex: 1;
  max-width: 420px;
}

.header-search form {
  display: flex;
  gap: 0;
}

.header-search input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-right: none;
  color: var(--text);
  padding: 0.55rem 1rem;
  border-radius: var(--radius) 0 0 var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: var(--trans);
}

.header-search input:focus {
  border-color: var(--primary);
  background: var(--bg3);
}

.header-search button {
  background: var(--primary);
  border: none;
  color: white;
  padding: 0.55rem 1rem;
  cursor: pointer;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: var(--trans);
  font-size: 1rem;
}

.header-search button:hover { background: var(--primary-h); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-nav a {
  color: var(--text-muted);
  font-size: 0.95rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  transition: var(--trans);
  white-space: nowrap;
}

.header-nav a:hover { color: var(--white); background: var(--bg3); }

.btn-login {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text) !important;
}

.btn-register {
  background: var(--primary) !important;
  color: white !important;
  border: none;
}

.btn-register:hover { background: var(--primary-h) !important; }

/* ===== NAVIGATION ===== */
.cat-nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

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

.cat-nav-inner {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.cat-nav a {
  color: var(--text-muted);
  font-size: 0.88rem;
  padding: 0.65rem 1rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: var(--trans);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.cat-nav a:hover, .cat-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== AGE GATE ===== */
.age-gate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 2, 3, 0.97);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.age-gate-box {
  max-width: 560px;
  width: 100%;
  text-align: center;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp 0.4s ease;
}

.age-gate-logo {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.5rem;
}
.age-gate-logo span { color: var(--primary); }

.age-gate-icon {
  font-size: 3.5rem;
  margin: 1.2rem 0;
}

.age-gate-title {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 1rem;
}

.age-gate-text {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 2rem;
}

.age-gate-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--trans);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover { background: var(--primary-h); color: white; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-gold {
  background: var(--gold);
  color: #1a0e00;
}
.btn-gold:hover { background: var(--gold-h); color: #1a0e00; }

.btn-danger {
  background: #8b0000;
  color: white;
}
.btn-danger:hover { background: #b00000; color: white; }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.9rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.1rem; }
.btn-block { width: 100%; justify-content: center; }

/* ===== CARDS ===== */
.story-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--trans);
  position: relative;
}

.story-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.story-card.featured {
  border-color: var(--gold);
}

.story-card-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  background: var(--gold);
  color: #1a0e00;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
}

.story-card-body {
  padding: 1.2rem 1.3rem;
}

.story-card-cat {
  font-size: 0.8rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-bottom: 0.4rem;
  display: block;
}

.story-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  color: var(--white);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.story-card-title a { color: inherit; }
.story-card-title a:hover { color: var(--primary-h); }

.story-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 0.8rem;
}

.story-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-size: 0.82rem;
  color: var(--text-dim);
  align-items: center;
}

.story-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.story-card-meta .author { color: var(--text-muted); }
.story-card-meta .author:hover { color: var(--primary); }

/* Stars */
.stars {
  display: inline-flex;
  gap: 1px;
  color: var(--gold);
  font-size: 0.9rem;
}

.stars .empty { color: var(--text-dim); }

/* ===== GRID ===== */
.stories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.2rem;
}

.stories-list .story-card {
  display: grid;
  grid-template-columns: 1fr;
}

/* ===== SIDEBAR ===== */
.sidebar-widget {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  margin-bottom: 1.5rem;
}

.sidebar-widget h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  transition: var(--trans);
}

.tag:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ===== STORY READER ===== */
.story-reader {
  max-width: 780px;
  margin: 0 auto;
}

.story-header {
  margin-bottom: 2rem;
}

.story-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 1rem;
  font-style: italic;
}

.story-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.story-content {
  font-size: 1.15rem;
  line-height: 1.85;
  color: #d4c9cc;
}

.story-content p { margin-bottom: 1.4em; }

.story-content p:first-letter {
  font-size: 3.2em;
  font-family: 'Playfair Display', serif;
  float: left;
  line-height: 0.75;
  margin: 0.1em 0.12em 0 0;
  color: var(--primary);
}

.story-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 2rem 0;
}

/* ===== RATING WIDGET ===== */
.rating-widget {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  margin: 2rem 0;
}

.rating-stars-input {
  display: flex;
  gap: 4px;
  flex-direction: row-reverse;
  justify-content: flex-end;
}

.rating-stars-input input { display: none; }

.rating-stars-input label {
  font-size: 2rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.1s;
}

.rating-stars-input input:checked ~ label,
.rating-stars-input label:hover,
.rating-stars-input label:hover ~ label {
  color: var(--gold);
}

/* ===== KOMENTARZE ===== */
.comments-section { margin-top: 3rem; }

.comment {
  display: flex;
  gap: 1rem;
  padding: 1.2rem 0;
  border-bottom: 1px solid var(--border);
}

.comment-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg3);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  color: var(--primary);
}

.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }

.comment-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}

.comment-meta .author { color: var(--text); font-weight: 600; }

.comment-text { font-size: 0.97rem; line-height: 1.6; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 1.3rem; }

.form-label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-family: 'Crimson Pro', serif;
  font-size: 1rem;
  outline: none;
  transition: var(--trans);
}

.form-control:focus {
  border-color: var(--primary);
  background: var(--bg3);
  box-shadow: 0 0 0 3px rgba(196, 30, 58, 0.15);
}

.form-control::placeholder { color: var(--text-dim); }

textarea.form-control { min-height: 200px; resize: vertical; }

.form-error {
  color: #ff6b7a;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.form-hint {
  color: var(--text-dim);
  font-size: 0.83rem;
  margin-top: 0.3rem;
}

/* ===== FLASH ===== */
.flash {
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.95rem;
  border-left: 4px solid;
}

.flash-success { background: #0d2e1a; border-color: #2a7a4a; color: #5dd99b; }
.flash-error   { background: #2e0d14; border-color: #8b1528; color: #f56680; }
.flash-warning { background: #2e1d00; border-color: #7a5000; color: #e09b3a; }
.flash-info    { background: #0d1e2e; border-color: #1a4f7a; color: #5aaddd; }

/* ===== BADGES ===== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-primary { background: var(--primary); color: white; }
.badge-gold    { background: var(--gold); color: #1a0e00; }
.badge-muted   { background: var(--bg3); color: var(--text-muted); border: 1px solid var(--border); }
.badge-green   { background: #0d2e1a; color: #5dd99b; }
.badge-red     { background: #2e0d14; color: #f56680; }
.badge-yellow  { background: #2e1d00; color: #e09b3a; }

/* ===== AUTHOR CARD ===== */
.author-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
}

.author-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border2);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--primary);
}

.author-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--bg2) 0%, var(--bg3) 50%, var(--bg2) 100%);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 50% 100%, rgba(196, 30, 58, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  margin-bottom: 0.8rem;
  background: linear-gradient(135deg, var(--white) 60%, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.hero-stat {
  text-align: center;
}

.hero-stat strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem;
  color: var(--primary);
}

.hero-stat span {
  font-size: 0.85rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

/* ===== SECTION TITLE ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.2rem;
}

.section-title {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-family: 'Crimson Pro', serif;
  font-weight: 600;
}

.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 1em;
  background: var(--primary);
  margin-right: 0.6rem;
  vertical-align: middle;
}

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-col h4 {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.footer-col a {
  display: block;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
}

.footer-col a:hover { color: var(--primary); }

.footer-bottom {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.82rem;
}

@media (max-width: 768px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .header-inner { flex-wrap: wrap; }
  .header-search { max-width: 100%; order: 3; flex: 0 0 100%; }
}

@media (max-width: 480px) {
  .footer-inner { grid-template-columns: 1fr; }
  .stories-grid { grid-template-columns: 1fr; }
}

/* ===== UTILS ===== */
.text-center { text-align: center; }
.text-muted  { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.divider {
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-dim);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-in {
  animation: fadeInUp 0.4s ease both;
}

/* ===== ADMIN ===== */
.admin-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 60px);
}

.admin-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
}

.admin-sidebar a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  transition: var(--trans);
  border-left: 3px solid transparent;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
  color: var(--white);
  background: var(--bg3);
  border-left-color: var(--primary);
}

.admin-content {
  padding: 2rem;
  overflow: hidden;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.2rem;
  text-align: center;
}

.stat-card .num {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  color: var(--primary);
  display: block;
}

.stat-card .label {
  font-size: 0.82rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.table th {
  text-align: left;
  padding: 0.7rem 1rem;
  background: var(--bg3);
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.table tr:hover td { background: rgba(255,255,255,0.02); }

.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ===== EDITOR ===== */
.editor-toolbar {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  padding: 0.6rem;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
}

.editor-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--trans);
}

.editor-btn:hover {
  background: var(--bg2);
  border-color: var(--border);
  color: var(--white);
}

#editor-area {
  border-radius: 0 0 var(--radius) var(--radius);
  min-height: 400px;
}

/* ===== PANEL UŻYTKOWNIKA ===== */
.user-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.user-tab {
  padding: 0.8rem 1.4rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-size: 0.95rem;
  transition: var(--trans);
  cursor: pointer;
  text-decoration: none;
}

.user-tab:hover, .user-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-d); }

/* ===== MOBILE NAV ===== */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .mobile-menu-toggle { display: block; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
}

/* ===== NOTIFICATION BELL ===== */
.notif-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--trans);
  text-decoration: none;
}

.notif-btn:hover { border-color: var(--primary); color: var(--primary); }

.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* =============================================================
   MOBILE FIXES — dodane poprawki responsywności
   ============================================================= */

/* === HEADER MOBILE === */
@media (max-width: 768px) {
  .header-inner {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
  }

  .site-logo {
    font-size: 1.2rem;
    flex: 1;
  }

  /* Hamburger pojawia się na mobile */
  .header-nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 1.2rem;
    flex-shrink: 0;
  }

  /* Searchbar na pełną szerokość, drugi rząd */
  .header-search {
    order: 3;
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Nav chowany domyślnie, pojawia się po kliknięciu */
  .header-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    order: 4;
    gap: 0.4rem;
    padding: 0.5rem 0 0.3rem;
    border-top: 1px solid var(--border);
  }

  .header-nav.is-open {
    display: flex;
  }

  .header-nav a {
    width: 100%;
    text-align: center;
    padding: 0.6rem 1rem;
  }

  /* Notif btns w jednym rzędzie na mobile */
  .header-nav-icons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .header-inner { padding: 0.6rem 0.75rem; }
  .site-logo { font-size: 1.1rem; }
}

/* === KAFELKI (STORY CARDS) MOBILE === */

/* minmax(300px) powoduje overflow na małych ekranach — fix: */
@media (max-width: 680px) {
  .stories-grid {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }
}

@media (min-width: 481px) and (max-width: 680px) {
  .stories-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
}

/* Card body padding redukuj na małych */
@media (max-width: 480px) {
  .story-card-body {
    padding: 0.9rem 1rem;
  }

  .story-card-title {
    font-size: 1rem;
  }

  .story-card-excerpt {
    font-size: 0.85rem;
  }

  .story-card-meta {
    gap: 0.5rem;
    font-size: 0.78rem;
  }

  /* Ukryj excerpt na bardzo małych */
  .story-card-excerpt {
    display: none;
  }
}

/* === KATEGORIA NAV MOBILE === */
@media (max-width: 768px) {
  .cat-nav-inner {
    padding: 0 0.5rem;
    gap: 0;
  }

  .cat-nav-inner a {
    padding: 0.65rem 0.75rem;
    font-size: 0.82rem;
    white-space: nowrap;
  }
}

/* === MAIN LAYOUT — sidebar schowany na mobile === */
@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr;
    gap: 1.2rem;
    padding: 1rem 0;
  }

  /* Sidebar idzie na koniec na mobile */
  .sidebar { order: 10; }
}

/* === OPOWIADANIE (treść) MOBILE === */
@media (max-width: 768px) {
  .story-header { padding: 1rem; }
  .story-content { font-size: 1rem; line-height: 1.75; }
  .story-actions { flex-wrap: wrap; gap: 0.5rem; }
  .story-actions .btn { flex: 1; min-width: 100px; text-align: center; }
}

/* === FORMULARZE MOBILE === */
@media (max-width: 600px) {
  .form-card {
    padding: 1.2rem;
    border-radius: var(--radius);
  }

  .form-row {
    flex-direction: column;
    gap: 0.75rem;
  }

  .btn-lg {
    width: 100%;
    text-align: center;
  }
}

/* === PAGINACJA MOBILE === */
@media (max-width: 480px) {
  .pagination {
    gap: 0.25rem;
  }

  .pagination a,
  .pagination span {
    min-width: 34px;
    height: 34px;
    font-size: 0.85rem;
    padding: 0 0.4rem;
  }
}

/* === FOOTER MOBILE === */
@media (max-width: 480px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.5rem;
  }
}

/* === WYZWANIA / GRUPY MOBILE === */
@media (max-width: 680px) {
  .challenge-grid,
  .groups-grid {
    grid-template-columns: 1fr;
  }
}

/* === AUTOR profil MOBILE === */
@media (max-width: 600px) {
  .author-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .author-avatar {
    width: 64px;
    height: 64px;
  }
}

/* === TOUCH — większe obszary klikalne === */
@media (hover: none) and (pointer: coarse) {
  .story-card { cursor: pointer; }

  .btn, .btn-sm {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .notif-btn {
    width: 42px;
    height: 42px;
  }
}

/* Hamburger widoczny tylko mobile */
.header-nav-toggle {
  display: none;
}
@media (max-width: 768px) {
  .header-nav-toggle { display: flex; }
}
