/* ===== THEME CORE (Bootstrap 5.x) ===== */

/* --- Domyślne tokeny; będą nadpisywane przez [data-theme] --- */
:root{
    --accent: #0d6efd;
    --focus-ring: #99f2c8;

    --radius-lg: 1.5rem;
    --radius-md: .75rem;
    --card-max-w: 900px;
}

/* ===== DARK (GLASS GREEN) ===== */
html[data-theme="dark"]{
    --bg-grad-start: #1f4037;
    --bg-grad-end:   #99f2c8;

    --surface:       rgba(0, 0, 0, 0.40);
    --surface-weak:  rgba(255,255,255,0.08);
    --surface-weak-2:rgba(255,255,255,0.06);

    --text-strong:   #ffffff;
    --text:          rgba(255,255,255,0.92);
    --text-muted:    rgba(255,255,255,0.80);

    /* Wiersze tabel w zielonej tonacji (naprawa „białych” wierszy) */
    --row-bg:        rgba(31, 64, 55, 0.45);
    --row-bg-hover:  rgba(31, 64, 55, 0.65);

    /* Dropdown/Modal */
    --menu-bg:       rgba(0,0,0,0.85);
    --menu-border:   rgba(255,255,255,.15);
    --menu-fg:       #fff;

    /* Toggle button */
    --btn-theme-fg:      #ffffff;
    --btn-theme-border:  rgba(255,255,255,0.6);
    --btn-theme-hoverbg: rgba(255,255,255,0.12);
}

/* ===== LIGHT (LIGHT GLASS) ===== */
html[data-theme="light"]{
    /* Delikatniejszy, jaśniejszy gradient wciąż w zielonej tonacji */
    --bg-grad-start: #e8fff5;
    --bg-grad-end:   #c9f3df;

    /* Jaśniejsze szkło */
    --surface:        rgba(255,255,255,0.65);
    --surface-weak:   rgba(0,0,0,0.06);
    --surface-weak-2: rgba(0,0,0,0.04);

    /* Ciemna typografia na jasnym tle */
    --text-strong:   #0f1b17;
    --text:          rgba(15,27,23,0.92);
    --text-muted:    rgba(15,27,23,0.70);

    /* Wiersze tabel w JAŚNIEJSZEJ zielonej tonacji */
    --row-bg:        rgba(0, 128, 96, 0.10);
    --row-bg-hover:  rgba(0, 128, 96, 0.18);

    /* Dropdown/Modal jasne */
    --menu-bg:       rgba(255,255,255,0.95);
    --menu-border:   rgba(0,0,0,.10);
    --menu-fg:       #10211b;

    /* Toggle button */
    --btn-theme-fg:      #10211b;
    --btn-theme-border:  rgba(0,0,0,0.35);
    --btn-theme-hoverbg: rgba(0,0,0,0.06);
}

/* ===== Layout tła i shell ===== */
body.app-bg{
    background: linear-gradient(to right, var(--bg-grad-start), var(--bg-grad-end));
    min-height: 100vh;
    margin: 0;
    color: var(--text-strong);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Środkowanie jak w przykładzie */
    padding: 2rem;
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Noto Sans",Arial,"Apple Color Emoji","Segoe UI Emoji";
}
.app-shell{ width:100%; max-width: var(--card-max-w); }
.app-shell--top{ justify-content: flex-start; }

/* Skip link (WCAG) */
.skip-link{ position:absolute; left:-9999px; top:0; }
.skip-link:focus{
    left:1rem; top:1rem; z-index:10000;
    background:#000; color:#fff; padding:.5rem .75rem; border-radius:.5rem;
}

/* ===== Glass containers ===== */
.glass, .glass-card, .card-glass{
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 0 20px rgba(0,0,0,.4);
    color: var(--text);
}
.glass-card{
    width:100%; max-width: var(--card-max-w);
    display:flex; flex-direction:column;
    height: calc(100svh - 8rem);
    overflow:hidden;
}
@supports(height: 100dvh){ .glass-card{ height: calc(100dvh - 8rem); } }

.glass-title, .page-title{
    color: var(--text-strong);
    text-shadow: 1px 1px 2px rgba(0,0,0,.2);
}

/* Menubar w karcie */
.menu-header{ display:flex; justify-content:space-between; align-items:center; margin-bottom:.75rem; }
.nav-button{ background:none; border:none; color:var(--text-strong); font-size:1.6rem; }

