/* ================================================================
   RESET & BAZA
================================================================ */
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.95rem;
    min-height: 100vh;
}

.errors { color: red; }
span.required { color: red; }

/* ================================================================
   APP WRAPPER – flexbox layout
================================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ================================================================
   SIDEBAR
================================================================ */
.sidebar {
    width: 220px;
    height: 100vh;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, #0f2027 0%, #203a43 55%, #2c5364 100%);
    transition: width 0.28s ease;
    display: flex;
    flex-direction: column;
    z-index: 100;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar.collapsed { width: 60px; }

/* --- Header (brand + toggle) --- */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 12px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 62px;
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    white-space: nowrap;
    text-decoration: none;
}
.sidebar-brand-icon {
    font-size: 1.15rem;
    color: white;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 5px 8px;
    flex-shrink: 0;
}
.sidebar.collapsed .sidebar-brand-icon {
    opacity: 0;
    pointer-events: none;
}
.sidebar-brand-text {
    font-weight: 700;
    color: white;
    font-size: 0.975rem;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}
.sidebar.collapsed .sidebar-brand-text { opacity: 0; }

.btn-sidebar-toggle {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 6px;
    color: rgba(255,255,255,0.7);
    width: 26px;
    height: 26px;
    min-width: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.btn-sidebar-toggle:hover { background: rgba(255,255,255,0.18); color: white; }

/* --- Navigation --- */
.sidebar-nav {
    padding: 10px 8px 6px;
    flex-shrink: 0;
}
.sidebar-section-label {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    padding: 6px 10px 3px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.15s ease;
}
.sidebar.collapsed .sidebar-section-label { opacity: 0; }

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 10px;
    color: rgba(255,255,255,0.62);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: background 0.18s ease, color 0.18s ease;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
}
.sidebar-nav-item:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.95); }
.sidebar-nav-item.active {
    background: rgba(255,255,255,0.14);
    color: white;
    font-weight: 500;
}
.sidebar-nav-item i {
    font-size: 0.975rem;
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}
.sidebar-nav-label {
    font-size: 0.875rem;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}
.sidebar.collapsed .sidebar-nav-label { opacity: 0; }

/* --- Divider --- */
.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.09);
    margin: 6px 12px;
    flex-shrink: 0;
}

/* --- Stat items (pracownik) --- */
.sidebar-stats {
    padding: 8px 8px;
    flex-shrink: 0;
}
.sidebar-stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-stat-icon {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.55);
    flex-shrink: 0;
    width: 18px;
    text-align: center;
}
.sidebar-stat-body { overflow: hidden; transition: opacity 0.15s ease; }
.sidebar.collapsed .sidebar-stat-body { opacity: 0; }
.sidebar-stat-label {
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.38);
    white-space: nowrap;
}
.sidebar-stat-value {
    font-size: 1.0rem;
    font-weight: 700;
    color: white;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* --- KPI mini (admin) --- */
.sidebar-kpis {
    padding: 8px 8px;
    flex-shrink: 0;
}
.sidebar-kpi-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.06);
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}
.sidebar-kpi-icon {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}
.sidebar-kpi-body { overflow: hidden; transition: opacity 0.15s ease; }
.sidebar.collapsed .sidebar-kpi-body { opacity: 0; }
.sidebar-kpi-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    line-height: 1.2;
}
.sidebar-kpi-label {
    font-size: 0.63rem;
    color: rgba(255,255,255,0.38);
    white-space: nowrap;
}
.sidebar-kpi-badge {
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 20px;
}

