﻿/* ========================================
   CV PREVIEW & PRINT STYLES
   Silnik wyglądu CV (Podgląd + Wydruk).
   Tylko jednostki fizyczne: mm, pt, em!
   ======================================== */

/* ========================================
   2. GLOBAL CONTAINER - Punkt wejścia zmiennych
   ======================================== */
.cv-container {
  font-family: var(--font-family, 'Lato', sans-serif);
  /* Fallback, gdyby C# nie zadziałał */
  --primary-color: #2d3748;
  --font-base: 10pt;
  --line-height: 1.35;
}

/* ========================================
   3. PAPER - Wygląd kartki A4
   ======================================== */
.cv-paper {
  width: 210mm;
  /* background: white; <-- USUNIĘTE, żeby odblokować kreatywność! */
  background-color: var(--bg-color, #ffffff);
  color: var(--text-color, #2d3748);
  padding: var(--margin, 15mm);
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  z-index: 1;
  /* Płynne przejścia kolorów tła */
  transition: background-color 0.3s ease, color 0.3s ease;
}

  .cv-paper.cv-paper--full-bleed {
    padding: 0 !important;
  }

  .cv-paper.show-margins::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: var(--margin, 15mm) solid rgba(255, 107, 53, 0.1);
    pointer-events: none;
    z-index: 10;
  }

/* ========================================
   4. TYPOGRAPHY - Style tekstowe
   ======================================== */
.cv-h1 {
  font-size: calc(var(--font-base) * var(--h1-scale, 2.2));
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 2mm 0;
  color: var(--primary-color);
}

.cv-h2 {
  font-size: calc(var(--font-base) * var(--h2-scale, 1.4));
  font-weight: 300;
  margin: 0 0 5mm 0;
  color: var(--primary-color);
}

.cv-h3 {
  font-size: calc(var(--font-base) * var(--h3-scale, 1.1));
  font-weight: 700;
  margin: 0;
  color: #2d3748;
}

.cv-body {
  font-size: calc(var(--font-base) * var(--body-scale, 1));
  color: #2d3748;
  line-height: var(--line-height, 1.35);
  text-align: justify;
  hyphens: auto; /* Wymusza ładne dzielenie wyrazów w PDF */
}

.cv-section-title {
  font-size: calc(var(--font-base) * var(--h2-scale, 1.4));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5pt;
  color: var(--accent-color);
  margin: 0 0 3mm 0;
  padding-bottom: 1mm;
  /* NASZA MAGIA - NOWE WŁAŚCIWOŚCI Z PANELU */
  font-family: var(--heading-font-family, var(--font-family));
  text-align: var(--heading-align, left);
  transition: text-align 0.3s ease;
}

.cv-section-title--sidebar {
  font-size: calc(var(--font-base) * var(--h3-scale, 1.1));
  margin-bottom: 3mm;
  padding-bottom: 1mm;
  color: var(--accent-color);
  /* NASZA MAGIA DLA PASKA BOCZNEGO */
  font-family: var(--heading-font-family, var(--font-family));
  text-align: var(--heading-align, left);
  transition: text-align 0.3s ease;
}

/* ========================================
   5. LAYOUT - Kontenery sekcji (SCALONE!)
   ======================================== */
.cv-section {
  margin-bottom: 7mm;
}

.cv-entry {
  /* Odstępy */
  margin-bottom: 4mm;
  /* Typografia dla wpisu */
  font-size: calc(var(--font-base) * var(--body-scale, 1));
  color: #2d3748;
  line-height: var(--line-height, 1.35);
}

  .cv-entry:last-child {
    margin-bottom: 0;
  }

.cv-entry__title {
  font-size: calc(var(--font-base) * var(--h3-scale, 1.1));
  color: #2d3748;
  font-weight: 700;
  margin: 0;
}

.cv-entry__meta {
  font-size: calc(var(--font-base) * var(--meta-scale, 0.85));
  color: var(--text-secondary, #718096);
  font-weight: 500;
  font-style: italic;
  margin: 1.5mm 0;
}

.cv-entry-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5mm;
  width: 100%;
}

  .cv-entry-header-row > div {
    line-height: 1; /* Zapobiega uciekaniu linii bazowej w dół przy flexboxie */
  }

/* ========================================
   6. LISTS - Logika punktowania
   ======================================== */
.cv-entry ul {
  list-style: none !important;
  list-style-type: none !important;
  padding: 0;
  margin: 1.5mm 0 0 0;
}

.cv-entry li {
  list-style: none !important;
  list-style-type: none !important;
  position: relative;
  padding-left: var(--list-indent, 5mm);
  margin-bottom: var(--list-item-spacing, 2mm);
}

  .cv-entry li::marker {
    content: none !important;
    display: none !important;
  }

  .cv-entry li::before {
    content: var(--bullet-symbol, '•');
    display: var(--bullet-display, block);
    position: absolute;
    left: 0;
    top: 0.1em;
    font-size: 1.2em;
    font-weight: normal;
    line-height: 1;
    width: 4mm;
    text-align: center;
    color: var(--primary-color);
  }

/* ========================================
   7. EXTRAS - Sidebar, Zdjęcia, Utilities
   ======================================== */
.cv-info-list {
  font-size: calc(var(--font-base) * var(--meta-scale, 0.85));
  color: #2d3748;
  list-style: none;
  padding: 0;
  margin: 0;
  line-height: 1.5;
}

.cv-info-item {
  display: flex;
  align-items: flex-start;
  gap: 1.5mm;
  margin-bottom: 2mm;
}

.cv-icon {
  width: 4mm;
  height: 4mm;
  flex-shrink: 0;
  fill: currentColor;
  /* FILTR GASZĄCY KOLORY IKON */
  filter: var(--icon-filter, none);
  transition: filter 0.3s ease;
}

/* Zdjęcie */
.cv-photo-container {
  margin-bottom: 5mm;
  display: flex;
  justify-content: center;
}

.cv-photo-frame {
  /* NAPRAWA: Szerokość też musi czytać zmienną, żeby zdjęcie było idealnym kwadratem/kołem! */
  width: var(--photo-height, 38mm);
  height: var(--photo-height, 38mm);
  border-radius: var(--photo-radius, 50%);
  overflow: hidden;
  border: 1pt solid #e2e8f0;
  background-color: #f7fafc;
  /* Płynna animacja przy zmianie rozmiaru i kształtu z panelu */
  transition: border-radius 0.3s ease, width 0.3s ease, height 0.3s ease;
}

  .cv-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* NASZA NOWA MAGIA - TRYB CZARNO-BIAŁY */
    filter: var(--photo-filter, grayscale(0%));
    /* Płynne gaśnięcie kolorów */
    transition: filter 0.3s ease;
  }

