/* ============================================================================
   NexusFlow — CHROME (sidebar + topbar + szkielet aplikacji)
   Off-canvas na mobile sterowany CSS-em (#nav-toggle, bez JS).
   ========================================================================== */

/* Przełącznik nawigacji mobilnej (ukryty checkbox) */
.nav-toggle-cb { position: absolute; opacity: 0; pointer-events: none; }

/* --------------------------------------------------------------- Sidebar -- */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    height: 100dvh;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
    padding: var(--sp-lg) var(--sp-md);
    background: var(--surface-container-low);
    border-right: 1px solid var(--outline-variant);
    overflow-y: auto;
}

.sidebar__brand { display: flex; align-items: center; gap: var(--sp-sm); padding: 0 var(--sp-xs); margin-bottom: var(--sp-md); }
.sidebar__logo {
    display: grid; place-items: center;
    width: 40px; height: 40px; flex: none;
    border-radius: var(--r-md);
    background: var(--primary); color: var(--on-primary);
    font-size: 24px;
}
.sidebar__title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; color: var(--primary); line-height: 1.1; }
.sidebar__sub { font-size: 12px; color: var(--on-surface-variant); }

.sidebar__nav { display: flex; flex-direction: column; gap: 4px; flex-grow: 1; }
.sidebar__section { margin-top: var(--sp-md); padding: 0 var(--sp-sm) var(--sp-xs); font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--outline); }

.navlink {
    display: flex; align-items: center; gap: var(--sp-sm);
    padding: 10px var(--sp-sm);
    border-radius: var(--r-md);
    color: var(--on-surface-variant);
    font-size: 14px; font-weight: 600;
    transition: background .18s, color .18s, transform .1s;
    white-space: nowrap;
}
.navlink .material-symbols-outlined { font-size: 22px; }
.navlink:hover { background: var(--surface-container-high); color: var(--on-surface); text-decoration: none; }
.navlink:active { transform: scale(.97); }
.navlink.is-active { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm); }
.navlink.is-active:hover { background: var(--primary); color: var(--on-primary); }
.navlink__badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--error); color: var(--on-error); font-size: 11px; font-weight: 800; line-height: 20px; text-align: center; }
.navlink.is-active .navlink__badge { background: var(--on-primary); color: var(--primary); }

.sidebar__cta { margin-top: auto; }
.sidebar__cta-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 12px var(--sp-md);
    border: none; border-radius: var(--r-lg);
    background: var(--primary); color: var(--on-primary);
    font: 700 14px/1 var(--font); cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: opacity .2s, transform .1s;
}
.sidebar__cta-btn:hover { opacity: .92; text-decoration: none; color: var(--on-primary); }
.sidebar__cta-btn:active { transform: scale(.98); }

.sidebar__footer { display: flex; flex-direction: column; gap: 4px; padding-top: var(--sp-md); border-top: 1px solid var(--outline-variant); }

/* ----------------------------------------------------------- App / Topbar -- */
.app {
    margin-left: var(--sidebar-w);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: var(--sp-md);
    height: var(--topbar-h);
    padding: 0 var(--sp-xl);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--outline-variant);
}
.topbar__title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--on-surface); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-sm); }
.topbar__user { font-size: 14px; font-weight: 600; color: var(--on-surface-variant); }

.topbar__burger { display: none; }

.topbar__icon {
    position: relative;
    display: grid; place-items: center;
    width: 40px; height: 40px;
    border: none; border-radius: var(--r-pill);
    background: transparent; color: var(--on-surface-variant);
    cursor: pointer; transition: background .18s;
}
.topbar__icon:hover { background: var(--surface-container); color: var(--on-surface); text-decoration: none; }
.topbar__icon .material-symbols-outlined { font-size: 24px; }

.bell { position: relative; }
.bell__badge {
    position: absolute; top: 4px; right: 4px;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: var(--r-pill);
    background: var(--error); color: var(--on-error);
    font-size: 10px; line-height: 16px; text-align: center; font-weight: 800;
}

.avatar {
    width: 40px; height: 40px; flex: none;
    display: grid; place-items: center;
    border-radius: var(--r-pill);
    background: var(--primary-fixed); color: var(--on-primary-fixed);
    font-weight: 800; font-size: 14px;
    border: 1px solid var(--outline-variant);
    text-transform: uppercase;
}