/* --- Footer / User --- */
.sidebar-footer {
    margin-top: auto;
    padding: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 8px;
    border-radius: 8px;
    overflow: hidden;
    white-space: nowrap;
}
.sidebar-user-body { overflow: hidden; transition: opacity 0.15s ease; }
.sidebar.collapsed .sidebar-user-body { opacity: 0; }
.sidebar-user-name {
    font-size: 0.83rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
}
.sidebar-user-name a {text-decoration: none; color: white;}
.sidebar-user-role {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
}
.btn-sidebar-logout {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-sidebar-logout:hover { background: rgba(255,255,255,0.12); color: #ef476f; }
.sidebar.collapsed .btn-sidebar-logout { display: none; }

/* ================================================================
   MAIN WRAPPER & TOP BAR
================================================================ */
.main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 50;
    flex-shrink: 0;
    gap: 12px;
}

.content-area {
    padding: 24px 28px;
    flex: 1;
}

/* ================================================================
   AVATAR
================================================================ */
.avatar-circle {
    width: 34px; height: 34px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.8rem; color: white; flex-shrink: 0;
}

/* ================================================================
   KARTY PROJEKTÓW
================================================================ */
.project-card {
    border: 2px solid transparent !important;
    border-radius: 16px !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    overflow: hidden;
}
.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 36px rgba(0,0,0,0.11) !important;
}
.project-card.timer-running {
    border-color: #ef476f !important;
    box-shadow: 0 0 0 4px rgba(239,71,111,0.14) !important;
}
.project-icon-wrap {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; flex-shrink: 0;
}
.badge-status {
    font-size: 0.72rem; font-weight: 600;
    padding: 4px 10px; border-radius: 20px;
}

/* ================================================================
   TIMER NA KARCIE
================================================================ */
.timer-display {
    display: none;
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
    color: #ef476f;
    text-align: center;
    background: rgba(239,71,111,0.08);
    border-radius: 10px;
    padding: 8px 0;
    margin-bottom: 10px;
}
.timer-display-summary {
    display: block;
    color: #198754;
    background: rgba(25,135,84,0.12);
}

/* Active timer bar (top-bar) */
#active-timer-bar {
    background: rgba(239,71,111,0.1);
    border: 1px solid rgba(239,71,111,0.28);
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 0.82rem;
    color: #ef476f;
    display: none;
}

/* ================================================================
   ANIMACJA PULSOWANIA
================================================================ */
@keyframes pulseGlow {
    0%   { box-shadow: 0 0 0 0 rgba(239,71,111,0.65); }
    70%  { box-shadow: 0 0 0 10px rgba(239,71,111,0); }
    100% { box-shadow: 0 0 0 0 rgba(239,71,111,0); }
}
.btn-pulse { animation: pulseGlow 1.5s ease-in-out infinite; }

/* ================================================================
   PROGRESS BARS
================================================================ */
.progress { border-radius: 8px; height: 8px; }

/* ================================================================
   TABELA ADMIN
================================================================ */
.table-admin th {
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
    color: var(--bs-secondary-color);
    white-space: nowrap;
}
.table-admin td { vertical-align: middle; font-size: 0.875rem; }
.note-cell {
    max-width: 260px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: help;
}

/* ================================================================
   LEGENDA
================================================================ */
.legend-dot {
    width: 11px; height: 11px;
    border-radius: 3px;
    display: inline-block;
    flex-shrink: 0;
}

/* ================================================================
   ETYKIETY SEKCJI
================================================================ */
.section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    color: var(--bs-secondary-color);
}

/* ================================================================
   TOAST
================================================================ */
.toast-container { z-index: 9999; }

