/* ===== GOVERIS THEME VARIABLES ===== */
:root {
  --main-bg: linear-gradient(to right, #111111, #5c1d4e, #792c78, #df0e9a);
  --main-light-color: #df0e9a;
  --main-white: #f8f9fa;
  --main-dark-color: #111111;
  --main-dark-color-secondary: #5c1d4e;
  --secondary-bg: linear-gradient(
    135deg,
    var(--main-dark-color) 0%,
    var(--main-dark-color-secondary) 100%
  );
}

/* ===== BODY & MAIN LAYOUT ===== */
body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--secondary-bg);
  color: var(--main-white);
  min-height: 100vh;
}

/* ===== GŁÓWNY KONTENER ===== */
.main-container {
  max-width: 2000px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 20px;
}

/* ===== NAGŁÓWEK SEKCJI ===== */
.header {
  text-align: center;
  margin-top: 15px;
}

.header h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  background: linear-gradient(
    45deg,
    var(--main-light-color),
    var(--main-white)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(223, 14, 154, 0.5);
}

.header p {
  font-size: 1.2rem;
  opacity: 0.9;
  color: var(--main-white);
}

/* ===== KARTA Z WYRAŹNYM TŁEM ===== */
.card {
  background: rgba(255, 255, 255, 0.12) !important;
  border: 2px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 20px !important;
  backdrop-filter: blur(15px);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(223, 14, 154, 0.2) inset;
  transition: all 0.3s ease;
  overflow: hidden;
}

.card:hover {
  border-color: var(--main-light-color) !important;
  box-shadow: 0 30px 80px rgba(223, 14, 154, 0.3),
    0 0 0 2px rgba(223, 14, 154, 0.3) inset;
  background: rgba(255, 255, 255, 0.15) !important;
}

.card-body {
  background: transparent !important;
  color: var(--main-white) !important;
  padding: 40px !important;
}

/* ===== TABELA PEŁNEJ SZEROKOŚCI NA DESKTOPACH ===== */
.table-responsive {
  border: 3px solid rgba(223, 14, 154, 0.3);
  border-radius: 15px;
  background: rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 4px 15px rgba(0, 0, 0, 0.5);
}

#tableprezentacje.table {
  color: var(--main-white);
  background: transparent;
  margin-bottom: 0;
  border-collapse: separate;
  border-spacing: 0;
  width: 100% !important;
  border: none !important;
}

/* DESKTOP - tabela bez scroll'a */
@media (min-width: 992px) {
  .table-responsive {
    overflow-x: hidden; /* Usuwa poziomy scroll */
    width: 100%;
  }

  #tableprezentacje {
    table-layout: fixed; /* Wymusza równomierne kolumny */
    font-size: 0.82rem; /* Mniejsza czcionka na desktopach */
  }

  /* Nagłówki z mniejszymi paddingami */
  #tableprezentacje thead th {
    padding: 12px 8px;
    font-size: 0.8rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Komórki z mniejszymi paddingami */
  #tableprezentacje tbody td {
    padding: 10px 8px;
    font-size: 0.78rem;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Optymalne szerokości kolumn */
  #tableprezentacje th:nth-child(1),  /* Checkbox */
  #tableprezentacje td:nth-child(1) {
    width: 3%;
    min-width: 35px;
    text-align: center;
  }

  #tableprezentacje th:nth-child(2),  /* Kategoria */
  #tableprezentacje td:nth-child(2) {
    width: 10%;
    min-width: 70px;
  }

  #tableprezentacje th:nth-child(3),  /* Nazwa */
  #tableprezentacje td:nth-child(3) {
    width: 15%;
    min-width: 140px;
  }

  #tableprezentacje th:nth-child(4),  /* Obszar Stosowania */
  #tableprezentacje td:nth-child(4) {
    width: 14%;
    min-width: 100px;
  }

  #tableprezentacje th:nth-child(5),  /* Kogo dotyczy */
  #tableprezentacje td:nth-child(5) {
    width: 12%;
    min-width: 90px;
  }

  #tableprezentacje th:nth-child(6),  /* Organ wydający */
  #tableprezentacje td:nth-child(6) {
    width: 10%;
    min-width: 80px;
  }

  #tableprezentacje th:nth-child(7),  /* Status */
  #tableprezentacje td:nth-child(7) {
    width: 6%;
    min-width: 50px;
  }

  #tableprezentacje th:nth-child(8),  /* Data wydania */
  #tableprezentacje td:nth-child(8) {
    width: 7%;
    min-width: 70px;
  }

  #tableprezentacje th:nth-child(9),  /* Data wejścia w życie */
  #tableprezentacje td:nth-child(9) {
    width: 7%;
    min-width: 70px;
  }

  #tableprezentacje th:nth-child(10), /* Data ostatniej aktualizacji */
  #tableprezentacje td:nth-child(10) {
    width: 8%;
    min-width: 75px;
  }

  #tableprezentacje th:nth-child(11), /* Podstawa Prawna */
  #tableprezentacje td:nth-child(11) {
    width: 9%;
    min-width: 75px;
  }

  #tableprezentacje th:nth-child(12), /* Dokument */
  #tableprezentacje td:nth-child(12) {
    width: 3%;
    min-width: 35px;
    text-align: center;
  }

  /* Tooltip na hover dla długich tekstów */
  #tableprezentacje tbody td:hover {
    overflow: visible;
    white-space: normal;
    z-index: 5;
    position: relative;
    background: rgba(223, 14, 154, 0.25) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Na bardzo dużych monitorach */
