/* =========================================
   BORROWED BRICKS — Page-Specific Styles
   ========================================= */

/* ---------- Shared Page Layout ---------- */
.page-wrapper {
    min-height: 100vh;
    padding-top: var(--header-height);
}

.page-header {
    padding: var(--space-2xl) 0;
    background: var(--bg-warm);
    border-bottom: 1px solid var(--border-light);
}

.page-title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

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

/* ---------- Review Form Page ---------- */
.review-page {
    background: var(--bg-cream);
}

.review-container {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-lg);
}

/* Progress Steps */
.progress-steps {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-3xl);
}

.progress-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.step-indicator {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-warm);
    border: 2px solid var(--border-medium);
    border-radius: 50%;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    transition: var(--transition-base);
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    display: none;
}

@media (min-width: 640px) {
    .step-label {
        display: block;
    }
}

.progress-step.active .step-indicator {
    background: var(--bg-dark);
    border-color: var(--bg-dark);
    color: var(--text-inverse);
}

.progress-step.active .step-label {
    color: var(--text-primary);
    font-weight: 500;
}

.progress-step.completed .step-indicator {
    background: var(--accent-success);
    border-color: var(--accent-success);
    color: var(--text-inverse);
}

.step-divider {
    width: 40px;
    height: 2px;
    background: var(--border-light);
    margin: 0 var(--space-sm);
    align-self: center;
}

.progress-step.completed+.step-divider {
    background: var(--accent-success);
}

/* Form Card */
.form-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-soft);
}

.form-card-header {
    margin-bottom: var(--space-xl);
}

.form-card-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.form-card-description {
    color: var(--text-secondary);
}

/* Form Fields */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.form-label-optional {
    color: var(--text-tertiary);
    font-weight: 400;
}

.form-input {
    width: 100%;
    height: 52px;
    padding: 0 var(--space-md);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-cream);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
}

.form-input::placeholder {
    color: var(--text-tertiary);
}

.form-input:focus {
    outline: none;
    border-color: var(--bg-dark);
    background: var(--bg-card);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.form-textarea {
    height: auto;
    min-height: 120px;
    padding: var(--space-md);
    resize: vertical;
    line-height: 1.6;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 48px;
}

/* Address Autocomplete */
.address-input-wrapper {
    position: relative;
}

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-medium);
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}

.address-suggestions.visible {
    display: block;
}

.address-suggestion {
    padding: var(--space-md);
    cursor: pointer;
    transition: var(--transition-fast);
    border-bottom: 1px solid var(--border-light);
}

.address-suggestion:last-child {
    border-bottom: none;
}

.address-suggestion:hover,
.address-suggestion.highlighted {
    background: var(--bg-warm);
}

.address-suggestion-main {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.address-suggestion-secondary {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.address-highlight {
    background: rgba(196, 169, 98, 0.3);
    border-radius: 2px;
}

.address-loading {
    padding: var(--space-md);
    text-align: center;
    color: var(--text-tertiary);
}

/* Rating Sliders */
.rating-sliders {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.rating-slider-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.rating-slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-slider-label {
    font-weight: 500;
}

.rating-slider-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.125rem;
    min-width: 36px;
    text-align: right;
}

.rating-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--bg-warm);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.rating-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--bg-dark);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.rating-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.rating-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--bg-dark);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

/* Form Row */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

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

/* Form Actions */
.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-xl);
    padding-top: var(--space-xl);
    border-top: 1px solid var(--border-light);
}

.form-actions .btn {
    min-width: 140px;
}

/* Review Summary */
.review-summary {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.summary-section {
    padding: var(--space-md);
    background: var(--bg-warm);
    border-radius: var(--radius-md);
}

.summary-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.summary-section-content {
    color: var(--text-primary);
}

.summary-ratings {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
}

.summary-rating {
    display: flex;
    justify-content: space-between;
}

.summary-rating-label {
    color: var(--text-secondary);
}

.summary-rating-value {
    font-weight: 600;
}

/* Success Message */
.success-message {
    text-align: center;
    padding: var(--space-2xl);
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 40px;
    height: 40px;
    color: var(--accent-success);
}

.success-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.success-description {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

/* ---------- Photo Upload ---------- */
.photo-upload-zone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    cursor: pointer;
    transition: var(--transition-base);
    background: var(--bg-cream);
}

.photo-upload-zone:hover,
.photo-upload-zone.dragover {
    border-color: var(--bg-dark);
    background: var(--bg-warm);
}

.photo-upload-zone .upload-icon {
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.photo-upload-zone .upload-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.photo-upload-zone .upload-link {
    color: var(--accent-gold);
    text-decoration: underline;
    cursor: pointer;
}

.photo-upload-zone .upload-hint {
    font-size: 0.875rem;
    color: var(--text-tertiary);
}

.photo-previews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.photo-preview {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-warm);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview .photo-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-fast);
}

.photo-preview:hover .photo-remove {
    opacity: 1;
}

.photo-preview .photo-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.photo-preview .photo-progress-bar {
    height: 100%;
    background: var(--accent-success);
    width: 0%;
    transition: width 0.3s ease;
}

.photo-preview.uploaded::after {
    content: '';
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--accent-success);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.photo-preview.upload-failed {
    border: 2px solid var(--accent-error);
}