/* ================================================================
   DARK MODE
================================================================ */
[data-bs-theme="dark"] .project-card { background-color: #1a2535 !important; }
[data-bs-theme="dark"] .card         { background-color: #1a2535; }

/* ================================================================
   FILTER BAR
================================================================ */
.filter-bar {
    background: var(--bs-secondary-bg);
    border-radius: 12px;
    padding: 14px 18px;
}

/* ================================================================
   MODAL
================================================================ */
.modal-content { border-radius: 18px !important; }

/* ================================================================
   EMPTY STATE
================================================================ */
.empty-state { color: var(--bs-secondary-color); }

/* ================================================================
   SCROLLBAR (webkit)
================================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(128,128,128,0.25); border-radius: 3px; }

/* ================================================================
   HISTORIA CZASU
================================================================ */
.history-entry {
    border-left-width: 4px !important;
    border-radius: 10px !important;
    transition: box-shadow 0.18s ease;
}
.history-entry:hover {
    box-shadow: 0 4px 18px rgba(0,0,0,0.08) !important;
}
.time-badge {
    font-size: 0.77rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    background: var(--bs-secondary-bg);
    border-radius: 6px;
    padding: 3px 9px;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}
.timeline-track {
    position: relative;
    height: 26px;
    background: var(--bs-secondary-bg);
    border-radius: 8px;
    overflow: hidden;
}
.timeline-segment {
    position: absolute;
    height: 100%;
    opacity: 0.82;
    transition: opacity 0.2s;
    cursor: pointer;
}
.timeline-segment:hover { opacity: 1; }
.timeline-now-marker {
    position: absolute;
    width: 2px;
    height: 100%;
    background: rgba(255,255,255,0.9);
    top: 0;
    z-index: 5;
    box-shadow: 0 0 5px rgba(0,0,0,0.35);
}

/* ================================================================
   MOJE RAPORTY
================================================================ */
.report-stat-card {
    border-radius: 12px;
    border: 1px solid var(--bs-border-color);
    padding: 14px 18px;
    height: 100%;
}
.report-day-header {
    cursor: pointer;
    user-select: none;
    border-radius: 10px;
    padding: 12px 18px;
    transition: background 0.15s ease;
    margin: 0;
}
.report-day-header:hover { background: var(--bs-secondary-bg); }
.report-day-header[aria-expanded="true"] .bi-chevron-down {
    transform: rotate(180deg);
}
.bi-chevron-down { transition: transform 0.2s ease; }

/* ================================================================
   ADMIN – KARTY PROJEKTÓW
================================================================ */
.admin-project-card {
    border-radius: 16px !important;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.admin-project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1) !important;
}
.admin-project-meta-row {
    --project-meta-border: var(--bs-border-color);
    --project-meta-bg: var(--bs-secondary-bg);
}
.admin-project-meta-box {
    border: 1px solid var(--project-meta-border);
    background: var(--project-meta-bg);
    border-radius: 10px;
    padding: 7px 12px;
    min-height: 76px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.project-color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    flex-shrink: 0;
}
.btn-color-preset {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    padding: 0;
}
.btn-color-preset:hover { transform: scale(1.2); border-color: rgba(0,0,0,0.2); }

/* ================================================================
   ADMIN – KARTY PRACOWNIKÓW
================================================================ */
.employee-card {
    border-radius: 16px !important;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.employee-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1) !important;
}
.employee-avatar-lg {
    width: 50px;
    height: 50px;
    font-size: 1rem;
    flex-shrink: 0;
}

/* ================================================================
   ADMIN – CHART PERIOD BUTTONS
================================================================ */
.btn-chart-period {
    font-size: 0.8rem;
    padding: 5px 14px;
}
.btn-chart-period.active {
    background: var(--bs-primary) !important;
    border-color: var(--bs-primary) !important;
    color: white !important;
}

/* ================================================================
   EKRAN LOGOWANIA
================================================================ */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.login-brand-panel {
    flex: 0 0 44%;
    max-width: 560px;
    background: linear-gradient(180deg, #0f2027 0%, #203a43 55%, #2c5364 100%);
    color: white;
    align-items: center;
    justify-content: center;
    padding: 60px;
}
.login-brand-inner { max-width: 380px; }
.login-brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255,255,255,.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 24px;
}
.login-brand-icon-sm {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--bs-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}
.login-brand-title { font-weight: 800; font-size: 2rem; margin-bottom: 10px; }
.login-brand-tagline {
    color: rgba(255,255,255,.65);
    line-height: 1.6;
    margin-bottom: 32px;
}
.login-brand-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.login-brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .9rem;
    color: rgba(255,255,255,.85);
}
.login-brand-features i {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: rgba(255,255,255,.1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-form-panel {
    flex: 1 1 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--bs-body-bg);
}
.login-form-card { width: 100%; max-width: 400px; }
.login-theme-toggle { position: absolute; top: 24px; right: 24px; }

.login-role-switch {
    display: flex;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: var(--bs-tertiary-bg);
}
.login-role-switch button {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 12px;
    border-radius: 9px;
    font-weight: 600;
    font-size: .85rem;
    color: var(--bs-secondary-color);
    transition: background .15s ease, color .15s ease;
}
.login-role-switch button.active {
    background: var(--bs-body-bg);
    color: var(--bs-primary);
    box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* ================================================================
   RESPONSYWNOŚĆ < 1600px – FORMULARZE
================================================================ */
@media (max-width: 1599.98px) {
    .form-control,
    .form-select {
        font-size: 0.875rem;
        line-height: 1.35;
        padding-top: 0.32rem;
        padding-bottom: 0.32rem;
        min-height: calc(1.35em + 0.64rem + 2px);
    }

    .form-select {
        padding-right: 2rem;
    }

    label,
    .form-label {
        margin-bottom: 0.25rem;
    }
}