.topbar__right select {
    height: 38px; max-width: 200px;
    border: 1px solid var(--outline-variant); border-radius: var(--r-md);
    background: var(--surface-container-lowest); color: var(--on-surface);
    padding: 0 12px; font: inherit; font-size: 14px;
}

/* ------------------------------------------------------------- Content ---- */
.shell {
    width: 100%; max-width: 1600px; margin: 0 auto;
    padding: var(--sp-xl);
    display: flex; flex-direction: column; gap: var(--sp-lg);
}

.flash {
    display: flex; align-items: center; gap: 8px;
    background: var(--secondary-container); color: var(--on-secondary-container);
    padding: 12px 16px; border-radius: var(--r-md);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.flash::before { content: 'check_circle'; font-family: 'Material Symbols Outlined'; }

/* ------------------------------------------- FAB „+" (szybkie dodawanie) -- */
.fab-toggle-cb { position: absolute; opacity: 0; pointer-events: none; }
.fab { position: fixed; right: 24px; bottom: 24px; z-index: 70; display: flex; flex-direction: column; align-items: flex-end; gap: var(--sp-sm); }
.fab__btn {
    display: grid; place-items: center;
    width: 56px; height: 56px; border-radius: var(--r-pill);
    background: var(--primary); color: var(--on-primary);
    box-shadow: var(--shadow-hover); cursor: pointer;
    transition: transform .15s, opacity .2s;
}
.fab__btn:hover { opacity: .94; }
.fab__btn:active { transform: scale(.94); }
.fab__btn .material-symbols-outlined { font-size: 32px; transition: transform .25s ease; }
.fab-toggle-cb:checked ~ .fab .fab__btn .material-symbols-outlined { transform: rotate(45deg); }

.fab__menu {
    display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
    opacity: 0; transform: translateY(8px) scale(.96); transform-origin: bottom right;
    pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
.fab-toggle-cb:checked ~ .fab .fab__menu { opacity: 1; transform: none; pointer-events: auto; }
.fab__item { display: flex; align-items: center; gap: 10px; }
.fab__item:hover { text-decoration: none; }
.fab__item-label { background: var(--inverse-surface); color: var(--inverse-on-surface); padding: 6px 12px; border-radius: var(--r-md); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-sm); white-space: nowrap; }
.fab__item-ico { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-pill); background: var(--surface-container-lowest); box-shadow: var(--shadow-card); font-size: 22px; transition: transform .15s; }
.fab__item:hover .fab__item-ico { transform: scale(1.08); }
.fab__item-ico--task { color: var(--primary); }
.fab__item-ico--project { color: var(--secondary); }
.fab__item-ico--event { color: var(--tertiary); }
.fab-scrim { display: none; }
.fab-toggle-cb:checked ~ .fab-scrim { display: block; position: fixed; inset: 0; z-index: 65; }

/* Kotwica „Dodaj…" z FAB-a — odsłonięcie formularza tworzenia spod sticky topbaru */
[id="create"] { scroll-margin-top: 84px; }
[id="create"]:target { box-shadow: 0 0 0 2px var(--primary); animation: create-focus 1.4s ease 1; }
@keyframes create-focus { 0%, 60% { box-shadow: 0 0 0 2px var(--primary); } 100% { box-shadow: var(--shadow-card); } }
@media (prefers-reduced-motion: reduce) { [id="create"]:target { animation: none; } }

/* ----------------------------------------------------------- Responsive -- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-hover); }
    .nav-toggle-cb:checked ~ .sidebar { transform: translateX(0); }
    .app { margin-left: 0; }
    .topbar__burger {
        display: grid; place-items: center;
        width: 40px; height: 40px; border: none; border-radius: var(--r-md);
        background: transparent; color: var(--on-surface); cursor: pointer;
    }
    .topbar__burger .material-symbols-outlined { font-size: 26px; }
    /* Przyciemnienie tła pod otwartym menu */
    .nav-scrim { display: none; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.35); }
    .nav-toggle-cb:checked ~ .nav-scrim { display: block; }
}
@media (max-width: 700px) {
    .shell { padding: var(--sp-md); gap: var(--sp-md); }
    .topbar { padding: 0 var(--sp-md); }
}
@media (min-width: 1025px) {
    .topbar__burger, .nav-scrim { display: none; }
}
