:root {
    --primary-blue: #1a3a5f; /* Ciemniejszy niebieski */
    --accent-blue: #2c5282;
    --white: #ffffff;
    --light-gray: #f7fafc;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.background-overlay {
    /* Zdjęcie tematyczne: parking/parkomat */
    background: linear-gradient(rgba(26, 58, 95, 0.7), rgba(26, 58, 95, 0.7)),
                url('https://images.unsplash.com/photo-1506521781263-d8422e82f27a?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin: auto;
}

h1 {
    color: var(--primary-blue);
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

.subtitle {
    color: #666;
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-blue);
    font-weight: 600;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary-blue);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.login-btn:hover {
    background-color: var(--accent-blue);
}

/* Dashboard Menu Styles */
.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 25px;
}

.menu-item {
    position: relative;
    display: inline-block;
}

.dash-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: var(--primary-blue);
    color: var(--white);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, background-color 0.3s;
    border: none;
    width: 100%;
    cursor: pointer;
    font-size: 0.9rem;
    height: 60px;
    box-sizing: border-box;
}

.dash-btn:hover {
    background-color: var(--accent-blue);
    transform: translateY(-3px);
}

/* Dropdown Menu */
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
    border-radius: 8px;
    margin-top: 5px;
}

.dropdown-content a {
    color: var(--primary-blue);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover { background-color: #f1f1f1; border-radius: 8px; }
.dropdown-content.show-dropdown { display: block; }

/* ============================================
   NOWY LAYOUT: Sidebar + Content
   ============================================ */

body, html { height: 100%; }

.app-layout {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar - pasek nawigacyjny po lewej */
.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #1a3a5f 0%, #2c5282 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-brand-logo {
    font-size: 1.6rem;
}
.sidebar-brand-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-user {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.sidebar-user-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    word-break: break-word;
}
.sidebar-user-role {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.1);
    padding: 3px 8px;
    border-radius: 4px;
    align-self: flex-start;
}
.sidebar-controls {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.sidebar-controls .lang-select {
    flex: 1;
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.15);
    font-size: 0.8rem;
    padding: 5px 6px;
}
.sidebar-controls .lang-select option {
    color: #1a202c;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    color: rgba(255,255,255,0.9);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    transition: background-color 0.2s, color 0.2s;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-item.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
}
.nav-item-icon {
    font-size: 1.15rem;
    width: 22px;
    text-align: center;
}
.nav-item-label { flex: 1; }
.nav-item-arrow {
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.nav-item.expanded .nav-item-arrow {
    transform: rotate(90deg);
}

.nav-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 4px 0 6px 14px;
    margin-left: 14px;
    border-left: 2px solid rgba(255,255,255,0.12);
}
.nav-submenu.open { display: flex; }

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: transparent;
    color: rgba(255,255,255,0.8);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 500;
    text-align: left;
    transition: background-color 0.2s, color 0.2s;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
}
.nav-subitem:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.nav-subitem.active {
    background: rgba(255,255,255,0.18);
    color: #fff;
}
.nav-subitem-icon {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: rgba(229,62,62,0.85);
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
.sidebar-logout:hover {
    background: rgba(229,62,62,1);
    color: #fff;
}

/* Glowna czesc z trescia */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 20px 24px;
    overflow-y: auto;
    height: 100vh;
    box-sizing: border-box;
}

