.locations-topbar,
.location-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0 16px;
}

.locations-search,
.location-form,
.location-detail-box,
.location-card,
.location-detail {
    box-sizing: border-box;
}

.locations-search {
    background: #ffffff;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 16px;
}

.locations-search-grid,
.location-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.locations-field,
.location-form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.locations-field label,
.location-form-field label {
    font-weight: 700;
}

.locations-field input,
.locations-field select,
.location-form-field input,
.location-form-field select,
.location-form-field textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 1px solid #bfc4c8;
    border-radius: 7px;
    background: #ffffff;
    padding: 10px;
    font: inherit;
}

.location-form-field textarea {
    resize: vertical;
}

.locations-search-actions,
.location-form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 14px;
}

.locations-result-info {
    margin: 10px 0 14px;
    font-weight: 700;
}

.locations-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.location-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #d8d8d8;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.location-card-image {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #ececec;
}

.location-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.location-image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #666666;
}

.location-image-placeholder span {
    font-size: 40px;
}

.location-image-count {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    font-size: 12px;
}

.location-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 14px;
}

.location-category,
.location-detail-category {
    font-size: 13px;
    font-weight: 700;
    color: #555555;
}

.location-card-title {
    margin: 7px 0;
    font-size: 20px;
    line-height: 1.25;
}

.location-card-title a {
    color: inherit;
    text-decoration: none;
}

.location-address,
.location-address-full {
    color: #555555;
    font-style: normal;
    line-height: 1.5;
}

.location-description {
    margin-top: 10px;
    line-height: 1.5;
    flex: 1;
}

.location-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.location-rating {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px;
}

.location-star {
    color: #c8c8c8;
    font-size: 18px;
}

.location-star.active,
.location-rating-button.selected,
.location-rating-button.hovered {
    color: #f2b400;
}

.location-rating-text {
    margin-left: 6px;
    color: #555555;
    font-size: 13px;
}

.locations-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.locations-page-info {
    font-weight: 700;
}

.location-detail {
    margin-top: 12px;
}

.location-detail-header {
    margin-bottom: 14px;
}

.location-detail-header h1 {
    margin: 5px 0 0;
}

.location-status-note,
.location-login-note,
.location-form-note,
.location-empty {
    margin-top: 10px;
    padding: 10px;
    border-radius: 7px;
    background: #f3f3f3;
}

.location-gallery {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    grid-auto-rows: 170px;
    gap: 8px;
    margin-bottom: 18px;
}

.location-gallery-item {
    display: block;
    overflow: hidden;
    border-radius: 9px;
    background: #e9e9e9;
}

.location-gallery-main {
    grid-row: span 2;
}

.location-gallery-item img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.location-gallery-item:hover img {
    transform: scale(1.03);
}

.location-gallery-placeholder {
    grid-column: 1 / -1;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 10px;
    background: #eeeeee;
    color: #666666;
}

.location-gallery-placeholder span {
    font-size: 48px;
}

.location-detail-columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 16px;
    align-items: start;
}

.location-detail-box,
.location-form-box {
    background: #ffffff;
    border: 1px solid #d8d8d8;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 16px;
}

.location-detail-box h2,
.location-form-box h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 19px;
}

.location-detail-description,
.location-opening-hours {
    line-height: 1.6;
}

.location-contact-row + .location-contact-row {
    margin-top: 8px;
}

.location-rating-section {
    margin-top: 16px;
}

.location-rating-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.location-rating-large .location-star {
    font-size: 30px;
}

.location-rating-form {
    margin-top: 14px;
}

.location-rating-label {
    margin-bottom: 6px;
    font-weight: 700;
}

.location-rating-input {
    display: flex;
    gap: 4px;
}

.location-rating-button {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 0;
    color: #c8c8c8;
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
}

.location-rating-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.location-rating-message,
.location-form-message {
    margin-top: 10px;
}

.location-rating-message.is-success,
.location-form-message.is-success {
    color: #166534;
    font-weight: 700;
}

.location-rating-message.is-error,
.location-form-message.is-error {
    color: #b91c1c;
    font-weight: 700;
}

.location-detail-meta {
    color: #666666;
    font-size: 13px;
    text-align: right;
    margin-top: 10px;
}

.location-form {
    margin-top: 12px;
}

.location-form-field-wide {
    grid-column: 1 / -1;
}

.location-existing-images,
.location-image-preview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.location-existing-image,
.location-image-preview-item {
    border: 1px solid #d8d8d8;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
}

.location-existing-image img,
.location-image-preview-item img {
    width: 100%;
    height: 130px;
    display: block;
    object-fit: cover;
}

.location-image-delete {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    font-size: 13px;
}

.location-image-preview-item small {
    display: block;
    padding: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-lightbox-open {
    overflow: hidden;
}

.location-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.9);
}

.location-lightbox-dialog {
    position: relative;
    max-width: 95vw;
    max-height: 92vh;
}

.location-lightbox-image {
    display: block;
    max-width: 95vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 6px;
}

.location-lightbox-caption {
    padding-top: 10px;
    color: #ffffff;
    text-align: center;
}

.location-lightbox-close,
.location-lightbox-prev,
.location-lightbox-next {
    position: absolute;
    border: 0;
    background: rgba(0, 0, 0, 0.62);
    color: #ffffff;
    cursor: pointer;
}

.location-lightbox-close {
    top: -14px;
    right: -14px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    font-size: 30px;
    line-height: 1;
}

.location-lightbox-prev,
.location-lightbox-next {
    top: 50%;
    width: 46px;
    height: 60px;
    transform: translateY(-50%);
    font-size: 42px;
    line-height: 1;
}

.location-lightbox-prev {
    left: 8px;
}

.location-lightbox-next {
    right: 8px;
}

@media (max-width: 950px) {
    .locations-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .location-detail-columns {
        grid-template-columns: 1fr;
    }

    .location-gallery {
        grid-template-columns: 2fr 1fr;
    }

    .location-existing-images,
    .location-image-preview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 650px) {
    .locations-search-grid,
    .location-form-grid,
    .locations-grid {
        grid-template-columns: 1fr;
    }

    .location-form-field-wide {
        grid-column: auto;
    }

    .locations-search-actions,
    .location-form-actions {
        justify-content: stretch;
    }

    .locations-search-actions .formbutton,
    .location-form-actions .formbutton {
        flex: 1;
        text-align: center;
    }

    .location-gallery {
        grid-template-columns: 1fr 1fr;
        grid-auto-rows: 140px;
    }

    .location-gallery-main {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 220px;
    }

    .location-card-footer {
        align-items: flex-start;
    }

    .location-existing-images,
    .location-image-preview {
        grid-template-columns: 1fr 1fr;
    }

    .location-lightbox {
        padding: 8px;
    }

    .location-lightbox-prev,
    .location-lightbox-next {
        width: 38px;
        height: 52px;
        font-size: 34px;
    }
}