@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    /* Premium Color Palette */
    --primary-color: #0f172a;
    /* Slate 900 */
    --secondary-color: #334155;
    /* Slate 700 */
    --accent-color: #6366f1;
    /* Indigo 500 */
    --accent-hover: #4f46e5;
    /* Indigo 600 */
    --accent-light: rgba(99, 102, 241, 0.1);

    --danger-color: #ef4444;
    /* Red 500 */
    --danger-hover: #dc2626;
    --success-color: #10b981;
    /* Emerald 500 */
    --success-hover: #059669;

    --bg-color: #e2e8f0;
    /* Slate 200 */
    --surface-color: rgba(255, 255, 255, 0.65);
    --surface-hover: rgba(255, 255, 255, 0.85);

    --text-primary: #1e293b;
    /* Slate 800 */
    --text-secondary: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */

    --border-radius-sm: 6px;
    --border-radius: 12px;
    --border-radius-lg: 20px;

    /* Smooth Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 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);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 85%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 0% 100%, hsla(210, 100%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 100% 100%, hsla(160, 50%, 90%, 1) 0, transparent 50%);
    background-repeat: no-repeat;
    background-size: cover;
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 15px 20px 20px 20px;
    gap: 15px;
}

/* Header */
.app-header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius-lg);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.logo-container img {
    height: 35px;
    filter: brightness(0) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
    /* Converts white logo to black to match light header */
    opacity: 0.85;
    /* Slightly soften the pure black to match the slate text */
}

#logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stats-container {
    display: flex;
    gap: 20px;
}

.stat-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-light);
}

.clickable-stat-card {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.clickable-stat-card.active {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 2px solid #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.clickable-stat-card.active .stat-value {
    color: #4f46e5;
}

.clickable-stat-card .stat-subtext {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 600;
}

.badge-unique-tag {
    background: #10b981;
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: 0.3px;
}

.duplicate-group-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ede9fe;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 6px;
}

.duplicate-group-badge:hover {
    background: #4f46e5;
    color: white;
    transform: scale(1.05);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-color);
}

.filter-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.filter-actions .btn {
    flex: 1;
    justify-content: center;
}

/* Premium Buttons */
.btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

.btn:active::after {
    animation: ripple 0.6s ease-out;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #818cf8);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(99, 102, 241, 0.3);
}

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

.btn-secondary:hover:not(:disabled) {
    background-color: var(--surface-hover);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #f87171);
    width: 100%;
    justify-content: center;
}

.btn-danger:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #34d399);
    width: 100%;
    justify-content: center;
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(16, 185, 129, 0.3);
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    gap: 12px;
    overflow: hidden;
    min-height: 0;
}

/* Sidebar & Panels Common */
.sidebar,
.table-area,
.preview-panel {
    background-color: var(--surface-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    flex-shrink: 0;
    padding: 20px;
    overflow-y: auto;
    gap: 16px;
}

.filter-group h3,
.export-section h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
}

.filter-group h3 i,
.export-section h3 i {
    color: var(--accent-color);
}

.filter-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-section label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

input[type="number"],
input[type="text"],
input[type="password"],
input[type="email"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: var(--transition-fast);
    background-color: var(--bg-color);
    color: var(--text-primary);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px var(--accent-light);
    background-color: var(--surface-color);
}

.multi-select {
    height: 140px;
    padding: 8px;
}

.multi-select option {
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 2px;
}

.multi-select option:checked {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    color: white;
}

.filter-section small {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: -4px;
}

.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 5px 0;
}

