:root {
  --spacing: 2rem;
  --bg-color: #f4f7f6;
  --text-color: #333;
  --accent-color: #2c3e50;
  --border-radius: 8px;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 60px; /* fallback – nadpisywane przez JS */
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  margin: 0;
  padding: 0;
}

header {
  background-color: var(--accent-color);
  color: white;
  padding: 3rem 1rem;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
  margin-bottom: 1.5rem;
  font-size: 2.5rem;
}

nav {
  background-color: #2c3e50;
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.5rem 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

nav ul {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

nav li {
  margin: 0;
}

nav a {
  color: white;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  transition: background 0.2s;
}

nav a:hover {
  background-color: #34495e;
  text-decoration: none;
}

main {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1rem;
}

section {
  background: white;
  padding: 2.5rem;
  margin-bottom: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  scroll-margin-top: 60px; /* fallback – nadpisywane przez scroll-padding-top */
}

section h2 {
  color: var(--accent-color);
  border-bottom: 3px solid #3498db;
  padding-bottom: 0.5rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
}

li {
  margin-bottom: 0.8rem;
}

a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: #2980b9;
  text-decoration: underline;
}

footer {
  text-align: center;
  padding: 2rem;
  background: var(--accent-color);
  color: white;
  margin-top: 4rem;
}

@media (max-width: 768px) {
  main {
    margin: 1rem;
  }
  header h1 {
    font-size: 1.8rem;
  }
}

/* Scroll to Top Button */
#scrollTopBtn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99;
  font-size: 1.5rem;
  border: none;
  outline: none;
  background-color: var(--accent-color);
  color: white;
  cursor: pointer;
  padding: 10px 18px;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s, background-color 0.3s, opacity 0.3s;
  opacity: 0.8;
}

#scrollTopBtn:hover {
  background-color: #34495e;
  transform: translateY(-5px);
  opacity: 1;
}

/* Styles for login form */
.login-container {
  max-width: 400px;
  margin: 50px auto;
  padding: 30px;
  background: #f9f9f9;
  border: 1px solid #ddd;
  border-radius: 8px;
}
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}
.form-group input {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.btn {
  padding: 12px 15px;
  background-color: #007bff;
  color: white;
  border: none;
  cursor: pointer;
  width: 100%;
  border-radius: 4px;
  font-size: 16px;
}
.btn:hover {
  background-color: #0056b3;
}

/* ===================================================
   DARK MODE
   Stosowany przez atrybut data-theme="dark" na <html>
   =================================================== */

/* Płynne przejścia dla wszystkich kluczowych elementów */
body, header, nav, section, article, footer,
.edit-container, .login-container, input, textarea {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html[data-theme="dark"] {
  --bg-color:     #0f172a;
  --text-color:   #e2e8f0;
  --accent-color: #0d1117;
}

html[data-theme="dark"] body {
  background-color: #0f172a;
  color: #e2e8f0;
}

html[data-theme="dark"] header {
  background-color: #0d1117;
}

html[data-theme="dark"] nav {
  background-color: #0d1117;
}

html[data-theme="dark"] nav a {
  color: #94a3b8;
}

html[data-theme="dark"] nav a:hover {
  background-color: #1e293b;
  color: #f1f5f9;
}

html[data-theme="dark"] section {
  background: #1e293b;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] section h2 {
  color: #7dd3fc;
  border-bottom-color: #3b82f6;
}

html[data-theme="dark"] a {
  color: #60a5fa;
}

html[data-theme="dark"] a:hover {
  color: #93c5fd;
}

html[data-theme="dark"] footer {
  background: #0d1117;
}

/* Strona logowania */
html[data-theme="dark"] .login-container {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .form-group label {
  color: #94a3b8;
}

html[data-theme="dark"] .form-group input {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

/* Strona edycji */
html[data-theme="dark"] .edit-container {
  background: #1e293b;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

html[data-theme="dark"] .edit-container h2 {
  color: #7dd3fc;
}

html[data-theme="dark"] .edit-container .form-group label {
  color: #94a3b8;
}

html[data-theme="dark"] .edit-container .form-group input {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #334155;
}

/* Komunikaty sukcesu / błędu */
html[data-theme="dark"] [style*="color: #28a745"] {
  background: #14532d !important;
}

html[data-theme="dark"] [style*="color: #dc3545"] {
  background: #450a0a !important;
}

/* Przycisk przełączania motywu */
#themeToggleBtn {
  position: absolute;
  top: 15px;
  right: 140px;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.12);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

#themeToggleBtn:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.12);
}

/* Przyciski akcji w headerze (Zaloguj / Wyloguj) */
.header-action-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  padding: 8px 15px;
  background-color: rgba(255, 255, 255, 0.12);
  color: white;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: inline-block;
  transition: background-color 0.2s, transform 0.2s;
}

.header-action-btn:hover {
  background-color: rgba(255, 255, 255, 0.25);
  color: white;
  text-decoration: none;
  transform: scale(1.05);
}
