/* =========================
   Design tokens (root) – LIGHT TITANIUM / GRAPHITE / STEEL
   ========================= */
:root {
  /* Kolory tła */
  --bg-body-mobile: linear-gradient(180deg, #f5f7fa 0%, #eef2f7 40%, #e3e8f0 100%);
  --bg-body-tablet: linear-gradient(180deg, #f3f4f6 0%, #e5e7eb 40%, #dde2eb 100%);
  --bg-container: #f9fafb;          /* jasny tytan */
  --bg-panel: #ffffff;              /* biały / stal polerowana */

  /* Kolory brand – jasne szarości */
  --brand-primary: #4b5563;         /* średni grafit */
  --brand-primary-dark: #374151;    /* ciemniejsza stal */
  --brand-secondary: #6b7280;       /* stalowy szary */
  --brand-secondary-strong: #111827;/* akcent – ciemny grafit */

  /* Akcenty / stany */
  --accent-success: #2563eb;        /* niebieski zamiast seledynu */
  --accent-error: #dc2626;
  --accent-error-text: #7f1d1d;

  /* Szarości / tekst */
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-result: #111827;
  --border-subtle: #e5e7eb;

  /* Tła sekcji */
  --bg-timestamp: rgba(148, 163, 184, 0.25);
  --bg-result-header-from: #e5f0ff;
  --bg-result-header-to: #e5ecff;   /* jasny błękit, bez seledynu */
  --bg-error-from: #fee2e2;
  --bg-error-to: #fecaca;
  --bg-footer: #f3f4f6;

  /* Layout / spacing */
  --container-max-width-tablet: 768px;
  --container-max-width-desktop: 960px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 40px;
  --space-5xl: 60px;

  /* Promienie */
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 999px;

  /* Cienie – lekkie */
  --shadow-header: 0 10px 30px rgba(148, 163, 184, 0.35);
  --shadow-container-tablet: 0 16px 40px rgba(148, 163, 184, 0.35);
  --shadow-container-desktop: 0 20px 50px rgba(148, 163, 184, 0.4);
  --shadow-card: 0 10px 24px rgba(148, 163, 184, 0.35);
  --shadow-error: 0 10px 24px rgba(248, 113, 113, 0.5);
  --shadow-btn: 0 12px 30px rgba(148, 163, 184, 0.5);
  --shadow-btn-hover: 0 16px 40px rgba(148, 163, 184, 0.6);

  /* Typografia – fluidowa */
  --font-base: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
  --font-size-xs: clamp(0.72rem, 0.68rem + 0.1vw, 0.75rem);
  --font-size-sm: clamp(0.82rem, 0.78rem + 0.15vw, 0.9rem);
  --font-size-md: clamp(0.9rem, 0.86rem + 0.18vw, 1rem);
  --font-size-base: clamp(0.96rem, 0.9rem + 0.22vw, 1.05rem);
  --font-size-lg: clamp(1.08rem, 1.02rem + 0.25vw, 1.2rem);
  --font-size-xl: clamp(1.6rem, 1.4rem + 0.8vw, 2.1rem);

  --line-height-base: 1.6;
  --line-height-relaxed: 1.7;

  /* Animacje */
  --transition-fast: 0.16s ease-out;
  --transition-base: 0.25s ease-out;

 /* Inne */

  --color-denim-dark: #63737c; /* ciemny denim / navy */

}

/* =========================
   Global reset
   ========================= */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-base);
  background: var(--bg-body-mobile);
  min-height: 100vh;
  color: var(--text-main);
  font-size: 16px;
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}

/* =========================
   Layout
   ========================= */
.container {
  max-width: 100%;
  margin: 0;
  background: var(--bg-container);
  min-height: 100vh;
  position: relative;
}

.main-content {
  padding: var(--space-xl) var(--space-lg);
  padding-bottom: 96px;
}

/* Very small screens */
@media (max-width: 374px) {
  .main-content {
    padding-inline: var(--space-sm);
  }

  .header {
    padding-inline: var(--space-md);
  }
}

