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

/* trójmiejskipadel.pl — restrained palette, avoid “template” gradients */
:root {
    --color-navy: #002B5B;
    --color-royal: #0056b3;
    --color-cyan: #00AEEF;
    --color-lime: #A4D431;
    --color-lime-dark: #8ab82a;
    --color-text-on-dark: #f2f5f8;
    --page-bg: #c9d4df;
    --surface-muted: #eef1f4;
    --accent-border: #7a9ab8;
    --accent-highlight: var(--color-lime);
    --focus-ring: rgba(0, 86, 179, 0.25);
    --availability-text-color: #2f3d4d;
    --availability-text-color-dark: #d6dde6;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--page-bg);
    min-height: 100vh;
    padding: 24px 16px;
    color: #1a1d21;
    line-height: 1.5;
}

.container {
    max-width: 920px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 43, 91, 0.06), 0 8px 40px rgba(0, 43, 91, 0.08);
    overflow: hidden;
    border: 1px solid rgba(0, 43, 91, 0.08);
}

header {
    position: relative;
    overflow: hidden;
    background: var(--color-navy);
    color: var(--color-text-on-dark);
    padding: 0.9rem 1rem 1rem;
    border-bottom: 3px solid var(--accent-highlight);
}

/* Flat, non-gradient header texture accents. */
header::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 84% 28%, rgba(255, 255, 255, 0.12) 1px, transparent 2px) 0 0 / 14px 14px;
    opacity: 0.45;
}

/* Kinetic baseline streak, like ball/racket motion trail. */
header::after {
    content: none;
}

.header-inner {
    position: relative;
    z-index: 1;
    max-width: 36rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.55rem;
}

.header-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    margin: 0 auto;
}

.header-logo-link:focus-visible {
    outline: 2px solid var(--color-lime);
    outline-offset: 6px;
    border-radius: 4px;
}

.header-logo {
    display: block;
    width: auto;
    height: 146px;
    max-width: 360px;
    max-height: 200px;
    margin: 0 auto;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.26));
}

.header-titles {
    width: 100%;
    max-width: 26rem;
}