.upload-error {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    color: var(--accent-error);
    font-size: 0.875rem;
}

/* ---------- Listings Page ---------- */
.listings-page {
    background: var(--bg-cream);
}

.listings-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-xl);
    padding: var(--space-xl) 0;
}

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

/* Filters Sidebar */
.filters-sidebar {
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
    height: fit-content;
}

.filters-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    box-shadow: var(--shadow-soft);
}

.filters-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}

.filters-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.125rem;
}

.filters-clear {
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.filters-clear:hover {
    color: var(--text-primary);
}

.filter-group {
    margin-bottom: var(--space-lg);
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.filter-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
}

.filter-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-medium);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.filter-option.active .filter-checkbox {
    background: var(--bg-dark);
    border-color: var(--bg-dark);
}

.filter-checkbox svg {
    width: 12px;
    height: 12px;
    color: var(--text-inverse);
    opacity: 0;
    transition: var(--transition-fast);
}

.filter-option.active .filter-checkbox svg {
    opacity: 1;
}

.filter-option-label {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.filter-option.active .filter-option-label,
.filter-option:hover .filter-option-label {
    color: var(--text-primary);
}

/* Rating Filter */
.rating-filter {
    display: flex;
    gap: var(--space-xs);
}

.rating-filter-btn {
    flex: 1;
    padding: var(--space-sm) var(--space-xs);
    background: var(--bg-warm);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.rating-filter-btn:hover {
    background: var(--bg-warm-dark);
}

.rating-filter-btn.active {
    background: var(--bg-dark);
    color: var(--text-inverse);
}

/* Listings Grid */
.listings-content {
    min-height: 400px;
}

.listings-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.listings-count {
    color: var(--text-secondary);
}

.listings-count strong {
    color: var(--text-primary);
}

.listings-sort {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.listings-sort label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.listings-sort select {
    padding: var(--space-sm) var(--space-md);
    padding-right: 36px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-lg);
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--space-3xl);
    color: var(--text-secondary);
}

.no-results svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-md);
    opacity: 0.4;
}

/* Mobile Filters Toggle */
.filters-toggle {
    display: none;
    width: 100%;
    margin-bottom: var(--space-lg);
}

@media (max-width: 1024px) {
    .filters-toggle {
        display: flex;
    }

    .filters-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        padding: var(--space-lg);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-base);
    }

    .filters-sidebar.open {
        opacity: 1;
        visibility: visible;
    }

    .filters-card {
        max-width: 320px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ---------- Explore Map Page ---------- */
.explore-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.explore-layout {
    flex: 1;
    display: flex;
    position: relative;
    overflow: hidden;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map Search Overlay */
.map-search-overlay {
    position: absolute;
    top: var(--space-lg);
    left: var(--space-lg);
    right: var(--space-lg);
    max-width: 400px;
    z-index: 1000;
}

.map-search-input {
    width: 100%;
    height: 52px;
    padding: 0 var(--space-md) 0 48px;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-medium);
}

.map-search-input::placeholder {
    color: var(--text-tertiary);
}

.map-search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

/* Map Sidebar */
.map-sidebar {
    width: 400px;
    background: var(--bg-card);
    border-left: 1px solid var(--border-light);
    overflow-y: auto;
    transition: var(--transition-base);
}

.map-sidebar.collapsed {
    width: 0;
    border-left: none;
}

.map-sidebar-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-sidebar-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.125rem;
}

.map-sidebar-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-warm);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition-fast);
}

.map-sidebar-close:hover {
    background: var(--bg-warm-dark);
}

.map-sidebar-content {
    padding: var(--space-lg);
}

/* Map Property Card */
.map-property-card {
    background: var(--bg-warm);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
    cursor: pointer;
    transition: var(--transition-base);
}

.map-property-card:hover {
    box-shadow: var(--shadow-soft);
}

.map-property-card.selected {
    box-shadow: 0 0 0 2px var(--bg-dark);
}

.map-property-image {
    aspect-ratio: 16/9;
    overflow: hidden;
}

.map-property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-property-info {
    padding: var(--space-md);
}

.map-property-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.map-property-location {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.map-property-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.875rem;
}

.map-property-rating svg {
    width: 14px;
    height: 14px;
    fill: var(--accent-gold);
}

/* Map Toggle Button */
.map-toggle-sidebar {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    z-index: 1000;
}

@media (max-width: 768px) {
    .map-sidebar {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 360px;
        transform: translateX(100%);
        z-index: 1001;
    }

    .map-sidebar.open {
        transform: translateX(0);
    }

    .map-search-overlay {
        left: var(--space-md);
        right: var(--space-md);
    }
}

/* Leaflet Custom Styles */
.leaflet-container {
    font-family: var(--font-body);
}

.custom-marker {
    background: var(--bg-dark);
    border: 3px solid var(--bg-card);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-weight: 600;
    font-size: 0.75rem;
    box-shadow: var(--shadow-medium);
    cursor: pointer;
    transition: var(--transition-fast);
}

.custom-marker:hover {
    transform: scale(1.1);
}

.custom-marker.selected {
    background: var(--accent-gold);
    transform: scale(1.2);
}

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-medium);
}

.leaflet-popup-content {
    margin: var(--space-md);
}

.popup-property-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.popup-property-location {
    font-size: 0.875rem;
    color: var(--text-secondary);
}