/* ===== Breadcrumb ===== */
.page-breadcrumb{
    --bs-breadcrumb-divider: "›";
    background: var(--surface-weak);
    border-radius: var(--radius-md);
    padding:.5rem .75rem; margin-bottom:1rem;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.breadcrumb .breadcrumb-item,
.breadcrumb .breadcrumb-item a{ color: var(--text-strong); text-decoration: none; }
.breadcrumb .breadcrumb-item a:hover{ text-decoration: underline; }
.breadcrumb .breadcrumb-item + .breadcrumb-item::before{ color: var(--text-strong); opacity:.8; }
.breadcrumb .breadcrumb-item.active{ opacity:.9; }

/* ===== Scroll area ===== */
.scroll-area, .table-responsive{
    flex:1 1 auto; min-height:0; overflow:auto; border-radius: var(--radius-md);
}

/* ===== Tabela – GLASS GREEN (ważne: brak białych taust) ===== */
.table{ color: var(--text); }
.table td, .table th{
    background-color: transparent !important;
    border: none;
    padding: 1rem 1.25rem;
}
.table thead th{
    background: var(--surface-weak);
    color: var(--text-strong);
    font-weight: 600; font-size: 1rem;
    position: sticky; top: 0; z-index: 1;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
/* Wiersze w zielonej tonacji zgodnie z motywem */
.table tbody tr{
    background: var(--row-bg);
    transition: background-color .15s ease-in-out;
}
.table tbody tr:hover{ background: var(--row-bg-hover); }
.table a{ color: var(--text-strong); text-decoration: none; }
.table a:hover{ text-decoration: underline; }
.bi-icon{ font-size:1.25rem; color: var(--accent); margin-right:.5rem; }

/* ===== Dropdowny/meny ===== */
.dropdown-menu{
    background: var(--menu-bg);
    border: 1px solid var(--menu-border);
    color: var(--menu-fg);
}
.dropdown-item{ color: var(--menu-fg); }
.dropdown-item:hover, .dropdown-item:focus{
    background: var(--surface-weak);
    color: var(--menu-fg);
}

/* ===== Formularze ===== */
.glass input.form-control,
.glass select.form-select,
.glass textarea.form-control{
    background: var(--surface-weak);
    color: var(--text-strong);
    border: 1px solid rgba(0,0,0,.15);
}
.glass .form-label{ color: var(--text-strong); }
.glass .form-text, .glass .form-check-label{ color: var(--text); }
.glass .form-check-input{
    background-color: var(--surface-weak-2);
    border-color: rgba(0,0,0,.25);
}
.glass .form-check-input:checked{
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ===== Przyciski / linki ===== */
.btn-primary{ background-color: var(--accent); border-color: var(--accent); }
.btn-primary:hover{ filter: brightness(0.95); }
a{ color: #eafffb; }
html[data-theme="light"] a{ color: #0b5ed7; }
a:hover{ text-decoration: underline; }

/* Przycisk przełącznika motywu */
.btn-theme{
    color: var(--btn-theme-fg);
    border: 1px solid var(--btn-theme-border);
    background: transparent;
}
.btn-theme:hover{ background: var(--btn-theme-hoverbg); }

/* ===== Alerty ===== */
.alert{
    border-radius: .75rem;
    border: 1px solid rgba(0,0,0,.12);
}
html[data-theme="dark"] .alert-success{ background: rgba(25,135,84,.25); color:#eafffb; }
html[data-theme="dark"] .alert-danger{  background: rgba(220,53,69,.25); color:#fff; }
html[data-theme="dark"] .alert-info{    background: rgba(13,110,253,.25); color:#e6f1ff; }
html[data-theme="dark"] .alert-warning{ background: rgba(255,193,7,.25); color:#fffbe6; }

html[data-theme="light"] .alert-success{ background: rgba(25,135,84,.12); color:#155724; }
html[data-theme="light"] .alert-danger{  background: rgba(220,53,69,.12); color:#842029; }
html[data-theme="light"] .alert-info{    background: rgba(13,110,253,.12); color:#084298; }
html[data-theme="light"] .alert-warning{ background: rgba(255,193,7,.12); color:#664d03; }

/* ===== Modale ===== */
.modal-content{
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,.12);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}
.modal-header,.modal-footer{
    border-color: rgba(0,0,0,.12);
}

/* ===== Paginacja ===== */
.pagination .page-link{
    background: var(--surface-weak);
    color: var(--text-strong);
    border: 1px solid rgba(0,0,0,.15);
}
.pagination .page-item.active .page-link{
    background: var(--accent); border-color: var(--accent); color:#fff;
}

/* ===== Focus (WCAG) ===== */
:focus{ outline: none; }
:focus-visible{ outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.focus-outline:focus-visible{ outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Preferencje ruchu */
@media (prefers-reduced-motion: reduce){
    *{ transition: none !important; animation: none !important; }
}

/* ===== Stopka ===== */
.app-footer{
    width:100%; text-align:center; font-size:.9rem;
    color: var(--text);
    margin-top: 1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,.2);
}

/* Użyteczne utilsy */
.maxw-card{ max-width: var(--card-max-w); }
.round-xl{ border-radius: var(--radius-lg); }
.round-md{ border-radius: var(--radius-md); }
.bg-surface-weak{ background: var(--surface-weak); }
.text-strong{ color: var(--text-strong) !important; }


.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 900px;
    margin-bottom: 1rem;
}

.top-header span {
    font-weight: 500;
}

.top-header img {
    height: 40px;
}