/* Utilities */
.cv-text-center {
  text-align: center;
}

.cv-text-right {
  text-align: right;
}

.cv-text-justify {
  text-align: justify;
}

.cv-bold {
  font-weight: 700;
}

.cv-italic {
  font-style: italic;
}

.print-rodo-footer {
  display: none;
}
/* ========================================
   8. PRINT & PDF GENERATION (Gotenberg Rules)
   ======================================== */
@media print {
  /* 🔥 OCHRONA TEŁ I GRADIENTÓW PRZED GOTENBERGIEM */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  @page {
    margin: 0;
    margin-bottom: 18mm;
  }

  body, .viewport-background {
    background: white !important;
    margin: 0;
  }

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

  .cv-container {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .cv-paper {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

    /* Usunięcie widocznej ramki marginesów na wydruku */
    .cv-paper.show-margins::before {
      display: none !important;
    }

  .cv-entry {
    break-inside: avoid;
  }

  .cv-info-item {
    break-inside: avoid;
  }

  .cv-section-title {
    break-after: avoid;
  }

  .print-rodo-footer {
    display: block !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 7pt;
    color: #6b7280;
    line-height: 1.0;
    padding: 2mm 15mm 4mm 15mm;
  }
}

/* ========================================
   9. TEMPLATE MODERN
   ======================================== */
.template-modern-scope {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 100%;
}

.template-header {
  padding-top: var(--margin);
  padding-left: var(--margin);
  padding-right: var(--margin);
  padding-bottom: 5mm;
  transition: background 0.3s ease, color 0.3s ease;
}

.template-body {
  flex-grow: 1;
  padding: 0;
}

.template-layout {
  display: flex;
  flex-direction: row;
  height: 100%;
}

.template-sidebar {
  width: var(--sidebar-width, 30%);
  background-color: transparent; /* ZMIENIONE Z WHITE! */
  padding-left: var(--margin);
  padding-bottom: var(--margin);
  padding-top: 5mm;
  padding-right: 5mm;
  flex-shrink: 0;
  box-sizing: border-box;
  border-right: 1pt solid #e0e0e0;
  transition: width 0.1s linear;
}

.template-content {
  flex-grow: 1;
  background-color: transparent; /* ZMIENIONE Z WHITE! */
  padding-right: var(--margin);
  padding-bottom: var(--margin);
  padding-top: 5mm;
  padding-left: 8mm;
  box-sizing: border-box;
}

  .template-content .cv-section-title {
    color: var(--primary-color);
  }
