/* ===== MOTYW DARK ===== */
.theme-dark {
    --bg-main: #1f2937;
    --bg-secondary: #374151;
    --bg-hover: #4b5563;
    --text-main: #ffffff;
    --text-secondary: #d1d5db;
    --highlight: #facc15;
    --border-color: #4b5563;
    --danger: #f87171;
    --success: #34d399;
    --info: #60a5fa;
}

/* ===== MOTYW LIGHT ===== */
.theme-light {
    --bg-main: #f9fafb;
    --bg-secondary: #e5e7eb;
    --bg-hover: #d1d5db;
    --text-main: #111827;
    --text-secondary: #374151;
    --highlight: #b45309;
    --border-color: #d1d5db;
    --danger: #dc2626;
    --success: #15803d;
    --info: #2563eb;
}

/* ===== MOTYW HIGH CONTRAST ===== */
.theme-highcontrast {
    --bg-main: #000000;
    --bg-secondary: #000000;
    --bg-hover: #1a1a1a;
    --text-main: #ffffff;
    --text-secondary: #ffeb3b;
    --highlight: #ff0000;
    --border-color: #ffffff;
    --danger: #ff0000;
    --success: #00ff00;
    --info: #00ffff;
}

.theme-icon {
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.theme-icon.hide {
    opacity: 0;
    transform: rotate(180deg) scale(0.8);
}
.theme-icon.show {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ===== GLOBALNE ELEMENTY ===== */
body {
    background-color: var(--bg-main);
    color: var(--text-main);
    /*transition: background-color 0.3s ease, color 0.3s ease;*/
}

/* Tabele */
table {
    background-color: var(--bg-secondary);
    color: var(--text-main);
    border-collapse: collapse;
    width: 100%;
}
th, td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
}
th {
    background-color: var(--bg-hover);
}

/* Karty */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.card:hover {
    background-color: var(--bg-hover);
}

/* Formularze */
input, select, textarea {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 0.25rem;
    padding: 0.5rem;
    width: 100%;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--highlight);
    outline: none;
}

/* Przyciski */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.btn-primary {
    background-color: var(--highlight);
    color: #000;
}
.btn-danger {
    background-color: var(--danger);
    color: #fff;
}
.btn-success {
    background-color: var(--success);
    color: #000;
}
.btn-info {
    background-color: var(--info);
    color: #000;
}
.btn:hover {
    filter: brightness(1.1);
}

/* Tooltipy */
.tooltip {
    background-color: var(--bg-secondary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Modal */
.modal {
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

/* Spinner Ĺ‚adowania */
.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid var(--highlight);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.7) !important;
    z-index: 1;
}

.modal-window {
    position: relative;
    z-index: 2;
}

/* Stylizacja SweetAlert2 pod Twój motyw */
.swal2-popup {
    background-color: var(--bg-main) !important;
    color: var(--text-primary) !important;
    border-radius: 1rem !important;
}
.swal2-title {
    color: var(--text-primary) !important;
}
.swal2-html-container {
    color: var(--text-primary) !important;
}

/* Przycisk bazowy */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:.5rem;
  padding:.55rem .9rem; border-radius:.65rem;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  color:#fff; font-weight:500; line-height:1;
  transition: all .18s ease; white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.07); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

/* Priorytet */
.btn-primary {
  border-color: rgba(59,130,246,.6);
  background: rgba(37,99,235,.18);
}
.btn-primary:hover { background: rgba(37,99,235,.28); }

/* Niebezpieczne */
.btn-danger {
  border-color: rgba(239,68,68,.55);
  background: rgba(239,68,68,.12);
}
.btn-danger:hover { background: rgba(239,68,68,.2); }

/* Małe warianty */
.btn-xs {
  padding:.35rem .6rem; font-size:.82rem; border-radius:.55rem;
  border:1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04);
}
.btn-danger-xs {
  padding:.35rem .6rem; font-size:.82rem; border-radius:.55rem;
  border:1px solid rgba(239,68,68,.55); background: rgba(239,68,68,.12);
}

/* Pola formularza */
.input, .select, .textarea {
  width:100%; color:#fff; background: var(--bg-main, #0b0f19);
  border:1px solid rgba(255,255,255,.12); border-radius:.65rem;
  padding:.55rem .75rem; transition: border-color .18s ease, box-shadow .18s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(59,130,246,.7);
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
  outline: none;
}
.textarea { min-height: 96px; resize: vertical; }

/* Checkbox */
.checkbox { width:1.05rem; height:1.05rem; accent-color:#60a5fa; }

/* Badge */
.badge {
  display:inline-flex; gap:.35rem; align-items:center;
  padding:.2rem .5rem; border-radius:.5rem; font-variant-numeric: tabular-nums;
  border:1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.05);
}
/* ===== Theme toggle button animation ===== */
#themeToggle {
  position: relative;
  transition: transform .25s ease;
}

/* Główna animacja w momencie zmiany motywu */
#themeToggle.switching {
  animation: themeToggleSpin .5s ease;
}

/* Subtelna „fala” w kolorze aktualnego motywu (var(--highlight)) */
#themeToggle.switching::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 9999px;
  border: 2px solid var(--highlight);
  opacity: .5;
  animation: themeToggleRing .5s ease;
  pointer-events: none;
}

/* Obrót/przeskalowanie przycisku */
@keyframes themeToggleSpin {
  0%   { transform: rotate(0deg) scale(1); }
  35%  { transform: rotate(90deg) scale(1.08); }
  70%  { transform: rotate(180deg) scale(1); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Rozchodzący się pierścień */
@keyframes themeToggleRing {
  0%   { transform: scale(.85); opacity: .6; }
  100% { transform: scale(1.25); opacity: 0; }
}

/* Ikony już masz: .theme-icon.show/.hide – zostawiamy.
   Dla spójności możesz lekko podbić „klikowalność”: */
#themeToggle svg { width: 24px; height: 24px; }

/* Szacunek dla dostępności: wyłącz animacje przy reduced motion */
@media (prefers-reduced-motion: reduce) {
  #themeToggle.switching,
  #themeToggle.switching::after,
  .theme-icon { animation: none !important; transition: none !important; }
}
/* === Hamburger (3 kreski) + animacja do X === */
#navToggle { position: relative; }
#navToggle .hamb-line {
  display:block; width:22px; height:2px; margin:5px 0;
  background: var(--text-main);
  transition: transform .25s ease, opacity .25s ease, background-color .25s ease;
  border-radius: 2px;
}

/* Stan otwarty – krzyżyk */
#navToggle.is-open .hamb-line:nth-child(1) { transform: translateY(7px)  rotate(45deg); }
#navToggle.is-open .hamb-line:nth-child(2) { opacity: 0; }
#navToggle.is-open .hamb-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Delikatny „ping” przy przełączaniu */
#navToggle.is-open { animation: navPulse .35s ease; }
@keyframes navPulse { 0%{transform:scale(1)} 50%{transform:scale(1.06)} 100%{transform:scale(1)} }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #navToggle, #navToggle .hamb-line { transition: none !important; }
  #navToggle.is-open { animation: none !important; }
}
