/* === Variables === */
:root {
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-primary: #0f766e;
    --color-primary-hover: #0d5f59;
    --color-primary-light: #f0fdfa;
    --color-border: #e5e7eb;
    --color-accent: #0f766e;
    --font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: clip;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
    width: 100%;
}

main {
    flex: 1;
    max-width: 100%;
    overflow-x: clip;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* === Header === */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow-x: clip;
}

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

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    text-decoration: none;
}

.logo:hover {
    text-decoration: none;
}

.logo-smart {
    color: var(--color-primary);
}

.logo-dot {
    color: var(--color-text-muted);
    font-weight: 400;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.nav-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.nav-link svg {
    flex-shrink: 0;
}

.nav-link-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-family);
    padding: 0;
}

.nav-logout-form {
    display: inline;
}

/* === My Places (inline in sidebar) === */
.my-place-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--color-border);
}

.my-place-info {
    display: flex;
    flex-direction: column;
}

.my-place-name {
    font-weight: 500;
    font-size: 0.85rem;
}

.my-place-addr {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.my-place-delete {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.my-place-delete:hover {
    color: #dc2626;
}

.add-place-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 0;
    list-style: none;
}

.add-place-toggle::-webkit-details-marker {
    display: none;
}

.add-place-toggle svg {
    color: var(--color-primary);
}

.add-place-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.add-place-form input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
    min-width: 0;
}

.add-place-form input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.add-place-form button {
    padding: 0.5rem 1rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.add-place-form button:hover {
    background: var(--color-primary-hover);
}

.add-place-form button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Footer === */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.footer-sources {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    opacity: 0.7;
}

/* === Hero / Homepage === */
.hero {
    padding: 8rem 0 6rem;
    text-align: center;
    overflow-x: clip;
}

.hero-content h1 {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    max-width: 500px;
    margin: 0 auto 2.5rem;
    line-height: 1.5;
}

.search-form {
    max-width: 520px;
    margin: 0 auto 2.5rem;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.3rem 0.3rem 0.3rem 1rem;
    transition: border-color 0.2s;
    box-shadow: var(--shadow-md);
    max-width: 100%;
}

.search-wrapper:focus-within {
    border-color: var(--color-primary);
}

.search-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 0.75rem 0.5rem;
    font-size: 1rem;
    font-family: var(--font-family);
    background: transparent;
    min-width: 0;
}

.search-button {
    padding: 0.75rem 1.75rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-button:hover {
    background: var(--color-primary-hover);
}

.error-message {
    color: #dc2626;
    margin-top: 1rem;
    font-size: 0.95rem;
}

.hero-features {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.feature svg {
    color: var(--color-primary);
}

/* === Dossier Page === */
.dossier {
    padding: 2rem 0 3rem;
}

.dossier-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    overflow-x: clip;
}

.dossier-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.dossier-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.dossier-header-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.eircode-badge {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 0.15rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.maps-link {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--color-text-muted);
}

.maps-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.search-form-inline {
    margin: 0;
    flex-shrink: 0;
}

.search-form-inline .search-wrapper {
    max-width: 300px;
    box-shadow: var(--shadow);
}

.search-input-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.search-button-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* === Two-Column Dossier Layout === */
.dossier-layout {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    max-width: 100%;
}

.dossier-main {
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-x: clip;
}

.dossier-sidebar {
    width: 380px;
    max-width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* === Key Stats Bar === */
.key-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow);
}

.key-stat {
    display: flex;
    flex-direction: column;
}