/* =========================
Kalendarz
========================= */
.calendar-container {
  z-index: 10;
}

.calendar-button {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: 999px;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--brand-secondary-strong);
  padding: var(--space-xs) var(--space-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
  box-shadow: 0 8px 20px rgba(148, 163, 184, 0.6);
}

.calendar-button:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 12px 28px rgba(148, 163, 184, 0.7);
  background: #ffffff;
  border-color: rgba(107, 114, 128, 0.9);
}

/* Ukrycie natywnej ikonki date-picker na wspieranych przeglądarkach */
.calendar-input {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.calendar-input::-webkit-calendar-picker-indicator {
  opacity: 0;
  display: none;
}

/* =========================
Nagłówek
========================= */
.header {
  background: radial-gradient(circle at top left, rgba(191, 219, 254, 0.7), transparent 60%),
              linear-gradient(135deg, #ffffff 0%, #f3f4f6 60%, #e5e7eb 100%);
  color: #111827;
  padding: var(--space-xl) var(--space-lg);
  box-shadow: var(--shadow-header);
  position: relative;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  border-bottom: 1px solid rgba(209, 213, 219, 0.9);

  /* nowy layout na mobile */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  text-align: center;
}

.header-top {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-family: "Playfair Display", "Georgia", serif;
  font-size: var(--font-size-xl);
  font-weight: 600;
  margin: 0 0 var(--space-sm);
  letter-spacing: 0.02em;
  color: var(--color-denim-dark);
  text-transform: none;
}

.header p {
  font-size: var(--font-size-md);
  opacity: 0.9;
  font-weight: 400;
}

/* na mobile: elementy w normalnym przepływie */
.calendar-container,
.lang-switcher {
  position: static;
}

/* mały odstęp pod ikonami na mobile */
.calendar-container,
.lang-switcher {
  margin-bottom: var(--space-xs);
}

/* =========================
Przełącznik języka
========================= */
.lang-switcher {
  z-index: 9;
  font-size: var(--font-size-sm);
  display: inline-flex;
  gap: var(--space-xs);
  padding: var(--space-xs);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(209, 213, 219, 0.9);
}


.lang-switcher a {
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 999px;
  transition: background var(--transition-base), color var(--transition-base), transform var(--transition-fast);
}

.lang-switcher a:hover {
  background: rgba(229, 231, 235, 0.9);
  transform: translateY(-1px);
}

.lang-switcher .active {
  color: var(--accent-success) !important;
  font-weight: 600;
  background: rgba(219, 234, 254, 0.9); /* niebieskawy highlight */
}

.lang-switcher .inactive {
  color: rgba(75, 85, 99, 0.9);
  font-weight: 400;
}

/* =========================
   Timestamp / meta
   ========================= */
.timestamp {
  background: var(--bg-timestamp);
  color: var(--brand-secondary-strong);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 500;
  margin-bottom: var(--space-xl);
  border-left: 3px solid rgba(107, 114, 128, 0.9);
}

/* =========================
   Wynik / odpowiedź
   ========================= */
.result-container {
  background: var(--bg-panel);
  border-radius: var(--radius-lg);
  margin-top: var(--space-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  border: 1px solid rgba(229, 231, 235, 0.95);
}

.result-header {
  background: linear-gradient(120deg, var(--bg-result-header-from) 0%, var(--bg-result-header-to) 100%);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid rgba(209, 213, 219, 0.9);
}

.result-title {
  font-size: var(--font-size-lg);
  color: var(--brand-primary-dark);
  font-weight: 500;
  display: flex;
  align-items: center;
}

.result-title::before {
  content: "📰";
  margin-right: var(--space-sm);
  font-size: 1.2rem;
}

.doc-response {
  font-size: var(--font-size-base);
  line-height: var(--line-height-relaxed);
  color: var(--text-result);
  padding: var(--space-2xl) var(--space-xl);
  white-space: normal;
  word-wrap: break-word;
  letter-spacing: 0.01em;
}

.doc-response p {
  margin: 0 0 0.35em 0; /* niewielki odstęp między zwykłymi liniami */
}

.doc-response .doc-empty-line {
  margin: 0 0 0.8em 0;  /* większa przerwa dla pustych linii */
}

/* Nagłówki generowane z #, ##, *, ** itd. */
.doc-response .doc-center-heading {
    text-align: center;
  font-weight: 500;  /* było 600 */
  margin: 0.4em 0;
}


/* =========================
   Błędy
   ========================= */
.error-message {
  background: linear-gradient(145deg, var(--bg-error-from) 0%, var(--bg-error-to) 100%);
  color: var(--accent-error-text);
  padding: var(--space-xl);
  border-radius: var(--radius-lg);
  margin-top: var(--space-xl);
  border-left: 4px solid var(--accent-error);
  box-shadow: var(--shadow-error);
}

.error-message h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-md);
  font-weight: 600;
}

.error-message p {
  margin-bottom: var(--space-sm);
  line-height: var(--line-height-base);
}

.error-message ul {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}

.error-message li {
  margin-bottom: var(--space-sm);
}

/* =========================
   Przycisk odświeżania
   ========================= */
.refresh-btn {
  background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 50%, #e5e7eb 100%);
  color: var(--brand-secondary-strong);
  border: 1px solid rgba(148, 163, 184, 0.9);
  padding: var(--space-2xl) var(--space-3xl);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-base);
  font-weight: 500;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base), border-color var(--transition-base);
  margin-top: var(--space-2xl);
  box-shadow: var(--shadow-btn);
  width: min(100%, 320px);
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.refresh-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn-hover);
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
  border-color: rgba(107, 114, 128, 0.95);
}

