/* LETZ HOME - Real Estate Shortlisting App Styles */
/* Luxury Meets Utility - Clean, Professional Design */

:root {
    --primary: #1a2332;
    --primary-light: #2d3748;
    --accent: #c4a472;
    --accent-dark: #b8955d;
    --background: #f8f5f0;
    --surface: #ffffff;
    --text: #1a2332;
    --text-secondary: #4a5568;
    --border: #e2e8f0;
    --success: #48bb78;
    --error: #e53e3e;
    --success-dark: #38a169;
    --error-dark: #c53030;
    --success-light: rgba(72, 187, 120, 0.1);
    --error-light: rgba(229, 62, 62, 0.1);
    --success-border: #bbf7d0;
    --error-border: #fecaca;
    --accent-light-bg: rgba(196, 164, 114, 0.1);
    --accent-medium-bg: rgba(196, 164, 114, 0.05);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --modal-overlay-dark: rgba(0, 0, 0, 0.8);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 0.375rem;
    --radius-lg: 0.5rem;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --primary: #f8f5f0;
    --primary-light: #e2e8f0;
    --background: #1a2332;
    --surface: #2d3748;
    --text: #f8f5f0;
    --text-secondary: #a0aec0;
    --border: #4a5568;
    --success-border: #2d5a3f;
    --error-border: #5a2d2d;
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --modal-overlay-dark: rgba(0, 0, 0, 0.9);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    /* Short pages: the main area grows so the footer sits at the bottom */
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    color: var(--accent-dark);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    line-height: 1.2;
    color: var(--primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p {
    margin-bottom: 1rem;
}

small {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.main-content {
    flex: 1 0 auto;
    padding: 1rem 0;
}

/* Header */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 0;
    box-shadow: var(--shadow);
}

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

.app-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.app-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Tablets: drop the tagline so the header is one row on every page */
@media (max-width: 1000px) {
    .app-subtitle {
        display: none;
    }

    .app-title {
        white-space: nowrap;
    }

    .header-content .nav {
        gap: 0.25rem;
    }

    .header-content .nav-link {
        padding: 0.5rem 0.625rem;
    }
}

/* Navigation */
.nav {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-link {
    color: var(--primary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    transition: var(--transition);
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.nav .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Signed-in user: plain text, the log out button stays separate */
.nav-user {
    font-size: 0.875rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.nav .theme-toggle {
    min-width: 2.25rem;
    line-height: 1;
}

.theme-toggle .theme-icon {
    font-size: 1rem;
}

/* The text label only shows in the phone menu */
.theme-toggle .theme-label {
    display: none;
}

.nav-link:hover {
    background: var(--background);
    color: var(--primary);
}

.nav-link.active {
    background: var(--accent);
    color: var(--primary);
}

/* Phone menu: a button toggles the nav, which is always shown on larger screens */
.nav-menu {
    position: relative;
    flex-shrink: 0;
}

.nav-menu .nav-menu-btn {
    display: none;
}

@media (max-width: 768px) {
    .nav-menu .nav-menu-btn {
        display: inline-flex;
        min-height: 2.75rem;
        padding: 0.5rem 0.875rem;
    }

    .nav-menu:not(.open) .nav {
        display: none;
    }

    .nav-menu .nav {
        position: absolute;
        right: 0;
        top: calc(100% + 0.5rem);
        z-index: 100;
        flex-direction: column;
        align-items: stretch;
        gap: 0.25rem;
        min-width: 12rem;
        padding: 0.5rem;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
    }

    .nav-menu .nav-link {
        display: flex;
        align-items: center;
        min-height: 2.75rem;
    }

    .nav-menu .nav-user {
        padding: 0.5rem 0.625rem 0.25rem;
        border-top: 1px solid var(--border);
    }

    .nav-menu .nav .btn {
        width: 100%;
        min-height: 2.75rem;
        padding: 0.625rem 1rem;
        white-space: nowrap;
    }

    .nav-menu .theme-toggle .theme-label {
        display: inline;
    }
}

/* Tablets: 44px touch targets in the header nav */
@media (pointer: coarse) and (min-width: 769px) {
    .header-content .nav-link,
    .nav .btn {
        display: inline-flex;
        align-items: center;
        min-height: 2.75rem;
    }

    .nav .theme-toggle {
        min-width: 2.75rem;
    }
}

/* Footer */
footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 3rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-textarea,
input[type="datetime-local"],
select {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
    font-family: inherit;
}

.form-input,
.form-textarea {
    width: 100%;
}

.form-input:focus,
.form-textarea:focus,
input[type="datetime-local"]:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light-bg);
}

.form-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.form-col {
    flex: 1;
    min-width: 200px;
    padding: 0 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: inherit;
}

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

.btn-primary {
    background: var(--primary);
    color: var(--surface);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-light);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary);
}

.btn-accent:hover:not(:disabled) {
    background: var(--accent-dark);
}

.btn-secondary {
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--background);
}

.btn-danger {
    background: var(--error);
    color: var(--surface);
}

.btn-danger:hover:not(:disabled) {
    background: var(--error-dark);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* ==================== TABLES ==================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
}

th {
    background: var(--primary);
    color: var(--surface);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    position: relative;
}

td {
    border-bottom: 1px solid var(--border);
}

tr:hover td {
    background: var(--background);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 0;
}

/* ==================== RESIDENCE GALLERY ==================== */
.gallery-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.gallery-add {
    display: flex;
    gap: 0.5rem;
    flex: 1;
    max-width: 520px;
}

.gallery-add .btn {
    white-space: nowrap;
}

.gallery-add .form-input,
.gallery-sort .form-input {
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.gallery-filter {
    border: none;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--surface);
    color: var(--text-secondary);
    box-shadow: inset 0 0 0 1px var(--border);
    cursor: pointer;
}

.gallery-filter.active {
    background: var(--primary);
    color: var(--surface);
    box-shadow: none;
}

.gallery-search {
    width: 14rem;
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
}

.gallery-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.gallery-sort .form-label {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Narrow screens: URL field on its own row, chips and sort below */
@media (max-width: 1000px) {
    .gallery-add {
        flex-basis: 100%;
        max-width: none;
    }
}

/* Phones: chips scroll sideways next to the sort instead of wrapping */
@media (max-width: 600px) {
    .gallery-filters {
        flex: 1;
        flex-wrap: nowrap;
        min-width: 0;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .gallery-search {
        flex-basis: 100%;
        width: auto;
    }

    .gallery-filter {
        flex-shrink: 0;
        white-space: nowrap;
    }
}

.gallery-events {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.gallery-events .form-label {
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.gallery-event {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.375rem 0.25rem 0.625rem;
    font-size: 0.875rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
}

.gallery-event .badge {
    padding: 0 0.5rem;
}

.gallery-event-remove {
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.gallery-event-remove:hover {
    color: var(--error);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.gallery-card {
    display: block;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text);
    transition: var(--transition);
}

.gallery-card[hidden] {
    display: none;
}

.gallery-card[data-unavailable] .gallery-photo {
    filter: grayscale(1);
    opacity: 0.6;
}

.gallery-card:hover {
    color: var(--text);
    text-decoration: none;
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.gallery-photo {
    position: relative;
    height: 170px;
    background: var(--background);
}

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

.gallery-no-photo {
    display: grid;
    place-items: center;
    height: 100%;
    color: var(--text-secondary);
}

.gallery-price {
    position: absolute;
    left: 0.625rem;
    bottom: 0.625rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius);
    background: rgba(26, 35, 50, 0.85);
    color: #fff;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
}

.gallery-price small {
    margin-left: 0.375rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.7rem;
    font-weight: 400;
    color: #cbd2dc;
}

.gallery-badges {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
}

.gallery-badges span {
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: #1a2332;
    font-size: 0.7rem;
    font-weight: 600;
}

.gallery-body {
    padding: 0.5rem 0.75rem 0.75rem;
}

.gallery-title {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.gallery-title span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.gallery-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.gallery-facts b {
    color: var(--text);
    font-weight: 600;
}

.gallery-features {
    margin-top: 0;
    min-height: 1lh;
}

.gallery-yes {
    color: var(--success-dark);
}

.gallery-next {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-dark);
}

.gallery-title .energy-badge {
    margin-left: auto;
    flex: none;
    min-width: 1.25rem;
    padding: 0 0.3rem;
    border-radius: 4px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
}

.energy-A { background: #1a7f37; }
.energy-B { background: #3f9b2f; }
.energy-C { background: #8cb317; }
.energy-D { background: #c9b400; }
.energy-E { background: #e0a100; }
.energy-F { background: #e06b00; }
.energy-G { background: #d14343; }
.energy-H { background: #b83232; }
.energy-I { background: #962020; }

/* ==================== RESIDENCE COCKPIT ==================== */
/* Full-height page on desktop: the page never scrolls, each column does */
@media (min-width: 901px) {
    body.page-fill {
        height: 100vh;
        display: flex;
        flex-direction: column;
    }

    body.page-fill .main-content {
        flex: 1;
        min-height: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
    }

    body.page-fill footer {
        display: none;
    }

    .cockpit {
        flex: 1;
        min-height: 0;
    }
}

.cockpit {
    display: flex;
    flex-direction: column;
}

.cockpit [hidden] {
    display: none;
}

.cockpit .btn-sm {
    text-transform: none;
    letter-spacing: 0;
}

.cockpit-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    padding: 0.625rem 1.5rem;
    background: var(--primary);
    color: var(--surface);
}

/* Dark ink on gold in both themes (cream on gold is 2.2:1) */
[data-theme="dark"] .cockpit-bar .btn-accent {
    color: var(--background);
}

.cockpit-title {
    min-width: 0;
}

.cockpit-title h2 {
    font-size: 1.125rem;
    color: var(--surface);
}

.cockpit-sub {
    font-size: 0.8rem;
    opacity: 0.8;
}

.cockpit-kpis {
    display: flex;
    align-items: baseline;
    gap: 1.25rem;
    margin-left: auto;
}

.cockpit-kpis b {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.125rem;
}

.cockpit-kpis span {
    font-size: 0.75rem;
    opacity: 0.75;
    margin-left: 0.25rem;
}

.cockpit-actions {
    display: flex;
    gap: 0.5rem;
}

.cockpit-menu {
    position: relative;
}

.cockpit-menu summary {
    list-style: none;
}

.cockpit-menu summary::-webkit-details-marker {
    display: none;
}

.cockpit-menu-items {
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 10;
    padding: 0.375rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.cockpit-unavailable {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1.5rem;
    background: var(--border);
    color: var(--text);
    font-weight: 500;
}

.cockpit-cols {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 300px 1fr 380px;
}

.cockpit-col {
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
    border-right: 1px solid var(--border);
}

/* Fade the edge of a column that can scroll further that way */
.scroll-more-up {
    -webkit-mask-image: linear-gradient(transparent, #000 1.5rem);
    mask-image: linear-gradient(transparent, #000 1.5rem);
}

.scroll-more-down {
    -webkit-mask-image: linear-gradient(#000 calc(100% - 1.5rem), transparent);
    mask-image: linear-gradient(#000 calc(100% - 1.5rem), transparent);
}

.scroll-more-up.scroll-more-down {
    -webkit-mask-image: linear-gradient(transparent, #000 1.5rem, #000 calc(100% - 1.5rem), transparent);
    mask-image: linear-gradient(transparent, #000 1.5rem, #000 calc(100% - 1.5rem), transparent);
}

.col-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.col-head h3 {
    font-size: 1rem;
    color: var(--accent-dark);
    margin-right: auto;
}

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

/* Characteristics */
.detail-group summary {
    cursor: pointer;
    padding: 0.25rem 0;
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 600;
    color: var(--accent-dark);
}

/* Collapsed groups show a one-line digest below 900px, where they start collapsed */
.detail-digest {
    display: none;
    margin-left: 0.5rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

@media (max-width: 900px) {
    .detail-group summary {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .detail-group:not([open]) .detail-digest {
        display: inline;
    }
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.125rem 0.75rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.45;
}

.detail-list dt {
    color: var(--text-secondary);
}

.detail-list dd {
    font-weight: 600;
    text-align: right;
}

.travel-table {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.travel-table th,
.travel-table td {
    padding: 0.125rem 0.25rem;
}

.travel-table th {
    background: none;
    text-align: right;
    font-size: 1rem;
}

.travel-table td {
    border-bottom: none;
    font-weight: 600;
    text-align: right;
}

.travel-table td:first-child {
    color: var(--text-secondary);
    font-weight: normal;
    text-align: left;
}

/* Photos */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
}

.photo-add {
    aspect-ratio: 4 / 3;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
    padding: 0.375rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
}

.photo-add .btn {
    padding: 0.25rem;
}

/* Activity: feed of comments, events and URLs with a composer */
.cockpit-activity {
    display: flex;
    flex-direction: column;
    padding: 0;
    border-right: none;
    background: var(--surface);
}

.cockpit-activity .col-head {
    margin: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.feed-filters {
    display: flex;
    gap: 0.25rem;
}

.feed-filter {
    border: none;
    border-radius: 999px;
    padding: 0.125rem 0.5rem;
    font-family: inherit;
    font-size: 0.7rem;
    background: var(--background);
    color: var(--text-secondary);
    cursor: pointer;
}

.feed-filter.active {
    background: var(--primary);
    color: var(--surface);
}

.feed {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 1rem;
}

.feed-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.feed-icon {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-light-bg);
    color: var(--accent-dark);
    font-size: 0.7rem;
    font-weight: 700;
}

.feed-body {
    flex: 1;
    min-width: 0;
}

.feed-body p {
    margin: 0.125rem 0 0;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.feed-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.feed-meta strong {
    color: var(--text);
}

.feed-meta .badge {
    padding: 0 0.375rem;
    font-size: 0.65rem;
}

.feed-delete {
    margin-left: auto;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.feed-delete:hover {
    color: var(--error);
}

.feed-empty {
    padding: 1rem 0;
    text-align: center;
}

.composer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.composer-tabs {
    display: flex;
    gap: 2px;
    width: max-content;
    padding: 2px;
    background: var(--background);
    border-radius: var(--radius);
}

.composer-tab {
    border: none;
    background: none;
    padding: 0.125rem 0.625rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

.composer-tab.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.composer-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
}

.composer-form .form-input,
.composer-form .form-textarea {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.composer-form .form-textarea {
    min-height: 3.5rem;
}

.composer-form .wide {
    grid-column: 1 / -1;
}

.composer-form .btn {
    grid-column: 2;
    justify-self: end;
}

@media (max-width: 900px) {
    .cockpit-bar {
        padding: 0.625rem 1rem;
    }

    .cockpit-kpis {
        margin-left: 0;
    }

    .cockpit-cols {
        grid-template-columns: 1fr;
    }

    .photo-grid {
        grid-template-columns: 1fr 1fr;
    }

    .cockpit-col {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

/* Tablet portrait: collapsed characteristics above full-width photos, activity below */
@media (min-width: 601px) and (max-width: 900px) {
    .photo-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Modern Property Display */

/* Inline field editing */
.editable-field {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.editable-field .field-value {
    display: inline;
}

.edit-icon {
    opacity: 0;
    transition: opacity 0.2s;
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 0.25rem;
}

.editable-field:hover .edit-icon {
    opacity: 1;
}

/* Touch screens: no hover, so keep a comfortable tap target */
@media (pointer: coarse) {
    .edit-icon {
        opacity: 0.6;
        font-size: 1rem;
        padding: 0 0.75rem;
        margin-left: 0;
    }

    /* Touch targets of at least 44x44 px that do not overlap */
    .editable-field,
    .editable-field .field-value,
    .edit-icon {
        display: inline-flex;
        align-items: center;
        min-height: 2.75rem;
    }

    .editable-field {
        gap: 0; /* no dead zone between the value and the pencil */
    }

    .editable-field .field-value {
        min-width: 2.75rem;
        justify-content: flex-end;
    }

    .detail-list {
        align-items: center;
    }

    .editable-field .edit-actions {
        gap: 0.5rem;
    }

    .editable-field .edit-actions .btn-sm {
        min-width: 2.75rem;
        min-height: 2.75rem;
        font-size: 1rem;
    }

    .cockpit .btn-sm,
    .composer-tab {
        min-width: 2.75rem;
        min-height: 2.75rem;
    }

    .detail-group summary {
        min-height: 2.75rem;
        padding: 0.5rem 0;
    }

    .feed-body a {
        display: inline-flex;
        align-items: center;
        min-height: 2.75rem;
    }

    .feed-filter {
        min-width: 2.75rem;
        min-height: 2.75rem;
        padding: 0 0.75rem;
        font-size: 0.8rem;
    }

    .feed-delete {
        min-width: 2.75rem;
        min-height: 2.75rem;
        margin: -0.5rem -0.75rem 0 auto; /* into the item and feed padding */
    }

    /* Small visible dot, 44 px hit area thanks to the transparent border */
    .photo-thumbnail .photo-remove {
        top: 0;
        right: 0;
        width: 2.75rem;
        height: 2.75rem;
        border: 0.625rem solid transparent;
        background-clip: padding-box;
    }
}

.editable-field:hover {
    background: var(--accent-medium-bg);
    border-radius: var(--radius);
    padding: 0.125rem 0.25rem;
}

.edit-input {
    width: 100%;
    min-width: 60px;
}

.edit-actions {
    display: inline-flex;
    gap: 0.25rem;
    margin-left: 0.25rem;
}

.edit-actions .btn-sm {
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
}

/* Card pattern shared by all boxed sections */
.log-container,
.filter-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.description {
    margin-top: 1rem;
}

.residence-description {
    background: var(--background);
    padding: 1rem;
    border-radius: var(--radius);
    line-height: 1.7;
    white-space: pre-line;
}

/* ==================== ADD PHOTO ==================== */

.upload-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--background);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.upload-option:hover {
    border-color: var(--accent);
    background: var(--accent-medium-bg);
}

.upload-option input[type="file"] {
    display: none;
}

.photo-thumbnail {
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--background);
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
}

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

.photo-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--error);
    color: var(--surface);
    border: none;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
}

@media (hover: hover) {
    .photo-remove {
        opacity: 0;
    }

    .photo-thumbnail:hover .photo-remove,
    .photo-thumbnail:focus-within .photo-remove {
        opacity: 1;
    }
}

/* ==================== COMMENTS ==================== */

/* ==================== LOG ==================== */
.log-container {
    overflow: hidden;
}

.log-entry {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.success {
    border-left: 3px solid var(--success);
}

.log-entry.error {
    border-left: 3px solid var(--error);
}

.log-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}

.log-timestamp {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.log-action {
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.log-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius);
    text-transform: uppercase;
}

.notification-info {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.log-status.success,
.message-success,
.notification-success {
    background-color: var(--success-light);
    color: var(--success);
}

.log-status.error,
.message-error,
.notification-error {
    background-color: var(--error-light);
    color: var(--error);
}

.log-details {
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    display: none;
}

.log-entry.expanded .log-details {
    display: block;
}

.log-component {
    font-weight: 500;
    color: var(--primary);
}

.log-residence {
    font-size: 0.75rem;
}

span.log-residence {
    color: var(--text-secondary);
}

.log-more {
    display: block;
    margin: 1rem auto 0;
}

/* ==================== FILTER BAR ==================== */
.filter-bar {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    align-self: center;
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: 0.875rem;
    cursor: pointer;
}

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

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

.filter-toggle {
    display: none;
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--modal-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.25rem;
    line-height: 1;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--background);
}

/* ==================== PHOTO SLIDESHOW ==================== */
.slideshow-container {
    position: relative;
    background: var(--primary);
    border-radius: var(--radius-lg);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.slideshow-image-container {
    max-width: 100%;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slideshow-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius);
}

.slideshow-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--surface);
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    line-height: 1;
    z-index: 1001;
}

.slideshow-close:hover {
    color: var(--accent);
}

.slideshow-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--modal-overlay);
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--surface);
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    transition: var(--transition);
}

.slideshow-nav:hover {
    background: var(--modal-overlay-dark);
}

.slideshow-prev {
    left: 1rem;
}

.slideshow-next {
    right: 1rem;
}

.slideshow-counter {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--modal-overlay-dark);
    color: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* Phones and tablets: full-screen viewer, swipe to navigate */
@media (max-width: 1024px), (pointer: coarse) {
    #slideshowModal {
        padding: 0;
        background: #000;
        overscroll-behavior: contain;
    }

    .slideshow-container {
        width: 100vw;
        height: 100dvh;
        max-width: none;
        max-height: none;
        padding: 0;
        border-radius: 0;
        background: #000;
    }

    .slideshow-image-container {
        width: 100%;
        height: 100%;
        max-height: none;
        touch-action: pan-y pinch-zoom;
    }

    .slideshow-image {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
    }

    .slideshow-close {
        top: max(0.5rem, env(safe-area-inset-top));
        right: max(0.5rem, env(safe-area-inset-right));
    }

    .slideshow-counter {
        bottom: max(1rem, env(safe-area-inset-bottom));
    }

    /* Arrows go to the bottom corners, off the photo */
    .slideshow-nav {
        top: auto;
        transform: none;
        bottom: max(0.5rem, env(safe-area-inset-bottom));
        padding: 0.5rem 1rem;
    }

    .slideshow-prev {
        left: max(0.5rem, env(safe-area-inset-left));
    }

    .slideshow-next {
        right: max(0.5rem, env(safe-area-inset-right));
    }
}

@media (pointer: coarse) {
    .slideshow-nav {
        display: none;
    }
}

/* ==================== UTILITIES ==================== */
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-4 { margin-bottom: 2rem; }

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 500;
}

/* ==================== LOGIN ==================== */
.login-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
    max-width: 400px;
    margin: 4rem auto;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-form .btn {
    width: 100%;
}

/* Message styling */
.messages-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
}

.message-error {
    border: 1px solid var(--error-border);
}

.message-success {
    border: 1px solid var(--success-border);
}

.message-text {
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .app-title {
        font-size: 1.25rem;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.75rem 0.5rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .filter-bar {
        padding: 0.75rem 1rem;
    }

    .filter-toggle {
        display: inline-flex;
    }

    .filter-label,
    .filter-bar:not(.open) .filter-group {
        display: none;
    }

    .filter-group {
        order: 1;
        width: 100%;
        flex-direction: column;
    }
    
    
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    header, footer, .btn, .filter-bar {
        display: none !important;
    }
    
    table {
        page-break-inside: auto;
    }
    
    tr {
        page-break-inside: avoid;
    }
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius);
    z-index: 1100;
    font-weight: 500;
    box-shadow: var(--shadow);
}

/* ==================== EVENTS STYLES ==================== */
/* Badge Styles for Status Types */
.badge-scheduled {
    background: var(--success-light);
    color: var(--success);
}

.badge-completed {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-cancelled {
    background: var(--error-light);
    color: var(--error);
}

.badge-postponed {
    background: var(--accent-light-bg);
    color: var(--accent-dark);
}

/* Dashboard specific badge styling */
.badge-primary {
    background: var(--primary);
    color: var(--surface);
}