header h1 {
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    color: #fff;
    text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.header-tagline {
    font-size: 0.78rem;
    font-weight: 400;
    line-height: 1.45;
    color: rgba(242, 245, 248, 0.82);
    margin: 0;
}

.lang-switch {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(242, 245, 248, 0.55);
    margin-bottom: 0.1rem;
    order: -1;
}

.lang-sep {
    color: rgba(242, 245, 248, 0.35);
    user-select: none;
}

.lang-switch-label {
    margin-right: 0.15rem;
}

.lang-btn {
    padding: 0.2rem 0.35rem;
    font: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    border-radius: 0;
    background: transparent;
    color: rgba(242, 245, 248, 0.75);
    cursor: pointer;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.lang-btn:hover {
    color: #fff;
}

.lang-btn.lang-switch-active {
    color: #fff;
    font-weight: 600;
    border-bottom-color: var(--color-lime);
    background: transparent;
}

.controls {
    padding: 2rem 1.5rem 2.25rem;
    background: var(--surface-muted);
    border-bottom: 1px solid #dce2e8;
}

.controls h2 {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
    color: var(--color-royal);
}

.club-selection {
    margin-bottom: 30px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.club-selection .checkbox-group {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 10px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    border: 1px solid var(--accent-border);
    font-size: 0.9375rem;
}

.checkbox-group label:hover {
    border-color: var(--accent-highlight);
    background: #fff;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-highlight);
}

/* Parent club row: same .checkbox-group label styling + bold name */
.club-parent-label {
    font-weight: 600;
}

/* Nested under parent; siblings inside #club-checkbox-group */
.club-subtypes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding-left: 28px;
    margin-top: -4px;
}

.club-subtype-label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid var(--accent-border);
    font-size: 0.9em;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.club-subtype-label:hover {
    border-color: var(--accent-highlight);
    background: #e8ecf0;
}

.date-selection {
    margin-bottom: 30px;
}

.date-selection input[type="date"] {
    width: 100%;
    max-width: 300px;
    padding: 10px 12px;
    font-size: 0.9375rem;
    border: 1px solid #c5cdd6;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.date-selection input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.duration-selection {
    margin-bottom: 30px;
}

.duration-select {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    font-size: 1em;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.duration-select:focus {
    outline: none;
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.time-range-selection {
    margin-bottom: 30px;
}

.time-range-selection .optional-label {
    font-weight: normal;
    color: #6c757d;
    font-size: 0.9em;
}

.time-range-inputs {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.time-range-inputs label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-range-inputs .time-select {
    min-width: 5rem;
    padding: 8px 10px;
    font-size: 0.9375rem;
    border: 1px solid #c5cdd6;
    border-radius: 4px;
    background: white;
    cursor: pointer;
}

.time-range-inputs .time-select:focus {
    outline: none;
    border-color: var(--accent-border);
}

.search-btn {
    width: 100%;
    max-width: 300px;
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-text-on-dark);
    background: var(--accent-highlight);
    border: 1px solid var(--color-navy);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, filter 0.15s ease;
}

.search-btn:hover {
    filter: saturate(1.08) brightness(1.04);
}

.search-btn:active {
    filter: brightness(0.92);
}

.loading {
    padding: 60px;
    text-align: center;
}

.loading.hidden {
    display: none;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--accent-border);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.results {
    padding: 2rem 1.5rem 2.5rem;
    color: #1a1d21;
}

.results-page-title {
    margin-bottom: 1.25rem;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--color-royal);
}

.club-results {
    margin-bottom: 28px;
    background: var(--surface-muted);
    border-radius: 6px;
    padding: 1.25rem 1.25rem 1.5rem;
    border: 1px solid var(--accent-border);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.04);
}

.club-results h2 {
    color: var(--color-navy);
    margin-bottom: 20px;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 4px solid var(--accent-highlight);
    padding-left: 10px;
}

.club-results-with-subtypes h2 {
    margin-bottom: 12px;
}

.club-results-subtype {
    margin-top: 16px;
}

.club-results-subtype:first-of-type {
    margin-top: 0;
}

.club-results-subtype-title {
    color: var(--color-navy);
    font-size: 1.15em;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #dee2e6;
}

.club-results-with-subtypes .club-results-subtype .no-availability {
    padding: 12px;
}

a.club-results-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

a.club-results-link:hover .club-results {
    border-color: var(--accent-highlight);
    background: #e8ecf0;
}

.no-availability {
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.availability-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.slot-card {
    background: white;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid var(--accent-border);
    border-top: 3px solid var(--color-cyan);
    transition: border-color 0.15s ease;
}

.slot-card:hover {
    border-color: var(--accent-highlight);
}

.slot-time {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--availability-text-color);
    margin-bottom: 6px;
}

.slot-court {
    color: var(--color-navy);
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 4px;
    padding: 2px 6px;
    background: #e9ecef;
    border-radius: 4px;
    display: inline-block;
}

.slot-duration {
    color: var(--availability-text-color);
    opacity: 0.82;
    font-size: 0.85em;
    margin-bottom: 4px;
}

.slot-price {
    color: var(--color-lime-dark);
    font-weight: 600;
    font-size: 1em;
}

.error {
    background: #fff3f4;
    color: #7a1f26;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #f0a7ae;
}

@media (prefers-color-scheme: dark) {
    body {
        background: #1a2229;
        color: #e9ecef;
    }

    header {
        background: var(--color-navy);
        border-bottom-color: var(--accent-highlight);
    }

    .container {
        background: #1e1e1e;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
        border-color: rgba(255, 255, 255, 0.06);
    }

    .controls {
        background: #2d2d2d;
        border-bottom: 1px solid #404040;
    }

    .controls h2 {
        color: #e9ecef;
    }

    .checkbox-group label {
        background: #2d2d2d;
        border-color: #404040;
        color: #e9ecef;
    }

    .checkbox-group label:hover {
        border-color: var(--accent-border);
        background: #353535;
    }

    .club-subtype-label {
        background: #383838;
        border-color: #4a4a4a;
        color: #e9ecef;
    }

    .club-subtype-label:hover {
        border-color: var(--accent-border);
        background: rgba(0, 174, 239, 0.12);
    }

    .date-selection input[type="date"],
    .duration-select {
        background: #2d2d2d;
        border-color: #404040;
        color: #e9ecef;
    }

    .date-selection input[type="date"]:focus,
    .duration-select:focus {
        border-color: var(--accent-border);
        background: #353535;
    }

    .club-results {
        background: #2d2d2d;
        border-color: #404040;
    }

    .club-results h2 {
        color: #e9ecef;
        border-left-color: var(--accent-highlight);
    }

    .club-results-subtype-title {
        color: #e9ecef;
        border-bottom-color: #404040;
    }

    a.club-results-link:hover .club-results {
        border-color: var(--color-cyan);
        background: #2a3238;
    }

    .no-availability {
        color: #adb5bd;
    }

    .slot-card {
        background: #2d2d2d;
        border-color: #404040;
        color: #e9ecef;
    }

    .slot-card:hover {
        border-color: var(--accent-border);
        background: #353535;
    }

    .slot-time {
        color: var(--availability-text-color-dark);
    }

    .slot-court {
        color: #e9ecef;
        background: #404040;
    }

    .slot-duration {
        color: var(--availability-text-color-dark);
        opacity: 0.85;
    }

    .slot-price {
        color: var(--color-lime);
    }

    .error {
        background: #3d1f1f;
        color: #ff6b6b;
        border-color: #5a2a2a;
    }

    .results {
        color: #e9ecef;
    }

    .results h2,
    .results-page-title {
        color: #e9ecef;
    }

    .spinner {
        border-color: #2d2d2d;
        border-top-color: var(--accent-border);
    }

    .time-range-selection .optional-label {
        color: #adb5bd;
    }

    .time-range-inputs .time-select {
        background: #2d2d2d;
        border-color: #404040;
        color: #e9ecef;
    }

    .time-range-inputs .time-select:focus {
        border-color: var(--accent-border);
        background: #353535;
    }

    .time-range-inputs label {
        color: #e9ecef;
    }

    .loading {
        color: #e9ecef;
    }
}

/* Tablet and small desktop: slightly smaller cells */
@media (max-width: 900px) {
    .availability-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .slot-card {
        padding: 10px;
    }

    .slot-time {
        font-size: 1em;
        margin-bottom: 4px;
    }

    .slot-court,
    .slot-duration,
    .slot-price {
        font-size: 0.8em;
    }
}

/* Mobile: compact layout, multiple cells per row */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header {
        padding: 10px 10px;
    }

    .header-inner {
        gap: 0.65rem;
    }

    .lang-switch {
        margin-bottom: 0;
    }

    .header-logo {
        height: 122px;
        max-width: 300px;
        max-height: 170px;
    }

    header h1 {
        font-size: 1.02em;
        margin-bottom: 4px;
    }

    header p {
        font-size: 0.75em;
    }

    .controls {
        padding: 16px;
    }

    .controls h2 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }

    .club-selection,
    .date-selection,
    .duration-selection,
    .time-range-selection {
        margin-bottom: 16px;
    }

    .checkbox-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .club-selection .checkbox-group {
        flex-direction: column;
        flex-wrap: nowrap;
    }

    .checkbox-group label {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .checkbox-group input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    .date-selection input[type="date"] {
        padding: 10px 12px;
        font-size: 0.95em;
    }

    .time-range-inputs .time-select {
        min-width: 4rem;
        padding: 8px 10px;
        font-size: 0.9em;
    }

    .search-btn {
        padding: 12px 20px;
        font-size: 1em;
    }

    .results {
        padding: 16px;
    }

    .club-results {
        margin-bottom: 20px;
        padding: 16px;
        border-radius: 8px;
    }

    .club-results h2 {
        margin-bottom: 12px;
        font-size: 1.2em;
    }

    .availability-grid {
        grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
        gap: 8px;
        margin-top: 12px;
    }

    .slot-card {
        padding: 8px;
        border-radius: 6px;
        border-width: 1px;
    }

    .slot-time {
        font-size: 0.95em;
        margin-bottom: 2px;
    }

    .slot-court {
        font-size: 0.75em;
        padding: 2px 4px;
        margin-bottom: 2px;
    }

    .slot-duration {
        font-size: 0.75em;
        margin-bottom: 2px;
    }

    .slot-price {
        font-size: 0.85em;
    }

    .no-availability {
        padding: 12px;
        font-size: 0.9em;
    }

    .error {
        padding: 12px;
        font-size: 0.9em;
    }

    .loading {
        padding: 30px;
    }

    .spinner {
        width: 36px;
        height: 36px;
        border-width: 3px;
        margin-bottom: 12px;
    }
}

/* Very small phones: max cells per row */
@media (max-width: 400px) {
    body {
        padding: 6px;
    }

    header {
        padding: 10px 8px;
    }

    header h1 {
        font-size: 0.95em;
    }

    header p {
        font-size: 0.7em;
    }

    .header-logo {
        height: 100px;
        max-width: 250px;
        max-height: 140px;
    }

    .controls {
        padding: 12px;
    }

    .availability-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 6px;
    }

    .slot-card {
        padding: 6px;
    }

    .slot-time {
        font-size: 0.9em;
    }

    .slot-court,
    .slot-duration {
        font-size: 0.7em;
    }

    .slot-price {
        font-size: 0.8em;
    }
}
