/**
 * grid-main.css
 *
 * Main grid page styling
 */

/* Global reset scoped to grid contexts */
#grid-page *, .pw-grid-scope * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body styles scoped: body.grid-template for PW site, .pw-grid-scope for WP plugin */
body.grid-template, .pw-grid-scope {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f7fb;
    color: #2c3e50;
}

body.grid-template {
    overflow-x: hidden;
}

/* Full-page layout for grid + overlays */
#grid-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #f0f2f5;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    display: flex;
    flex-direction: column;
}

#grid-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

#grid-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Header (from Grid One style) */
.grid-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 40px;
    box-sizing: border-box;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.grid-header h1 {
    margin: 0;
    font-family: "Times New Roman", serif;
    font-style: italic;
    font-size: 32px;
    color: #000;
    pointer-events: auto;
}

.grid-header .filters-btn {
    background: #fff;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    pointer-events: auto;
}

/* Filter Bar (Grid One style, but wired to Alpine) */
.filter-bar {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    background: #fff;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    pointer-events: auto;
    box-sizing: border-box;
    opacity: 1;
    transform: translate(-50%, 0);
    transition: opacity 200ms ease, transform 200ms ease;
}
.filter-bar.is-hidden {
    opacity: 0;
    transform: translate(-50%, -8px);
    pointer-events: none;
    visibility: hidden;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #000;
}

.filter-input {
    background: #f5f5f5;
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    width: 100%;
    font-size: 14px;
    color: #444;
    box-sizing: border-box;
}

.filter-input::placeholder {
    color: #999;
}

/* Toggle switch (Grid One style) */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: #212121;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(24px);
}

.filter-coords {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.clear-filters {
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: #000;
    text-decoration: none;
    align-self: flex-start;
}

.clear-filters:hover {
    text-decoration: underline;
}

@media (min-width: 768px) {
    .filter-bar {
        flex-direction: row;
        gap: 40px;
        align-items: center;
        padding: 15px 30px;
    }

    .filter-group {
        width: auto;
    }

    .filter-coords {
        display: flex;
        gap: 10px;
        width: auto;
    }

    .filter-coords .filter-input {
        width: 110px;
    }

    .clear-filters {
        align-self: center;
    }
}