@media (min-width: 1600px) {
  #tableprezentacje thead th,
  #tableprezentacje tbody td {
    padding: 12px 10px;
    font-size: 0.85rem;
  }
}

/* NAGŁÓWKI Z MOCNYM KONTRASTEM */
#tableprezentacje thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  text-align: left;
  padding: 14px 10px;
  font-weight: 700;
  background: var(--secondary-bg) !important;
  color: var(--main-white) !important;
  border-bottom: 3px solid var(--main-light-color) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.2) !important;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);

  /* NOWE WŁAŚCIWOŚCI DLA ZAWIJANIA */
  font-size: 0.75rem !important; /* Mniejsza czcionka */
  white-space: normal !important; /* Pozwala na zawijanie tekstu */
  word-wrap: break-word !important; /* Łamie długie słowa */
  overflow-wrap: break-word !important; /* Dodatkowe zabezpieczenie */
  line-height: 1.2 !important; /* Kompaktowy odstęp między liniami */
  text-transform: uppercase;
  letter-spacing: 0.5px; /* Zmniejszono letter-spacing */
  vertical-align: top; /* Wyrównanie do góry */
  min-height: 40px; /* Minimalna wysokość nagłówków */
}

/* Aktualizacja dla desktopów */
@media (min-width: 992px) {
  #tableprezentacje thead th {
    padding: 12px 8px;
    font-size: 0.72rem;
    line-height: 1.15;
    min-height: 45px; /* Trochę więcej miejsca na wielowierszowe nagłówki */
  }
}

/* Na bardzo dużych monitorach można nieco zwiększyć */
@media (min-width: 1600px) {
  #tableprezentacje thead th {
    padding: 14px 10px;
    font-size: 0.78rem;
    line-height: 1.25;
  }
}

#tableprezentacje thead th:last-child {
  border-right: none !important;
}

/* WIERSZE Z WYRAŹNYM ROZDZIAŁEM */
#tableprezentacje tbody tr {
  background: rgba(255, 255, 255, 0.08) !important;
  transition: all 0.25s ease;
  border-bottom: 2px solid rgba(255, 255, 255, 0.1) !important;
}

#tableprezentacje tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.12) !important;
}

#tableprezentacje tbody tr:hover {
  background: rgba(223, 14, 154, 0.2) !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(223, 14, 154, 0.3);
  border-color: var(--main-light-color) !important;
}

#tableprezentacje tbody td {
  padding: 15px 18px;
  border-top: none !important;
  border-right: 1px solid rgba(255, 255, 255, 0.1) !important;
  vertical-align: middle;
  transition: all 0.2s ease;
  background: inherit;
}

#tableprezentacje tbody td:last-child {
  border-right: none !important;
}

/* ===== CHECKBOX Z LEPSZYM KONTRASTEM ===== */
.favorite-checkbox {
  width: 22px;
  height: 22px;
  cursor: pointer;
  appearance: none;
  background: rgba(0, 0, 0, 0.4);
  border: 3px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  position: relative;
  transition: all 0.3s ease;
}

