:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --success-color: #22c55e;
    --warning-color: #eab308;
    --danger-color: #ef4444;
    --font-main: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border_box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.background-glob {
    position: fixed;
    top: -20%;
    left: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.15) 0%, rgba(15, 23, 42, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    padding-bottom: 1.5rem;
}

h1 {
    font-weight: 800;
    font-size: 2.5rem;
    letter-spacing: -0.05em;
}

.gradient-text {
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.dot {
    width: 8px;
    height: 8px;
    background-color: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

/* Grid Layout */
.grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    grid-column: 1 / -1;
    /* Span across all columns */
}

@media (max-width: 768px) {
    .grid {
        grid-template-columns: 1fr;
    }

    .occupancy-card {
        order: 1;
    }

    .chart-card {
        order: 2;
    }

    .info-card {
        order: 3;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.875rem;
    }
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

/* Occupancy Card */
.occupancy-display {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

#current-count {
    font-size: 5rem;
    font-weight: 800;
    line-height: 1;
    background: linear-gradient(180deg, #fff 0%, #94a3b8 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.label {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.status-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
}

.status-green {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-orange {
    background: rgba(234, 179, 8, 0.15);
    color: #facc15;
    border: 1px solid rgba(234, 179, 8, 0.2);
}

.status-red {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.last-updated {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: auto;
}

/* Parking Info Styles */
.parking-info {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.parking-status-row,
.parking-countdown-row,
.parking-price-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.parking-price-row {
    margin-bottom: 0;
}

.parking-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.parking-status-badge.paid {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.parking-status-badge.free {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.parking-icon {
    font-size: 1.125rem;
}

.parking-countdown-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.parking-countdown {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.parking-price-row {
    opacity: 0.8;
}

.parking-price-icon {
    font-size: 1rem;
}

.parking-price-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .parking-info {
        padding: 0.875rem;
    }

    .parking-status-badge {
        font-size: 0.8rem;
        padding: 0.4rem 0.85rem;
    }

    .parking-countdown {
        font-size: 1.125rem;
    }

    .parking-price-text {
        font-size: 0.7rem;
    }
}

/* Info Card */
.info-list {
    list-style: none;
}

.info-list li {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.info-list li:last-child {
    margin-bottom: 0;
}

.icon {
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.info-list strong {
    display: block;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.info-list span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Chart Card */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* History Page Styles */
.date-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid rgba(56, 189, 248, 0.2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-icon {
    font-size: 1.25rem;
}

.history-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.nav-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.nav-button:hover:not(.disabled) {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-2px);
}

.nav-button.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.nav-button-home {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(129, 140, 248, 0.15) 100%);
    border-color: rgba(56, 189, 248, 0.3);
    box-sizing: border-box;
}

.nav-button-home:hover {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(129, 140, 248, 0.25) 100%);
    border-color: rgba(56, 189, 248, 0.5);
}

.arrow {
    font-size: 1.125rem;
}

.chart-info {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .history-nav {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .history-nav .nav-button {
        width: 100%;
        justify-content: center;
    }
}

/* Statistics Page Styles */
.day-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.day-button {
    padding: 1.25rem 1.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.day-button:hover {
    background: rgba(56, 189, 248, 0.1);
    border-color: rgba(56, 189, 248, 0.3);
    transform: translateY(-2px);
}

.day-button.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.25) 0%, rgba(129, 140, 248, 0.25) 100%);
    border-color: rgba(56, 189, 248, 0.5);
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
}

.selected-day-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    text-align: center;
}

.selected-day-label strong {
    color: var(--accent-color);
    font-weight: 600;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    header>div:last-child {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start !important;
    }

    .nav-button {
        flex: 1;
        min-width: calc(50% - 0.5rem);
        justify-content: center;
    }

    .live-indicator {
        width: 100%;
        justify-content: center;
    }

    .day-selector {
        grid-template-columns: repeat(4, 1fr);
    }

    .day-button {
        padding: 1rem 0.75rem;
        font-size: 0.875rem;
    }
}


/* Latest Image Page Styles */
.latest-page .image-container {
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.latest-page .latest-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.latest-page .source-info {
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .latest-page .container {
        /* Obnovení standardního paddingu pro header */
        padding: 2rem;
        display: flex;
        flex-direction: column;
        height: 100vh;
    }

    .latest-page header {
        flex-shrink: 0;
    }

    .latest-page main {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        /* Negativní margin pro roztažení obsahu (obrázku) do šířky */
        /* 2rem padding containeru - 0.5rem chtěný padding = 1.5rem negativní margin */
        margin-left: -1.5rem;
        margin-right: -1.5rem;
        width: calc(100% + 3rem);
        /* Kompenzace spodního paddingu containeru */
        margin-bottom: -2rem;
    }

    .latest-page .card {
        display: flex;
        flex-direction: column;
        padding: 1rem;
        margin-bottom: 0.5rem;
    }

    .latest-page .source-info {
        font-size: 0.75rem;
        margin-bottom: 0.5rem;
        flex-shrink: 0;
    }

    .latest-page .image-container {
        flex: 1;
        height: auto;
        min-height: 0;
        aspect-ratio: unset;
        border-radius: 0.5rem;
    }

    .latest-page footer {
        display: none;
    }
}

/* Chart Toggle Controls */
.toggle-group {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-btn.active {
    background: var(--accent-color);
    color: white;
    /* Text on accent color should be white/dark depending on contrast, white is safe for blue */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 1rem;
    }

    .toggle-group {
        width: 100%;
    }

    .toggle-btn {
        flex: 1;
        text-align: center;
    }
}