.key-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.key-stat-transit {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.key-stat-transit svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.key-stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

/* === Sidebar Cards === */
.sidebar-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.sidebar-card.map-card {
    padding: 0;
    overflow: hidden;
}

.sidebar-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sidebar-card-title svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

/* === Important Places Empty State === */
.important-places-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.travel-example {
    opacity: 0.45;
    pointer-events: none;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.75rem;
}

.travel-item-example {
    border-bottom-style: dashed;
}

/* === Map === */
.sidebar-map {
    height: 350px;
}

.map-toggles {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.map-toggle {
    padding: 0.25rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    font-family: var(--font-family);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.map-toggle.active {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.map-toggle:hover {
    border-color: var(--color-primary);
}

.map-card {
    padding: 0;
    overflow: hidden;
}

.street-view-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 0.5rem 0.75rem;
    margin: 0;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.street-view-title svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.street-view-container {
    height: 360px;
}

.property-marker {
    background: none;
    border: none;
}

/* === Sections === */
.section {
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: -0.02em;
}

.section-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

/* === Cards === */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title-row .card-title {
    margin-bottom: 0;
}

.btn-text {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: none;
    border: none;
    color: var(--color-primary);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
}

.btn-text:hover {
    background: var(--color-primary-light);
}

/* === Neighbourhood Cards === */
.neighbourhood-cards {
    display: flex;
    gap: 0.75rem;
}

.neighbourhood-card {
    flex: 1;
    min-width: 0;
    background: var(--color-surface);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s, transform 0.2s;
}

.neighbourhood-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.neighbourhood-photo {
    height: 120px;
    background-size: cover;
    background-position: center;
    background-color: var(--color-bg);
}

.neighbourhood-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.neighbourhood-info {
    padding: 0.6rem 0.75rem;
}

.neighbourhood-name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.neighbourhood-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.neighbourhood-rating {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    color: #d97706;
    font-weight: 500;
}

.neighbourhood-rating svg {
    color: #d97706;
}

.neighbourhood-walk {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.neighbourhood-walk svg {
    color: var(--color-primary);
}

/* === Sidebar Essentials === */
.essentials-list {
    display: flex;
    flex-direction: column;
}

.essential-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.essential-item:last-child {
    border-bottom: none;
}

.essential-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.essential-details {
    flex: 1;
    min-width: 0;
}

.essential-name {
    display: block;
    font-weight: 500;
    font-size: 0.85rem;
    line-height: 1.3;
}

.essential-type {
    display: block;
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.school-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.5rem 0 0.25rem;
}

.school-section-label:first-child {
    padding-top: 0;
}

.school-meta {
    text-transform: capitalize;
}

.essential-walk {
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.essentials-more {
    margin-top: 0.25rem;
}

.essentials-more-toggle {
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 500;
    cursor: pointer;
    padding: 0.4rem 0;
    list-style: none;
}

.essentials-more-toggle::-webkit-details-marker {
    display: none;
}


/* === Travel Times === */
.travel-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.travel-item:last-child {
    border-bottom: none;
}

.travel-name {
    font-weight: 500;
    font-size: 0.85rem;
    flex: 1;
    min-width: 0;
}

.travel-modes {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.travel-mode {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.travel-mode svg {
    color: var(--color-primary);
}

.travel-delete {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
}

.travel-item:hover .travel-delete {
    opacity: 1;
}

.travel-delete:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* === Stats === */
.stat-row {
    display: flex;
    gap: 2.5rem;
    margin-bottom: 1.25rem;
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-accent);
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* === Sales List === */
.sales-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sale-details-expandable {
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.sale-details-expandable[open] {
    background: var(--color-bg);
}

.sale-details-expandable.sale-exact {
    border-left: 3px solid var(--color-primary);
}

.sale-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.75rem;
    cursor: pointer;
    list-style: none;
    border-radius: var(--radius-sm);
}

.sale-item::-webkit-details-marker {
    display: none;
}

.sale-item:hover {
    background: var(--color-bg);
}

.sale-price {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
    min-width: 100px;
}

.sale-summary {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.sale-address {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sale-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.sale-expanded {
    padding: 0 0.75rem 0.75rem;
}

.sale-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1.5rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.sale-detail {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.detail-value {
    font-size: 0.9rem;
}

.sale-flag {
    color: #dc2626;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-exact {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

/* === Transit Stops === */
.stops-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stop-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.stop-item:hover {
    background: var(--color-bg);
}

.stop-walk {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 80px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.stop-walk svg {
    color: var(--color-primary);
    flex-shrink: 0;
}

.walk-minutes {
    font-weight: 600;
    color: var(--color-text);
}

.stop-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stop-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.route-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.route-tag {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e5e7eb;
    color: var(--color-text);
}

.route-type-0 { background: #fef3c7; color: #92400e; } /* Tram/Luas */
.route-type-2 { background: #d1fae5; color: #065f46; } /* Rail/DART */
.route-type-3 { background: #dbeafe; color: #1e40af; } /* Bus */

/* === Empty State === */
.empty-state {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

/* === BER Badge (ready for future use) === */
.ber-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.ber-a, .ber-b { background: #d1fae5; color: #065f46; }
.ber-c, .ber-d { background: #fef3c7; color: #92400e; }
.ber-e, .ber-f, .ber-g { background: #fee2e2; color: #991b1b; }

/* === Google Places Autocomplete (injected by Google Maps JS) === */
.pac-container {
    max-width: 100vw;
    z-index: 10000;
}

.pac-container::after {
    display: none;
}

/* === Responsive === */

/* Tablet/mobile: single column with interleaved sections */
@media (max-width: 1023px) {
    .dossier-container {
        max-width: 800px;
    }

    .dossier-layout {
        flex-direction: column;
    }

    .dossier-main,
    .dossier-sidebar {
        display: contents;
    }

    /* Mobile order: stats, street view, my places, essentials, for sale, neighbourhoods, prices, schools, transport, map */
    .key-stats              { order: 1; }
    .street-view-card       { order: 2; }
    #my-places-card         { order: 3; }
    .sidebar-essentials     { order: 4; }
    .nearby-listings-card   { order: 5; }
    .section                { order: 6; }
    .prices-card            { order: 7; }
    .sidebar-schools        { order: 8; }
    .sidebar-transport      { order: 9; }
    .sidebar-map-card       { order: 10; }

    /* Reset sizing since display:contents removes the parent boxes */
    .sidebar-card,
    .key-stats,
    .street-view-card,
    .nearby-listings-card,
    .section,
    .prices-card {
        width: 100%;
    }

    .sidebar-map {
        height: 300px;
    }
}

@media (max-width: 640px) {
    .hero {
        padding: 4rem 0 3rem;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .search-form {
        max-width: 100%;
    }

    .search-button {
        padding: 0.75rem 1.25rem;
    }

    .dossier-header {
        flex-direction: column;
    }

    .search-form-inline .search-wrapper {
        max-width: 100%;
    }

    .key-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    .key-stat-wide {
        grid-column: 1 / -1;
    }

    .stat-row {
        flex-direction: column;
        gap: 1rem;
    }

    .sale-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .sale-price {
        min-width: unset;
    }

    .sale-detail-grid {
        grid-template-columns: 1fr;
    }

    .neighbourhood-cards {
        flex-wrap: wrap;
    }

    .neighbourhood-card {
        flex: 1 1 calc(50% - 0.375rem);
        min-width: calc(50% - 0.375rem);
    }

    .neighbourhood-photo {
        height: 90px;
    }

    .neighbourhood-info {
        padding: 0.4rem 0.5rem;
    }

    .neighbourhood-name {
        font-size: 0.8rem;
    }

    .travel-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .travel-modes {
        gap: 0.75rem;
    }

    .add-place-form {
        flex-wrap: wrap;
    }

    .add-place-form input {
        min-width: calc(50% - 0.5rem);
    }

    .hero-features {
        gap: 1.5rem;
    }

    .nearby-listings {
        flex-direction: column;
        overflow-x: visible;
    }

    .nearby-listing-card {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 380px) {
    .neighbourhood-card {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

/* === Auth Pages === */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 3rem 1rem;
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.auth-card-wide {
    max-width: 640px;
}

.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text);
}

.form-hint {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-group textarea {
    resize: vertical;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row-3 {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    text-decoration: none;
    color: white;
}

.btn-block {
    width: 100%;
}

.auth-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* === Alerts === */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.text-muted {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.inline-form {
    display: inline;
}

/* === Dashboard === */
.dashboard {
    padding: 2rem 0 3rem;
}

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

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-section {
    margin-bottom: 2.5rem;
}

.dashboard-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.dashboard-listings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-listing-card {
    display: flex;
    gap: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
    align-items: center;
}

.listing-inactive {
    opacity: 0.6;
}

.dashboard-listing-photo {
    width: 100px;
    height: 75px;
    border-radius: var(--radius-sm);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.dashboard-listing-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    color: var(--color-text-muted);
}

.dashboard-listing-info {
    flex: 1;
    min-width: 0;
}

.dashboard-listing-price {
    font-size: 1.1rem;
    font-weight: 700;
}

.dashboard-listing-details {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.dashboard-listing-address {
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-listing-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.dashboard-listing-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* === Admin Table === */
.admin-table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.admin-table th {
    font-weight: 600;
    background: var(--color-bg);
    white-space: nowrap;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-family);
}

.btn-approve {
    background: #d1fae5;
    color: #065f46;
}

.btn-approve:hover {
    background: #a7f3d0;
}

.btn-reject {
    background: #fee2e2;
    color: #991b1b;
}

.btn-reject:hover {
    background: #fecaca;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-approved {
    background: #d1fae5;
    color: #065f46;
}

.badge-rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* === Enquiries === */
.enquiries-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.enquiry-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.enquiry-unread {
    border-left: 3px solid var(--color-primary);
}

.enquiry-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.enquiry-property {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.25rem;
}

.enquiry-contact {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.enquiry-message {
    font-size: 0.9rem;
    color: var(--color-text);
    background: var(--color-bg);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
}

/* === Listing Hero === */
.listing-hero {
    margin-bottom: 2rem;
}

.listing-gallery {
    margin-bottom: 1.5rem;
}

.listing-gallery-main {
    position: relative;
    height: 450px;
    border-radius: var(--radius);
    overflow: hidden;
    background-color: var(--color-bg);
    cursor: pointer;
}

.listing-gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-counter {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    pointer-events: none;
}

.listing-gallery-thumbs {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.listing-gallery-thumb {
    flex: 0 0 auto;
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    padding: 0;
    background: var(--color-bg);
    transition: border-color 0.15s, opacity 0.15s;
    opacity: 0.6;
}

.listing-gallery-thumb.active {
    border-color: var(--color-primary);
    opacity: 1;
}

.listing-gallery-thumb:hover {
    opacity: 1;
}

.listing-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* === Lightbox === */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.92);
    align-items: center;
    justify-content: center;
}

.lightbox.open {
    display: flex;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    user-select: none;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.15);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}

.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.25);
}

.lightbox-counter {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

/* === Gallery Tabs === */
.gallery-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.gallery-tab {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    font-family: var(--font-family);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.gallery-tab:hover {
    border-color: var(--color-primary);
    color: var(--color-text);
}

.gallery-tab.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.gallery-tab.active svg {
    color: white;
}

.gallery-tab svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: color 0.15s;
}

.gallery-tab-count {
    font-size: 0.75rem;
    opacity: 0.75;
}

/* Floor plan display mode — contain + white bg instead of cover */
.listing-gallery-main.floor-plan-mode {
    background: white;
}

.listing-gallery-main.floor-plan-mode img {
    object-fit: contain;
    padding: 1rem;
}

.lightbox.floor-plan-mode .lightbox-img {
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
}

.listing-hero-info {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.listing-hero-main {
    flex: 1;
}

.listing-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.25rem;
}

.listing-address {
    font-size: 1rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.listing-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.listing-spec {
    padding: 0.3rem 0.75rem;
    background: var(--color-bg);
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.listing-description {
    margin-bottom: 1.5rem;
}

.listing-description h3,
.listing-features h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.listing-description p {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.feature-tag {
    padding: 0.25rem 0.6rem;
    background: var(--color-primary-light);
    color: var(--color-primary);
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* === Listing Agent Card === */
.listing-agent-card {
    width: 300px;
    max-width: 100%;
    flex-shrink: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
}

.listing-agent-card h3 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.agent-name {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.agent-agency {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.agent-contact-details {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.enquiry-form-toggle {
    margin-top: 0.5rem;
}

.enquiry-form-toggle summary {
    list-style: none;
    cursor: pointer;
}

.enquiry-form-toggle summary::-webkit-details-marker {
    display: none;
}

.enquiry-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.enquiry-form input,
.enquiry-form textarea {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
}

.enquiry-form input:focus,
.enquiry-form textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* === Sticky Contact (Mobile) === */
.listing-sticky-contact {
    display: none;
}

/* === Nearby Listings ("For Sale in This Area") === */
.nearby-listings {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    max-width: 100%;
}

.nearby-listing-card {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    max-width: 220px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.nearby-listing-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}

.nearby-listing-photo {
    height: 110px;
    background-size: cover;
    background-position: center;
    background-color: var(--color-bg);
}

.nearby-listing-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.nearby-listing-info {
    padding: 0.6rem 0.75rem;
}

.nearby-listing-price {
    display: block;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.nearby-listing-details {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.nearby-listing-address {
    display: block;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* === Search Page === */
.search-page {
    padding: 2rem 0 3rem;
}

.search-page h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.search-filters {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.filter-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 100px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.filter-group input,
.filter-group select {
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.85rem;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.filter-btn {
    flex-shrink: 0;
}

.results-count {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.search-layout {
    display: flex;
    gap: 1.5rem;
}

.search-results {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-map-container {
    width: 400px;
    max-width: 100%;
    flex-shrink: 0;
    position: sticky;
    top: 70px;
    height: calc(100vh - 90px);
}

.search-map {
    width: 100%;
    height: 100%;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
}

.search-result-card {
    display: flex;
    gap: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text);
    transition: box-shadow 0.15s;
}

.search-result-card:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
}

.search-result-photo {
    width: 200px;
    max-width: 100%;
    min-height: 140px;
    background-size: cover;
    background-position: center;
    background-color: var(--color-bg);
    flex-shrink: 0;
}

.search-result-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.search-result-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.search-result-price {
    font-size: 1.25rem;
    font-weight: 700;
}

.search-result-specs {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.search-result-address {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* === Search Empty State === */
.search-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
}

.search-empty svg {
    margin-bottom: 1rem;
    color: var(--color-primary);
    opacity: 0.5;
}

.search-empty h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.search-empty p {
    max-width: 400px;
    margin: 0 auto 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.email-capture {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.email-capture input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.9rem;
}

/* === Photo Preview Grid === */
.photo-preview-grid {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.photo-preview {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-sm);
    background-size: cover;
    background-position: center;
    border: 1px solid var(--color-border);
}

/* === Mobile Responsive Additions === */
@media (max-width: 1023px) {
    .listing-hero-info {
        flex-direction: column;
    }

    .listing-agent-card {
        width: 100%;
    }

    .search-layout {
        flex-direction: column;
    }

    .search-map-container {
        width: 100%;
        height: 300px;
        position: static;
    }
}

@media (max-width: 768px) {
    .listing-gallery-main {
        height: 280px;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }

    .lightbox-prev { left: 0.5rem; }
    .lightbox-next { right: 0.5rem; }

    .listing-sticky-contact {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0.75rem 1rem;
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
        z-index: 50;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .form-row, .form-row-3 {
        flex-direction: column;
    }

    .dashboard-listing-card {
        flex-direction: column;
        align-items: stretch;
    }

    .dashboard-listing-photo {
        width: 100%;
        height: 160px;
    }

    .dashboard-listing-actions {
        justify-content: flex-start;
    }

    .search-result-card {
        flex-direction: column;
    }

    .search-result-photo {
        width: 100%;
        height: 180px;
    }

    .header-nav {
        gap: 0.75rem;
    }

    .nav-link {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .listing-price {
        font-size: 1.5rem;
    }

    .listing-specs {
        gap: 0.4rem;
    }

    .listing-spec {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
}
