/* ─────────────────────────────────────────────
   Śmieciarka — style.css
   ───────────────────────────────────────────── */

/* ── Reset & base ──────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Palette */
  --bg:          #f8f9fc;
  --surface:     #ffffff;
  --surface2:    #f4f6fa;
  --border:      #e8ecf2;
  --border-focus:#c7d0df;

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.11), 0 4px 12px rgba(0,0,0,.06);

  /* Radii */
  --radius:    18px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* Typography */
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Motion */
  --ease:       cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 0.18s var(--ease);
  --transition-slow: 0.35s var(--ease);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ────────────────────────────────── */
.page-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 64px;
}

/* ── Header ────────────────────────────────── */
.site-header {
  text-align: center;
  padding: 56px 20px 36px;
}

.site-header .logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
}

.logo-svg {
  width: 44px;
  height: 36px;
}

/* Legacy fallback — old .logo span */
.site-header .logo {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 8px;
  display: block;
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1.15;
}

.site-header .subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.01em;
}

.meta-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.meta-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.meta-chip:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
}

/* ── Error ─────────────────────────────────── */
#error {
  background: #fff4f4;
  border: 1px solid #fcd3d3;
  border-radius: var(--radius);
  padding: 28px 32px;
  text-align: center;
  color: #b91c1c;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
}

#error .error-detail {
  font-size: 0.8rem;
  margin-top: 8px;
  font-family: var(--font-mono);
  opacity: 0.65;
  color: var(--text-secondary);
}

/* ── Placeholder warning ───────────────────── */
.placeholder-warning {
  background: var(--surface);
  border: 1.5px dashed var(--border-focus);
  border-radius: var(--radius);
  padding: 56px 40px;
  text-align: center;
  margin: 28px 0;
}

.placeholder-warning .ph-icon {
  font-size: 2.6rem;
  display: block;
  margin-bottom: 18px;
}

.placeholder-warning h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.placeholder-warning p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.75;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
}

.placeholder-warning code {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.83em;
  font-family: var(--font-mono);
}

.placeholder-warning a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--text-primary);
  color: white;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  transition: opacity var(--transition), transform var(--transition);
  letter-spacing: 0.01em;
}

.placeholder-warning a:hover {
  opacity: 0.84;
  transform: translateY(-1px);
}

/* ── Section titles ────────────────────────── */
.section-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

/* ── Week section ──────────────────────────── */
.week-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px 26px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.week-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.week-item:last-child {
  border-bottom: none;
}

.week-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.week-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.week-info strong {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.week-info span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── Cards grid ────────────────────────────── */
.cards-section {
  margin-bottom: 28px;
}

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

/* ── Single card ───────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow var(--transition-slow),
    transform var(--transition-slow),
    border-color var(--transition);
  position: relative;
  overflow: hidden;
}

/* Accent line on top */
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-color);
  opacity: 0.8;
  border-radius: var(--radius) var(--radius) 0 0;
}

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

/* ── Urgency states ────────────────────────── */
.card.status-today {
  border-color: #ef444450;
  box-shadow: 0 0 0 3px #ef444418, var(--shadow-md);
  animation: pulse-ring 2.4s ease-in-out infinite;
}

.card.status-tomorrow {
  border-color: #f59e0b44;
}

@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 3px #ef444418, var(--shadow-md); }
  50%       { box-shadow: 0 0 0 7px #ef444408, var(--shadow-md); }
}