.refresh-btn:active {
  transform: translateY(0);
}

/* =========================
   Stopka
   ========================= */
.footer {
  background: var(--bg-footer);
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-lg) var(--space-lg);
  font-size: var(--font-size-sm);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid rgba(209, 213, 219, 0.9);
}

/* Przy niskich wysokościach ekranu odklejamy stopkę */
@media (max-height: 640px) {
  .footer {
    position: static;
  }
}

/* =========================
   Stany ładowania / brak danych
   ========================= */
.loading {
  text-align: center;
  padding: var(--space-5xl) var(--space-xl);
}

.spinner {
  border: 3px solid #e5e7eb;
  border-top: 3px solid var(--brand-secondary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto var(--space-xl);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.no-data {
  text-align: center;
  padding: var(--space-5xl) var(--space-xl);
  color: var(--text-muted);
}

/* =========================
   Media queries – responsywność
   ========================= */

@media (max-width: 374px) {
  .header {
    padding-block: var(--space-lg);
    gap: var(--space-xs);
  }
}

/* Małe telefony w poziomie */
@media (max-width: 480px) and (orientation: landscape) {
  .main-content {
    padding-block: var(--space-lg);
    padding-inline: var(--space-md);
  }

  .header {
    padding-block: var(--space-lg);
  }
}

/* Tablet */
@media (min-width: 768px) {
  body {
    background: var(--bg-body-tablet);
  }

  .container {
    max-width: var(--container-max-width-tablet);
    margin: var(--space-4xl) auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-container-tablet);
    overflow: hidden;
    border: 1px solid rgba(209, 213, 219, 0.9);
  }

  .main-content {
    padding: var(--space-3xl);
    padding-bottom: 110px;
  }

  .header {
    /* wracamy do „blokowego” nagłówka, padding jak miałeś */
    display: block;
    padding: var(--space-3xl);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .calendar-container {
    position: absolute;
    top: 18px;
    left: 16px;
  }

  .lang-switcher {
    position: absolute;
    top: 18px;
    right: 18px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    max-width: var(--container-max-width-desktop);
    margin: var(--space-5xl) auto;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-container-desktop);
  }

  .header {
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  }

  .footer {
    position: static;
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  }
}

/* Większe desktopy */
@media (min-width: 1440px) {
  .container {
    max-width: 1040px;
  }

  .main-content {
    padding-inline: var(--space-4xl);
  }
}
