:root {
    --primary: #001556;
    --primary-dark: #000d36;
    --secondary: #1a1a1a;
    --background: #f8f9fa;
    --surface: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --text-dark: #111827;
    --white: #ffffff;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --gold-light: #001556;
    --gold-dark: #000d36;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

h1,
h2,
h3,
.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 20px;
}

.header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.container-header-horizontal {
    display: flex;
    justify-content: center;
    /* Centering the logo and nav group */
    align-items: center;
    gap: 40px;
    /* Closer gap between logo and menu */
    padding: 5px 0;
}

.header-logo-row {
    flex-shrink: 0;
}

.logo-img-main {
    height: 42px;
    /* Slightly smaller for better fit */
    width: auto;
    object-fit: contain;
}

.nav-main {
    display: flex;
    align-items: center;
    gap: 25px;
    /* Spacing between sections */
}

.nav-link {
    text-decoration: none;
    color: var(--text-dark);
    font-weight: 500;
    transition: var(--transition);
    font-size: 0.92rem;
    position: relative;
    padding: 8px 0;
    white-space: nowrap;
}

/* Reset button styles to look like links */
.btn-link-style {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

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

.hero {
    background: linear-gradient(135deg, rgba(26, 26, 26, 0.92) 0%, rgba(26, 26, 26, 0.66) 100%),
        url('https://images.unsplash.com/photo-1512917774080-9991f1c4c750?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    min-height: 84vh;
    display: flex;
    align-items: center;
    color: var(--white);
    text-align: center;
    padding: 40px 0;
}

.hero-content {
    max-width: 1080px;
}

.hero-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    font-size: clamp(2.2rem, 5vw, 3.8rem);
    margin-bottom: 20px;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.highlight {
    font-weight: 700;
    /* Much bolder to ensure the blue inside is very visible */
    color: var(--primary);
    
    /* Using multiple text-shadows to create an OUTLINE that doesn't eat the inside color */
    text-shadow: 
        -1px -1px 0 rgba(255, 255, 255, 1),  
         1px -1px 0 rgba(255, 255, 255, 1),
        -1px  1px 0 rgba(255, 255, 255, 1),
         1px  1px 0 rgba(255, 255, 255, 1),
         0px  3px 10px rgba(0, 0, 0, 0.4); /* Nice drop shadow for depth behind the outline */
}

.search-container {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 10;
}

.search-pill {
    background: var(--white);
    padding: 8px 15px 8px 25px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    border: 2px solid transparent;
}

.search-pill:focus-within {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.search-icon {
    font-size: 1.2rem;
    margin-right: 15px;
    opacity: 0.6;
}

.search-pill input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text);
    background: transparent;
    padding: 10px 0;
}

.btn-filters {
    background: #f1f3f6;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-left: 10px;
}

.btn-filters:hover {
    background: var(--primary);
    color: white;
}

.advanced-filters {
    max-height: 0;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    margin-top: 15px;
}

.advanced-filters.show {
    max-height: 500px;
    opacity: 1;
    padding-bottom: 20px;
}

.filter-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 20px;
    border-radius: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    align-items: end;
    gap: 12px;
    box-shadow: var(--shadow);
    color: var(--text);
    text-align: left;
}

.filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
}

.filter-group-wide {
    grid-column: span 2;
}

.filter-group label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.filter-group select,
.filter-group input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    font-size: 0.95rem;
    font-weight: 600;
    background: #fff;
    color: var(--secondary);
    padding: 10px 11px;
}

.btn {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
    font-size: 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 21, 86, 0.3);
}

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

.btn-outline:hover {
    background-color: var(--primary);
    color: var(--white);
}

.btn-small {
    padding: 10px 14px;
    font-size: 0.85rem;
}

.btn-full {
    width: 100%;
    margin-top: 10px;
    background-color: var(--secondary);
    color: var(--white);
}

.btn-full:hover {
    background-color: #000;
}

.properties {
    padding: 90px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 34px;
}

.section-title {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    margin-bottom: 10px;
}

.section-subtitle {
    color: var(--text-light);
    font-size: 1.05rem;
}

.results-count {
    margin-top: 10px;
    color: var(--primary);
    font-weight: 700;
}

.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.property-card {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.property-card:hover,
.property-card:focus-visible {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.property-image-container {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.property-seal {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: auto;
    z-index: 5;
    opacity: 0.85;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
    pointer-events: none;
    transition: var(--transition);
}

.property-card:hover .property-seal {
    transform: scale(1.1) rotate(5deg);
    opacity: 1;
}

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

.property-features-new {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.feat-item {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #444;
    font-size: 0.78rem;
    font-weight: 500;
}

.feat-item svg {
    width: 16px;
    height: 16px;
    color: #001556;
    /* Brand Blue */
    flex-shrink: 0;
}

.feat-item span {
    white-space: nowrap;
}

.operation-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.badge-venta {
    background-color: var(--white);
    color: var(--primary);
    border-color: var(--white);
}

.badge-alquiler {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.gallery-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.72);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
}

.property-settings-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    z-index: 10;
}

.property-settings-btn:hover {
    background: var(--white);
    transform: scale(1.1);
}

.property-settings-menu {
    position: absolute;
    top: 50px;
    right: 14px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    min-width: 150px;
    border: 1px solid #eee;
}

.property-settings-menu.show {
    display: flex;
}

.property-settings-item {
    padding: 12px 16px;
    font-size: 0.85rem;
    color: var(--text);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.property-settings-item:hover {
    background: #f8f9fa;
}

.property-settings-item.danger {
    color: #e74c3c;
}

.property-info {
    padding: 20px;
}

.property-price {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 8px;
}

.property-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text);
}

.property-description {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.property-features {
    display: flex;
    gap: 20px;
    border-top: 1px solid #f1f1f1;
    padding-top: 13px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 6px;
}

.property-agent {
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
    color: var(--text-light);
}

.property-agent span {
    font-weight: 700;
    color: var(--gold-dark);
}

.no-results {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 28px;
    text-align: center;
    grid-column: 1 / -1;
}

.no-results h3,
.no-results h2 {
    margin-bottom: 8px;
}

.skeleton-card {
    pointer-events: none;
}

.skeleton {
    background: linear-gradient(90deg, #edf0f5 25%, #f8f8f8 37%, #edf0f5 63%);
    background-size: 400% 100%;
    animation: shimmer 1.2s ease infinite;
    border-radius: 8px;
}

.skeleton-image {
    height: 220px;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
}

.skeleton-line.short {
    width: 60%;
}

@keyframes shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: 0 0;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--white);
    margin: 5% auto;
    padding: 30px;
    width: 90%;
    max-width: 620px;
    border-radius: 20px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.4s ease-out;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--gold-light);
    border-radius: 10px;
}