.export-section {
    background: linear-gradient(to bottom right, var(--surface-color), #f8fafc);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.export-section input {
    margin-bottom: 15px;
}

.export-buttons {
    display: flex;
    gap: 12px;
}

/* View Toggle */
.view-toggle {
    display: flex;
    background: var(--surface-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 4px;
    box-shadow: var(--shadow-sm);
}

.btn-view {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-view:hover {
    color: var(--primary-color);
}

.btn-view.active {
    background: var(--accent-light);
    color: var(--accent-color);
}

/* Grid Area */
.main-area {
    flex: 1;
    min-width: 0;
    padding: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Table Area */
.table-area {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 8px;
}

.table-container {
    flex: 1;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface-color);
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

thead th {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    color: var(--secondary-color);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 10px;
    border-bottom: 2px solid var(--border-color);
    z-index: 5;
    white-space: nowrap;
}

tbody tr {
    transition: var(--transition-fast);
    cursor: pointer;
}

tbody tr:hover {
    background-color: var(--surface-hover);
    transform: scale(1.001);
    /* Micro animation */
}

tbody tr.selected-row {
    background-color: var(--accent-light);
}

tbody td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
    color: var(--text-primary);
    white-space: nowrap;
}

.ref-link {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 600;
    position: relative;
}

.ref-link::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--accent-color);
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}

.ref-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

/* Preview Panel */
.preview-panel {
    width: 300px;
    min-width: 280px;
    flex-shrink: 0;
    padding: 20px;
    overflow-y: auto;
}

.preview-panel h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-panel h3 i {
    color: var(--accent-color);
}

.image-wrapper {
    width: 100%;
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--bg-color), #e2e8f0);
    border-radius: var(--border-radius);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-wrapper:hover img {
    transform: scale(1.08);
}

.no-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    gap: 12px;
}

.no-image-placeholder i {
    font-size: 3.5rem;
    opacity: 0.5;
}

.preview-details {
    margin-top: 25px;
}

/* Utility */
.d-none {
    display: none !important;
}

.header-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.select-all-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-color);
    padding: 10px 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    font-weight: 600;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
    height: 42px;
}

.card-image-container img {
    border-radius: 20px 20px 0 0;
}

.card-image-container {
    border-radius: 20px 20px 0 0;
}

.select-all-wrapper:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
}

#results-count {
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 600;
}

.property-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    overflow-y: auto;
    padding: 10px;
}

.no-results {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* Property Card */
.property-card {
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
    cursor: pointer;
    position: relative;
    display: flex;
    flex-direction: column;
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-light);
}

.property-card.selected {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color), var(--shadow-md);
}

.card-image-container {
    height: 220px;
    min-height: 220px;
    flex-shrink: 0;
    position: relative;
    background: #e2e8f0;
}

.card-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}


.checkbox-container {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    line-height: 0;
}

.card-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--accent-color);
}

.card-price-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.85);
    color: white;
    padding: 6px 12px;
    border-radius: var(--border-radius);
    font-weight: 700;
    font-size: 1.1rem;
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-sm);
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-secondary);
    opacity: 0.5;
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.card-features {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.card-features span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-features i {
    color: var(--accent-color);
}

.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.card-source {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-view-details {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-view-details:hover {
    background: var(--accent-light);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--surface-color);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-hover);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    z-index: 10;
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.modal-image-col {
    background: #e2e8f0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.modal-main-img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.modal-actions {
    padding: 20px;
    display: flex;
    justify-content: center;
    background: var(--bg-color);
}

.preview-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
    border-radius: var(--border-radius);
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-sm);
}

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

.modal-details-col {
    padding: 40px;
}

.modal-details-col h2 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.2;
}

.modal-price {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 15px;
}

.modal-location {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.modal-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--border-radius);
}

.feature {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: var(--text-primary);
}

.feature i {
    color: var(--accent-color);
    font-size: 1.2rem;
    width: 24px;
}

.modal-meta {
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: var(--text-secondary);
}

.modal-meta p strong {
    color: var(--text-primary);
    width: 120px;
    display: inline-block;
}

/* Status Bar */
.status-bar {
    background-color: transparent;
    color: rgba(255, 255, 255, 0.8);
    padding: 0 10px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    font-weight: 500;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.55, 0.15, 0.45, 0.85) infinite;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

#loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9999;
}