.dashboard-header {
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 12px;
    padding: 18px 24px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    margin-bottom: 18px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.dashboard-header h1 {
    color: var(--primary-blue);
    margin: 0 0 4px 0;
    font-size: 1.4rem;
    font-weight: 700;
}
.dashboard-header p {
    margin: 0;
    font-size: 0.9rem;
    color: #4a5568;
}

.dashboard-content {
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    padding: 22px 26px;
    flex: 1;
    min-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ============================================
   UNIWERSALNY LAYOUT EKRANÓW
   ============================================ */
.management-screen {
    display: none;
    flex-direction: column;
    width: 100%;
    flex: 1;
    min-height: 0;
    animation: fadeInScreen 0.25s ease;
}
.management-screen.active,
.management-screen[style*="display: flex"],
.management-screen[style*="display:flex"] {
    display: flex !important;
}
.management-screen > h2:first-child {
    margin-top: 0;
    color: var(--primary-blue);
    margin-bottom: 14px;
    font-size: 1.55rem;
    font-weight: 700;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Pasek filtrów / akcji u góry ekranu */
.screen-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
    width: 100%;
    flex-shrink: 0;
}
.screen-filters .search-input { margin-bottom: 0; }
.screen-filters > .search-input[style*="flex:1"],
.screen-filters > input[type="text"] { flex: 1; min-width: 180px; }

/* Główna zawartość ekranu - elastyczny kontener */
.screen-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* Karty / sekcje w obrębie ekranu */
.screen-card {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 18px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.screen-card h3 {
    margin: 0 0 10px 0;
    color: var(--primary-blue);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 6px;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
}

/* Kafelki statystyk na górze ekranu */
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
    flex-shrink: 0;
}
.stat-tile {
    background: var(--secondary-bg);
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    text-align: center;
}
.stat-tile .stat-label {
    font-size: 0.7rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}
.stat-tile .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2px;
}

/* Lista, która wypełnia dostępne miejsce */
.employee-list,
.screen-list {
    width: 100%;
    flex: 1;
    min-height: 240px;
    overflow-y: auto;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

/* Przycisk "Wstecz" - spójny wygląd na dole ekranu */
.screen-footer {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}
.back-btn {
    margin-top: 0;
    background-color: #6c757d;
    padding: 10px 28px;
    min-width: 220px;
}
.back-btn:hover {
    background-color: #5a6268;
}

/* Layout dwukolumnowy */
.screen-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    flex: 1;
    min-height: 0;
    width: 100%;
}
.screen-two-col > .screen-card { min-height: 0; }
@media (max-width: 900px) {
    .screen-two-col { grid-template-columns: 1fr; }
}

/* Animacja przejść między ekranami */
@keyframes fadeInScreen {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Mapa - większa i responsywna */
#viewMapId,
#mapid,
.ctrlDetailsRouteMap,
.view-route-map {
    width: 100%;
    height: 100%;
    min-height: 380px;
    flex: 1;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}
.map-wrap {
    flex: 1;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

/* Statystyki - bez limitu szerokości */
.stats-display {
    text-align: left;
    width: 100%;
    background: var(--secondary-bg);
    padding: 20px 22px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Responsywnosc */
@media (max-width: 768px) {
    .app-layout { flex-direction: column; }
    .app-sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }
    .app-main {
        height: auto;
        padding: 12px;
    }
}

/* Style paskow przewijania w sidebarze */
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 10px; }

/* ============================================
   KARTY KONTROLERÓW (ekran Kontrolerzy)
   ============================================ */
.kontroler-card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.kontroler-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-color: var(--accent-blue) !important;
}
@media (max-width: 600px) {
    .kontroler-card {
        flex-wrap: wrap;
    }
    .kontroler-card > div:last-child {
        flex-direction: row !important;
        width: 100%;
        margin-top: 10px;
    }
}

/* ============================================
   GRAFIK: przełącznik widoku i kalendarz
   ============================================ */
.grafik-view-toggle {
    display: inline-flex;
    background: var(--secondary-bg);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border-color);
    gap: 3px;
}
.grafik-view-toggle button {
    background: transparent;
    color: var(--text-color);
    border: none;
    padding: 7px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-weight: 500;
}
.grafik-view-toggle button.active {
    background: var(--primary-blue);
    color: var(--white);
    box-shadow: 0 2px 6px rgba(26, 58, 95, 0.25);
}
.grafik-view-toggle button:hover:not(.active) {
    background: rgba(26, 58, 95, 0.08);
}

.grafik-calendar-wrap {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    margin-top: 5px;
    width: 100%;
    box-sizing: border-box;
}
#grafikCalendar {
    width: 100%;
    box-sizing: border-box;
}
.grafik-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.grafik-calendar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 0;
}
.grafik-calendar-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}
.grafik-calendar-nav button {
    background: var(--secondary-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.grafik-calendar-nav button:hover {
    background: var(--accent-blue);
    color: var(--white);
    border-color: var(--accent-blue);
}
.grafik-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
}
.grafik-calendar-weekday {
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary-blue);
    padding: 8px 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}
.grafik-calendar-cell {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 92px;
    min-width: 0;
    padding: 6px 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}
.grafik-calendar-cell:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.grafik-calendar-cell.empty {
    background: transparent;
    border-color: transparent;
    cursor: default;
    min-height: 92px;
}
.grafik-calendar-cell.empty:hover {
    transform: none;
    box-shadow: none;
}
.grafik-calendar-cell.today {
    border: 2px solid var(--primary-blue);
    background: rgba(26, 58, 95, 0.05);
}
.grafik-calendar-cell .day-num {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-blue);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.grafik-calendar-cell .day-count {
    background: var(--accent-blue);
    color: var(--white);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}
.grafik-calendar-shift {
    font-size: 0.72rem;
    padding: 2px 5px;
    background: rgba(44, 82, 130, 0.12);
    color: var(--text-color);
    border-left: 3px solid var(--accent-blue);
    border-radius: 3px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.1s ease;
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 0;
}
.grafik-calendar-shift:hover {
    background: rgba(44, 82, 130, 0.25);
}
.grafik-calendar-shift .shift-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}
.grafik-calendar-shift .shift-hours {
    color: #718096;
    font-size: 0.68rem;
    flex-shrink: 0;
}
.grafik-calendar-shift .shift-action {
    border: none;
    background: transparent;
    color: var(--accent-blue);
    padding: 0 2px;
    font-size: 0.78rem;
    cursor: pointer;
    border-radius: 3px;
    line-height: 1;
    flex-shrink: 0;
    transition: background 0.1s ease, color 0.1s ease;
}
.grafik-calendar-shift .shift-action:hover {
    background: rgba(44, 82, 130, 0.25);
    color: var(--primary-blue);
}
.grafik-calendar-shift .shift-action.del:hover {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.15);
}
.grafik-calendar-more {
    font-size: 0.7rem;
    color: var(--accent-blue);
    font-weight: 600;
    margin-top: 2px;
    cursor: pointer;
}
@media (max-width: 768px) {
    .grafik-calendar-cell {
        min-height: 64px;
        padding: 4px;
    }
    .grafik-calendar-shift {
        font-size: 0.62rem;
        padding: 1px 3px;
        gap: 1px;
    }
    .grafik-calendar-shift .shift-hours {
        display: none;
    }
    .grafik-calendar-shift .shift-action {
        font-size: 0.7rem;
        padding: 0 1px;
    }
}