.modal-content.modal-small {
    max-width: 480px;
}

.modal-header-clean {
    margin-bottom: 30px;
    text-align: left;
}

.modal-header-clean h2 {
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.modal-header-clean p {
    color: var(--text-light);
    font-size: 0.95rem;
}

.standard-form .form-group {
    margin-bottom: 20px;
}

.standard-form label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.standard-form input,
.standard-form select,
.standard-form textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    background-color: #f8fafc;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

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

.standard-form input:focus,
.standard-form select:focus,
.standard-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(0, 21, 86, 0.08);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}


.modal-info {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.feature-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.feature-input-group input {
    flex: 1;
}

.btn-remove-feature {
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 0 12px;
    cursor: pointer;
    font-weight: bold;
}

.form-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.form-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--secondary);
}

.image-upload-area {
    margin-bottom: 20px;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    border: 2px dashed #ddd;
    border-radius: var(--radius);
    cursor: pointer;
    background: #fcfcfc;
    transition: var(--transition);
}

.file-upload-label:hover {
    border-color: var(--primary);
    background: #f8faff;
}

.file-upload-label .icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.file-upload-label span {
    font-weight: 600;
    font-size: 0.95rem;
}

.file-upload-label small {
    color: var(--text-light);
    margin-top: 4px;
}

.separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: var(--text-light);
    font-size: 0.8rem;
    font-weight: 700;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #eee;
}

.separator span {
    padding: 0 10px;
}

.image-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.preview-thumbnail {
    position: relative;
    width: 82px;
    height: 82px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #eee;
    transition: var(--transition);
}

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

.preview-thumbnail:hover {
    border-color: var(--primary);
}

.preview-thumbnail:first-child {
    border-color: var(--secondary);
    border-width: 3px;
}

.preview-thumbnail:first-child::after {
    content: "Portada";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary);
    color: white;
    font-size: 0.65rem;
    text-align: center;
    padding: 2px 0;
    font-weight: 700;
}

.btn-remove-preview,
.btn-set-cover {
    position: absolute;
    top: 2px;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    z-index: 5;
}

.btn-remove-preview {
    right: 2px;
    background: rgba(255, 71, 87, 0.9);
    color: white;
}

.btn-set-cover {
    left: 2px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
}

.btn-set-cover:hover {
    background: var(--white);
    transform: scale(1.1);
}

.footer {
    background-color: var(--secondary);
    color: var(--white);
    padding: 40px 0;
    text-align: center;
    margin-top: 80px;
}

.logo-footer {
    max-width: 100%;
    width: 250px;
    height: auto;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
    /* Inverts the logo to white */
}

#add-user-form .form-group {
    margin-bottom: 12px;
}

#add-user-form input,
#add-user-form select {
    width: 100%;
    height: 48px;
    /* Fixed height for perfect consistency */
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 0.95rem;
    background-color: #fff;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

#add-user-form input:focus,
#add-user-form select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 21, 86, 0.08);
}

#user-list-details[open] .arrow {
    transform: rotate(180deg);
}

#user-list-details summary::-webkit-details-marker {
    display: none;
}

.preview-thumbnail.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary);
    transform: scale(0.95);
}

.loader {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-light);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

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

@media (max-width: 992px) {
    .filter-group-wide {
        grid-column: span 1;
    }

    .nav-main {
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .container-header-horizontal {
        flex-direction: column;
        gap: 10px;
        padding: 10px 0;
    }

    .hero {
        min-height: auto;
        padding-top: 150px;
    }

    .nav-main {
        gap: 10px;
        justify-content: center;
    }

    .search-container {
        width: 100%;
    }

    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }

    .advanced-filters.show {
        max-height: 800px;
    }

    .properties {
        padding: 60px 0;
    }

    .property-form .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 540px) {
    .filter-bar {
        grid-template-columns: 1fr;
    }

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

#map-view {
    height: 450px;
    width: 100%;
    border-radius: 20px;
    margin-top: 30px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: var(--shadow);
    z-index: 1;
    position: relative;
    overflow: hidden;
}

/* Ensure Leaflet tiles and container are correctly sized */
.leaflet-container {
    height: 100% !important;
    width: 100% !important;
    border-radius: 20px;
}

.leaflet-bar a {
    background-color: #fff !important;
    color: var(--primary) !important;
    border-color: #eee !important;
}

.leaflet-bar a:hover {
    background-color: #f1f3f6 !important;
}