.toast {
    background: var(--surface-color);
    border-left: 4px solid var(--accent-color);
    box-shadow: var(--shadow-lg);
    padding: 16px 24px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast i {
    font-size: 1.2rem;
}

.toast.success i {
    color: var(--success-color);
}

.toast.error i {
    color: var(--danger-color);
}

.toast-message {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

/* ===== Mobile Filter Toggle Button ===== */
.mobile-filter-toggle {
    display: none;
    align-items: center;
    gap: 10px;
    background: var(--surface-color);
    padding: 10px 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
    height: 42px;
}

.mobile-filter-toggle:hover {
    background: var(--surface-hover);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

.sidebar-close-btn {
    display: none;
    align-self: flex-end;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    padding: 5px 10px;
    transition: var(--transition-fast);
}

.sidebar-close-btn:hover {
    color: var(--danger-color);
}

/* ===== Responsive ===== */

/* Large screens — shrink preview */
@media (max-width: 1500px) {
    .preview-panel {
        width: 260px;
        min-width: 260px;
        padding: 16px;
    }

    .preview-panel h3 {
        font-size: 1rem;
        margin-bottom: 14px;
        padding-bottom: 10px;
    }
}

/* Hide preview panel to give table breathing room */
@media (max-width: 1300px) {
    .preview-panel {
        display: none !important;
    }
}

/* Tablets */
@media (max-width: 1100px) {

    body {
        height: auto;
        overflow-y: auto;
    }

    .app-container {
        height: auto;
        min-height: 100vh;
    }

    .main-content {
        flex-direction: column;
        overflow: visible;
    }

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

    .sidebar {
        display: none;
        width: 100%;
        min-width: unset;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        border-radius: 0;
        padding: 20px;
        overflow-y: auto;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .sidebar.open {
        display: flex;
        flex-direction: column;
    }
    
    .sidebar-close-btn {
        display: flex;
    }

    .export-section {
        grid-column: 1 / -1;
    }

    .preview-panel {
        display: none !important;
    }

    .header-controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    .pagination-controls {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        padding: 12px;
    }

    .pagination-center {
        order: -1;
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .preview-panel h3 {
        width: 100%;
        justify-content: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .image-wrapper {
        width: 300px;
        flex-shrink: 0;
    }

    .preview-details {
        margin-top: 0;
        flex: 1;
        min-width: 100px;
    }
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--surface-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-top: auto;
}

.items-per-page {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.items-per-page select {
    width: auto;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    outline: none;
}

.items-per-page select:focus {
    border-color: var(--accent-color);
}

.pagination-center {
    display: flex;
    justify-content: center;
    flex: 1;
}

.pagination-buttons {
    display: flex;
    gap: 5px;
}

.btn-page {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-page:hover:not(:disabled) {
    background: var(--accent-light);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-page.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.btn-page:disabled {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.pagination-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Sorting Styles */
th.sortable {
    cursor: pointer;
    user-select: none;
}

th.sortable:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.02);
}

th.sortable .sort-icon {
    margin-left: 4px;
    opacity: 0.4;
    transition: var(--transition-fast);
}

th.sortable.active-asc .sort-icon,
th.sortable.active-desc .sort-icon {
    opacity: 1;
    color: var(--accent-color);
}

th.sortable.active-asc .sort-icon::before {
    content: "\f0de";
    /* fa-sort-up */
}

th.sortable.active-desc .sort-icon::before {
    content: "\f0dd";
    /* fa-sort-down */
}

.grid-sort-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface-color);
    padding: 6px 14px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.grid-sort-wrapper.d-none {
    display: none !important;
}

/* 17" MacBook Pro and high-res screen responsive scaling */
@media screen and (min-width: 1400px) {

    /* Mimic the user's preferred "67% Zoom" feeling by scaling down the UI */
    .app-container {
        zoom: 0.8;
        /* Adjusted from 0.67 to make it less compact */
        height: calc(100vh / 0.8);
        /* Fix viewport height when zoomed */
        padding-bottom: 40px;
    }
}

/* Small Laptops (e.g., 1366x768) */
@media screen and (max-width: 1399px) {
    .app-container {
        zoom: 0.8;
        /* Scale down UI to fit small screens */
        height: calc(100vh / 0.8);
    }
}
/* ==========================================================================
   Property Status Badges
   Shared by the results table/grid (index.html) and the reports page.
   Class names are derived from the status: "Under Offer" -> .status-under-offer
   ========================================================================== */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.status-for-sale     { background: rgba(99, 102, 241, 0.12); color: #4f46e5; }
.status-new-listing  { background: rgba(16, 185, 129, 0.12); color: #059669; }
.status-reserved     { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.status-under-offer  { background: rgba(249, 115, 22, 0.14); color: #c2410c; }
.status-exclusive    { background: rgba(139, 92, 246, 0.13); color: #7c3aed; }
.status-sold         { background: rgba(239, 68, 68, 0.12);  color: #dc2626; }
.status-delisted     { background: rgba(100, 116, 139, 0.14); color: #475569; }
.status-off-market   { background: rgba(245, 158, 11, 0.18); color: #d97706; font-weight: 700; border: 1px solid rgba(245, 158, 11, 0.35); }
.status-manual       { background: rgba(245, 158, 11, 0.18); color: #d97706; font-weight: 700; border: 1px solid rgba(245, 158, 11, 0.35); }
.status-confidential { background: rgba(245, 158, 11, 0.18); color: #d97706; font-weight: 700; border: 1px solid rgba(245, 158, 11, 0.35); }
.status-unknown      { background: rgba(100, 116, 139, 0.10); color: #64748b; }

/* Scrape run states reuse the same badge shape */
.status-completed    { background: rgba(16, 185, 129, 0.12); color: #059669; }
.status-running      { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.status-failed       { background: rgba(239, 68, 68, 0.12);  color: #dc2626; }
.status-suspect      { background: rgba(249, 115, 22, 0.14); color: #c2410c; }

/* Delisted / sold rows read as de-emphasised in the results table */
tr.row-inactive td { opacity: 0.68; }

/* ==========================================================================
   Property Status Badges
   One coloured pill per canonical SARDO360 status value.
   Generated by statusBadge() in main.js:
     value.toLowerCase().replace(/\s+/g, '-')  →  e.g. "for-sale", "under-offer"
   ========================================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    white-space: nowrap;
    text-transform: uppercase;
    line-height: 1.4;
}

/* For Sale — neutral blue/slate */
.status-for-sale {
    background: rgba(99, 102, 241, 0.12);
    color: #4338ca;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

/* New Listing — vibrant teal */
.status-new-listing {
    background: rgba(20, 184, 166, 0.12);
    color: #0f766e;
    border: 1px solid rgba(20, 184, 166, 0.3);
}

/* Reserved — amber/gold */
.status-reserved {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Under Offer — orange */
.status-under-offer {
    background: rgba(249, 115, 22, 0.12);
    color: #c2410c;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Sold — red/rose */
.status-sold {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Exclusive — deep purple/violet */
.status-exclusive {
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Delisted — muted grey */
.status-delisted {
    background: rgba(100, 116, 139, 0.1);
    color: #475569;
    border: 1px solid rgba(100, 116, 139, 0.2);
}

/* Unknown — light grey */
.status-unknown {
    background: rgba(148, 163, 184, 0.1);
    color: #64748b;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Off Market — gold */
.status-off-market {
    background: rgba(245, 158, 11, 0.15);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Withdrawn — dark muted */
.status-withdrawn {
    background: rgba(71, 85, 105, 0.1);
    color: #475569;
    border: 1px solid rgba(71, 85, 105, 0.2);
}

/* ==========================================================================
   Properties results table — Location column width
   Client request: reduce the Location column by ~25%. Location values are long
   ("Carvoeiro, Lagoa e Carvoeiro, Lagoa, Faro, 8400-518, Portugal") so with the
   default auto table layout it was claiming ~375px and squeezing every other
   column. Capped at 280px (~25% narrower) and truncated with an ellipsis; the
   full value stays available via the cell's title tooltip and the Quick Preview
   panel, so no information is lost.
   Scoped to .properties-table — the login-history and reports pages share
   .table-container but have completely different columns.
   ========================================================================== */
.properties-table th:nth-child(3),
.properties-table td:nth-child(3) {
    max-width: 280px;
    width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1400px) {
    .properties-table th:nth-child(3),
    .properties-table td:nth-child(3) {
        max-width: 200px;
        width: 200px;
    }
}


thead tr th:hover {
    background-color: #fff !important;
}

/* ==========================================================================
   Property Custom Tags Styling
   ========================================================================== */
.property-tag-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eef2ff;
    color: #4f46e5;
    border: 1px solid #c7d2fe;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.property-tag-badge:hover {
    background: #4f46e5;
    color: #ffffff;
    border-color: #4f46e5;
}

.property-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
}

.property-tag-chip .remove-tag-btn {
    cursor: pointer;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1;
    transition: color 0.15s ease;
}

.property-tag-chip .remove-tag-btn:hover {
    color: #ef4444;
}

.tags-cloud-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.global-category-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 18px;
}

.global-category-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #475569;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.global-tag-card-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid #cbd5e1;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.global-tag-card-chip:hover {
    border-color: #6366f1;
    background: #f5f3ff;
    color: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(99, 102, 241, 0.15);
}

.global-tag-card-chip .tag-count-badge {
    background: #e2e8f0;
    color: #475569;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.global-tag-delete-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 2px;
    color: #94a3b8;
    font-size: 10px;
    transition: all 0.15s ease;
}

.global-tag-delete-icon:hover {
    background: #fee2e2;
    color: #ef4444;
}

.preview-tag-editor-box {
    margin-top: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}