/* Card header */
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.card-icon {
  width: 44px;
  height: 44px;
  background: var(--card-color-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.card-title {
  flex: 1;
  min-width: 0;
}

.card-title h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.card-sublabel {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Card countdown */
.card-countdown {
  margin-bottom: 16px;
}

.urgency-badge {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--card-color);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.status-today    .urgency-badge { color: #dc2626; }
.status-tomorrow .urgency-badge { color: #d97706; }
.status-unknown  .urgency-badge { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }

.next-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

/* Progress bar */
.progress-wrap {
  background: var(--border);
  border-radius: 100px;
  height: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar {
  height: 100%;
  background: var(--card-color);
  border-radius: 100px;
  transition: width 0.7s var(--ease);
  opacity: 0.75;
}

.progress-label {
  font-size: 0.71rem;
  color: var(--text-muted);
  margin-bottom: 14px;
  letter-spacing: 0.01em;
}

/* Upcoming details */
.upcoming-details {
  border-top: 1px solid var(--border);
  padding-top: 13px;
  margin-top: 2px;
}

.upcoming-details summary {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color var(--transition);
}

.upcoming-details summary:hover {
  color: var(--text-primary);
}

.upcoming-details summary::before {
  content: '›';
  font-size: 1rem;
  font-weight: 700;
  transition: transform var(--transition);
  line-height: 1;
  color: var(--text-muted);
}

.upcoming-details[open] summary::before {
  transform: rotate(90deg);
}

.upcoming-details summary::-webkit-details-marker {
  display: none;
}

.upcoming-list {
  list-style: none;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.upcoming-list li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--card-color);
  opacity: 0.85;
}

/* ── Fade-in animations ────────────────────── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.site-header {
  animation: fade-up 0.5s var(--ease) both;
}

.week-section {
  animation: fade-up 0.45s var(--ease) 0.05s both;
}

.card {
  animation: fade-up 0.4s var(--ease) both;
}

.cards-grid .card:nth-child(1) { animation-delay: 0.08s; }
.cards-grid .card:nth-child(2) { animation-delay: 0.14s; }
.cards-grid .card:nth-child(3) { animation-delay: 0.20s; }
.cards-grid .card:nth-child(4) { animation-delay: 0.26s; }

/* Respect user preference for reduced motion */
@media (prefers-reduced-motion: reduce) {
  .site-header,
  .week-section,
  .card {
    animation: none;
  }
}

/* ── Footer ────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: 28px 20px;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
  margin-top: 8px;
  letter-spacing: 0.01em;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color var(--transition), border-color var(--transition);
}

.site-footer a:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.footer-sep {
  display: inline-block;
  margin: 0 10px;
  color: var(--border-focus);
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 600px) {
  .site-header {
    padding: 36px 16px 28px;
  }

  .site-header h1 {
    font-size: 1.6rem;
  }

  .site-header .logo-wrap {
    width: 60px;
    height: 60px;
  }

  .logo-svg {
    width: 38px;
    height: 31px;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .week-section,
  .card {
    padding: 16px 18px;
  }

  .meta-bar {
    gap: 6px;
  }

  .page-wrapper {
    padding: 0 14px 48px;
  }
}

/* ── Dark Mode ─────────────────────────────── */
/* Applied via [data-theme="dark"] on <html> (JS toggle) */
/* Falls back to system preference when no manual choice is stored */

[data-theme="dark"],
:root:not([data-theme="light"]) {
  /* overridden below per-source */
}

/* System default dark (no manual override) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0d1117;
    --surface:     #161b22;
    --surface2:    #0d1117;
    --border:      #21262d;
    --border-focus:#30363d;

    --text-primary:   #e6edf3;
    --text-secondary: #8b949e;
    --text-muted:     #6e7681;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 1px 4px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.7), 0 4px 12px rgba(0,0,0,.4);
  }

  :root:not([data-theme="light"]) .card::before        { opacity: 0.55; }
  :root:not([data-theme="light"]) .card.status-today   { border-color: #ef444430; box-shadow: 0 0 0 3px #ef444412, var(--shadow-md); }
  :root:not([data-theme="light"]) .progress-bar        { opacity: 0.6; }
  :root:not([data-theme="light"]) .card-icon           { opacity: 0.9; }
}

/* Manually forced dark */
[data-theme="dark"] {
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface2:    #0d1117;
  --border:      #21262d;
  --border-focus:#30363d;

  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #6e7681;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.7), 0 4px 12px rgba(0,0,0,.4);
}

[data-theme="dark"] .card::before        { opacity: 0.55; }
[data-theme="dark"] .card.status-today   { border-color: #ef444430; box-shadow: 0 0 0 3px #ef444412, var(--shadow-md); }
[data-theme="dark"] .progress-bar        { opacity: 0.6; }
[data-theme="dark"] .card-icon           { opacity: 0.9; }

/* ── Language toggle button ─────────────────── */
.lang-toggle {
  position: fixed;
  top: 16px;
  right: 112px;
  z-index: 100;

  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-secondary);
  letter-spacing: 0.03em;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.lang-toggle:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: scale(1.08);
  color: var(--text-primary);
}

.lang-toggle:active {
  transform: scale(0.94);
}

/* ── Theme toggle button ───────────────────── */
.theme-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;

  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.theme-toggle:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: scale(1.08);
}

.theme-toggle:active {
  transform: scale(0.94);
}

/* Icon swap via CSS — show correct icon per theme */
.theme-toggle .icon-light { display: none; }
.theme-toggle .icon-dark  { display: block; }

[data-theme="dark"] .theme-toggle .icon-light { display: block; }
[data-theme="dark"] .theme-toggle .icon-dark  { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-light { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-dark  { display: none; }
}

/* ── Notifications toggle button ────────────── */
.notifications-toggle {
  position: fixed;
  top: 16px;
  right: 64px;
  z-index: 100;

  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;

  transition:
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.notifications-toggle:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-md);
  transform: scale(1.08);
}

.notifications-toggle:active {
  transform: scale(0.94);
}

/* Icon swap — show correct icon per state */
.notifications-toggle .icon-off { display: block; }
.notifications-toggle .icon-on  { display: none; }

.notifications-toggle.notifications-enabled .icon-off { display: none; }
.notifications-toggle.notifications-enabled .icon-on  { display: block; }

/* Smooth theme transition on body */
body {
  transition:
    background-color 0.25s var(--ease),
    color 0.25s var(--ease);
}