.favorite-checkbox:checked {
  background: var(--main-light-color);
  border-color: var(--main-light-color);
  box-shadow: 0 0 20px rgba(223, 14, 154, 0.6);
}

.favorite-checkbox:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 16px;
  font-weight: bold;
}

.favorite-checkbox:hover {
  border-color: var(--main-light-color);
  box-shadow: 0 0 15px rgba(223, 14, 154, 0.4);
  transform: scale(1.1);
}

/* ===== DATATABLES CONTROLS - SPACE-BETWEEN ===== */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--main-white) !important;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin-bottom: 25px;
  font-weight: 500;
}

/* Główny kontener - zawsze space-between */
.dataTables_wrapper .row:first-child {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 20px;
}

/* Resetowanie klas Bootstrap na divach */
.dataTables_wrapper .row:first-child .col-sm-12.col-md-6 {
  flex: 0 0 auto !important;
  max-width: none !important;
  width: auto !important;
}

/* Stylowanie kontenerów */
.dataTables_wrapper .dataTables_length {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-block;
  min-width: 200px;
}

.dataTables_wrapper .dataTables_filter {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px 20px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: inline-block;
  min-width: 250px;
  text-align: right;
}

/* Label styling */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 500;
  color: var(--main-white);
}

.dataTables_wrapper .dataTables_filter label {
  justify-content: flex-end;
}

/* Select i Input z mocniejszym tłem */
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
  background: rgba(0, 0, 0, 0.4) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  color: var(--main-white) !important;
  border-radius: 10px !important;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
  outline: none;
  border-color: var(--main-light-color) !important;
  background: rgba(0, 0, 0, 0.6) !important;
  box-shadow: 0 0 20px rgba(223, 14, 154, 0.5) !important;
}

/* ===== PAGINACJA Z LEPSZYM KONTRASTEM ===== */
.page-item .page-link {
  background: rgba(0, 0, 0, 0.3) !important;
  border: 2px solid rgba(255, 255, 255, 0.3) !important;
  color: var(--main-white) !important;
  border-radius: 10px !important;
  margin: 0 5px;
  padding: 12px 20px;
  transition: all 0.3s ease;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.page-item .page-link:hover {
  background: rgba(0, 0, 0, 0.5) !important;
  border-color: var(--main-light-color) !important;
  color: var(--main-white) !important;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(223, 14, 154, 0.4);
}

.page-item.active .page-link {
  background: var(--main-light-color) !important;
  border-color: var(--main-light-color) !important;
  color: #fff !important;
  box-shadow: 0 12px 35px rgba(223, 14, 154, 0.5);
}

/* ===== RESPONSYWNOŚĆ ===== */

/* Tablety i telefony - zachowaj scroll */
@media (max-width: 991px) {
  .table-responsive {
    overflow-x: auto; /* Przywróć scroll na mniejszych ekranach */
  }

  #tableprezentacje {
    table-layout: auto;
    font-size: 0.9rem;
  }

  #tableprezentacje thead th,
  #tableprezentacje tbody td {
    padding: 10px 12px;
    font-size: 0.85rem;
    white-space: nowrap; /* Na tabletach zachowaj nowrap */
  }
}

@media (max-width: 768px) {
  .main-container {
    padding: 20px 15px;
  }

  .header {
    margin-bottom: 30px;
    padding: 20px 0;
  }

  .header h1 {
    font-size: 2.2rem;
  }

  .card-body {
    padding: 25px 20px !important;
  }

  #tableprezentacje thead th,
  #tableprezentacje tbody td {
    padding: 12px 10px;
    font-size: 0.85rem;
  }
}

/* TYLKO NA TELEFONACH (<768px) - układ kolumnowy DataTables */
@media (max-width: 767px) {
  .dataTables_wrapper .row:first-child {
    flex-direction: column !important;
    justify-content: flex-start !important;
    align-items: stretch !important;
    gap: 15px;
  }

  .dataTables_wrapper .row:first-child .col-sm-12.col-md-6 {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter {
    min-width: 100%;
    width: 100%;
    text-align: left;
  }

  .dataTables_wrapper .dataTables_filter label {
    justify-content: flex-start;
  }
}

/* ===== SCROLLBAR STYLING ===== */
.table-responsive::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-responsive::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--main-light-color);
  border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: rgba(223, 14, 154, 0.8);
}
