* {
    box-sizing: border-box;
}
:root {
    --day-width: 40px; /* Szerokość jednej kolumny dnia */
    --row-height: 50px;
    --sidebar-width: 200px;
    --primary-color: #3788d8;
    --border-color: #e0e0e0;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f6f8;
    color: #333;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* --- HEADER --- */
.top-bar {
    background: #fff;
    padding: 10px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-icon { background: transparent; color: #555; font-size: 16px; }
.btn-icon:hover { background: #eee; }
.btn-primary { background: var(--primary-color); color: #fff; }
.btn-outline { border: 1px solid #ccc; background: #fff; }

/* --- TIMELINE LAYOUT --- */
.timeline-wrapper {
    display: flex;
    flex: 1;
    overflow: hidden; /* Ważne dla scrollowania */
    position: relative;
}

/* SIDEBAR (Pracownicy) */
.users-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid var(--border-color);
    z-index: 10;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
}

.sidebar-header {
    height: 40px; /* Musi pasować do timeline-header */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding-left: 15px;
    font-weight: bold;
    background: #f9f9f9;
}

.user-row-label {
    height: var(--row-height);
    border-bottom: 1px solid var(--border-color);
    padding: 0 15px;
    font-size: 13px;
    
    /* Flexbox do układania nazwy i limitu */
    display: flex;
    justify-content: space-between; /* Nazwa z lewej, limit z prawej */
    align-items: center;
}

/* SCROLL AREA (Prawa strona) */
.timeline-scroll-area {
    flex: 1;
    overflow: auto;
    position: relative;
    background: #fff;
}

.timeline-header {
    display: flex;
    height: 40px;
    background: #f9f9f9;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
    width: max-content; /* Rozszerza się dynamicznie */
}

.header-day {
    /* Sztywna szerokość */
    width: var(--day-width);
    min-width: var(--day-width); /* Ważne: zapobiega ściskaniu! */
    max-width: var(--day-width);
    
    /* Linia pionowa z prawej */
    border-right: 1px solid #e0e0e0; 
    
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    flex-shrink: 0; /* Ważne: nie pozwól zmniejszyć elementu */
    background: #f9f9f9;
}
.header-day.weekend { background-color: #f0f0f0; color: #888; }
.header-day.holiday { background-color: #ffebee; color: #d32f2f; }

/* GRID I PASKI */
.timeline-grid {
    position: relative;
    width: max-content;
    background-color: #fff; /* <--- To zapewnia białe tło pod spodem */
}

.timeline-row {
    height: var(--row-height);
    border-bottom: 1px solid var(--border-color);
    
    /* WAŻNE: To sprawia, że pasek "wie", względem czego ma się ustawić */
    position: relative; 
    
    background-image: linear-gradient(to right, transparent calc(100% - 1px), #e0e0e0 1px);
    background-size: var(--day-width) 100%; /* Powtarzaj co szerokość dnia */
	background-color: transparent;
}

.leave-bar {
    /* KLUCZ DO SUKCESU: */
    position: absolute !important; 
    top: 10px !important; 
    
    height: 30px;
    border-radius: 4px;
    color: #fff;
    font-size: 11px;
    padding: 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 30px;
    z-index: 2;
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); /* Lekki cień dla lepszego wyglądu */
}
.leave-bar:hover { z-index: 3; filter: brightness(0.95); }

/* STATUSY */
.status-PENDING { background: repeating-linear-gradient(45deg, #ffc107, #ffc107 10px, #ffcd39 10px, #ffcd39 20px); color: #333; }
.status-APPROVED { /* Domyślny kolor z bazy */ }
.status-REJECTED { background: #dc3545; opacity: 0.7; text-decoration: line-through; }

/* MODAL */
.modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 100; display: flex; justify-content: center; align-items: center; }
.modal-content { background: #fff; padding: 20px; border-radius: 5px; width: 400px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 500; }
.form-control { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box;}
.form-row { display: flex; gap: 10px; }
.info-box { background: #e3f2fd; padding: 10px; border-radius: 4px; font-size: 13px; margin-bottom: 15px; }
.full-width { width: 100%; }
.close-modal { float: right; font-size: 24px; cursor: pointer; }
.action-popover {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 6px;
    padding: 10px;
    width: 200px;
    z-index: 1000;
    font-size: 13px;
    display: none; /* Domyślnie ukryty */
}

.popover-header {
    font-weight: bold;
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
    color: #333;
    display: flex;
    justify-content: space-between;
}

.popover-body {
    margin-bottom: 10px;
    color: #555;
    line-height: 1.4;
}

.popover-actions {
    display: flex;
    gap: 5px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    border: none;
    flex: 1;
}

.btn-approve { background: #28a745; color: white; }
.btn-reject { background: #dc3545; color: white; }
.btn-close-pop { background: transparent; color: #999; font-size: 14px; cursor: pointer; padding: 0;}

/* Dodaj do style.css */

.search-input {
    width: 90%;
    padding: 5px;
    margin: 5px auto;
    display: block;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 13px;
}

.sidebar-filters {
    padding: 10px;
    background: #f1f3f4;
    border-bottom: 1px solid #e0e0e0;
    font-size: 12px;
}

.sidebar-filters label {
    display: block;
    margin-bottom: 4px;
    cursor: pointer;
    color: #555;
}

.sidebar-header-sub {
    padding: 13px 15px;
    font-weight: bold;
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #eef2f5;
}
.login-box {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 300px;
    text-align: center;
}

/* Nowy układ Top Bar */
.top-bar {
    background: #fff;
    padding: 0 20px;
    height: 60px; /* Stała wysokość */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.nav-controls h2 {
    font-size: 18px;
    margin: 0 10px;
    white-space: nowrap;
}

/* --- SEKCJA FILTRÓW NA GÓRZE --- */
.top-filters {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1; /* Zajmij dostępne miejsce pośrodku */
    justify-content: center;
}

/* Wyszukiwarka */
.search-wrapper {
    position: relative;
}
.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 12px;
}
.search-input-top {
    padding: 6px 10px 6px 30px; /* Miejsce na ikonę */
    border: 1px solid #ccc;
    border-radius: 20px; /* Zaokrąglony kształt */
    font-size: 13px;
    width: 180px;
    outline: none;
    transition: width 0.3s;
}
.search-input-top:focus {
    width: 220px; /* Rozszerza się po kliknięciu */
    border-color: var(--primary-color);
}

/* Checkboxy */
.filter-checkboxes {
    display: flex;
    gap: 10px;
    background: #f8f9fa;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid #eee;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    margin: 0;
    color: #555;
}
.filter-label input {
    margin: 0;
    cursor: pointer;
}
.filter-label:hover {
    color: #000;
}

/* Prawa sekcja */
.actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ADMIN PANEL */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}
.tab-link {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    border-bottom: 2px solid transparent;
}
.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: bold;
}
.tab-content { display: none; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.admin-table th, .admin-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}
.admin-table th { background: #f9f9f9; font-weight: 600; }

.stats-grid {
    display: flex;
    gap: 20px;
}
.stat-card {
    background: #fff;
    border: 1px solid #eee;
    padding: 20px;
    flex: 1;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.stat-number { font-size: 32px; font-weight: bold; margin-top: 10px; }
.stat-text { font-size: 18px; margin-top: 10px; font-weight: 500;}
.text-warning { color: #ffc107; }
.text-success { color: #28a745; }

.header-day.holiday {
    background-color: #ffebee; /* Jasny róż */
    color: #d32f2f; /* Ciemny czerwony tekst */
    font-weight: bold;
    border-bottom: 2px solid #d32f2f;
}
.user-name-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 5px;
    font-weight: 500;
}

/* Nowe style dla licznika */
.user-stats {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
}

.limit-badge-ok {
    background-color: #e6f4ea;
    color: #1e7e34; /* Zielony */
}

.limit-badge-low {
    background-color: #fff3cd;
    color: #856404; /* Żółty/Pomarańczowy */
}

.limit-badge-neg {
    background-color: #f8d7da;
    color: #721c24; /* Czerwony - przekroczenie */
}

/* W style.css */
.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: #fff;
    display: inline-block;
}
.status-PENDING { background-color: #ffc107; color: #333; }
.status-APPROVED { background-color: #28a745; }
.status-REJECTED { background-color: #dc3545; }
.status-CANCELLED { background-color: #6c757d; }