:root {
    /* Institutional Colors */
    --primary-blue: #044d96;
    --dark-blue: #0D3F7A;
    --white: #FFFFFF;

    /* Neutral Colors */
    --gray-50: #F8FAFC;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-500: #64748B;
    --gray-700: #334155;
    --gray-900: #0F172A;

    /* Semantic Colors */
    --success: #16A34A;
    --whatsapp: #25D366;
    --whatsapp-dark: #128C7E;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Borders */
    --radius-md: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--gray-900);
    background-color: var(--gray-50);
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-wrap: break-word;
    word-break: break-word;
    overflow-x: hidden;
    width: 100%;
}

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

/* --- Typography --- */
h1,
h2,
h3,
h4 {
    font-weight: 600;
    line-height: 1.2;
}

/* --- Header --- */
.main-header {
    background-color: var(--white);
    color: var(--gray-900);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.header-titles h1 {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--gray-500);
}

.header-titles h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-blue);
}

/* --- Main Layout --- */
#app-container {
    flex: 1;
}

/* --- Hero Section --- */
.hero-section {
    background-color: var(--dark-blue);
    color: var(--white);
    padding: 3rem 0;
    text-align: center;
}

.hero-text h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.hero-text p {
    color: var(--gray-300);
    margin-bottom: 2rem;
    font-size: 1.125rem;
}

/* --- Filters Panel --- */
.filters-panel {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    color: var(--gray-900);
    text-align: left;
    max-width: 1000px;
    margin: 0 auto;
}

.filters-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    margin-bottom: 0;
}

.filters-header h3 {
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
}

.filter-group select,
.filter-group input {
    padding: 0.625rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.9375rem;
    background-color: var(--white);
    outline: none;
    transition: border-color 0.2s;
}

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

.filter-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* --- Buttons --- */
.btn {
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--dark-blue);
}

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

.btn-outline:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-500);
}

.btn-whatsapp {
    background-color: var(--whatsapp);
    color: var(--white);
    font-size: 1.125rem;
    padding: 1rem;
    width: 100%;
}

.btn-whatsapp:hover {
    background-color: var(--whatsapp-dark);
}

/* --- Results Section --- */
.results-section {
    padding: 2rem 1rem 4rem;
}

.results-header {
    margin-bottom: 1.5rem;
}

.results-header h3 {
    color: var(--gray-700);
    font-size: 1.125rem;
    font-weight: 500;
}

/* --- Remates Grid & Cards --- */
.remates-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.2rem;
}

.remate-card {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.3s, transform 0.3s;
    cursor: pointer;
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.remate-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-img-container {
    position: relative;
    height: 200px;
}

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

.card-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background-color: var(--gray-100);
    color: var(--gray-700);
}

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

.badge-secondary {
    background-color: var(--dark-blue);
    color: var(--white);
}

.card-content {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-header {
    margin-bottom: 1rem;
}

.card-code {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.card-title {
    font-size: 1.125rem;
    color: var(--gray-900);
    line-height: 1.3;
}

.card-location {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: 0.5rem;
}

.card-prices {
    margin-top: auto;
    border-top: 1px solid var(--gray-200);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.price-item {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.price-item .label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.price-item .val {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
}

.price-item.highlight .val {
    color: var(--primary-blue);
    font-size: 1.1rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    background-color: var(--white);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--gray-300);
}

.empty-state.hidden {
    display: none;
}

.empty-state i {
    font-size: 4rem;
    color: var(--gray-300);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--gray-900);
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 1.5rem;
}

/* --- Detail View --- */
.detail-container {
    padding: 2rem 1rem;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 2rem;
}

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

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .current {
    color: var(--gray-900);
    font-weight: 500;
}

.detail-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

.detail-left,
.detail-right {
    min-width: 0;
}

/* Detail Left (Gallery & CTA) */
.gallery-container {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.main-image {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.thumbnails {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--gray-50);
    overflow-x: auto;
}

.thumb-img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: all 0.2s;
    flex-shrink: 0;
}

.thumb-img:hover {
    opacity: 0.8;
}

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

.interest-section {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.interest-section h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.interest-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.conditions-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.condition-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.condition-item i {
    font-size: 1.25rem;
    color: var(--primary-blue);
    background-color: var(--gray-100);
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.cond-label {
    display: block;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.condition-item strong {
    font-size: 0.9375rem;
    color: var(--gray-900);
}

/* Detail Right (Info) */
.detail-header {
    margin-bottom: 2rem;
}

.detail-header .tags {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.detail-code {
    font-size: 1rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.detail-title {
    font-size: 1.75rem;
    color: var(--gray-900);
}

.price-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.price-card {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.price-card.highlight {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    color: var(--white);
    position: relative;
    overflow: hidden;
}

.price-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.25rem;
}

.price-card.highlight .price-label {
    color: var(--gray-200);
}

.price-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.price-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
}

.info-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.info-block {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.info-block h3 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
    color: var(--dark-blue);
}

.info-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.info-list li {
    display: flex;
    flex-direction: column;
}

.info-list span {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.info-list strong {
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.caracteristicas-box {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--gray-50);
    border-radius: var(--radius-md);
}

.caracteristicas-box h4 {
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

.caracteristicas-box p {
    font-size: 0.9375rem;
    color: var(--gray-900);
}

/* --- Footer --- */
.main-footer {
    background-color: var(--white);
    border-top: 1px solid var(--gray-200);
    padding: 2rem 0;
    text-align: center;
    color: var(--gray-500);
    font-size: 0.875rem;
    margin-top: auto;
}

/* --- Responsive --- */
@media (min-width: 640px) {
    .remates-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters-form {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-actions {
        flex-direction: row;
        grid-column: span 2;
    }

    .info-list {
        grid-template-columns: 1fr 1fr;
    }

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

@media (min-width: 992px) {
    .header-titles h1 {
        font-size: 1rem;
    }

    .header-titles h2 {
        font-size: 1.5rem;
    }

    .hero-text h2 {
        font-size: 2.5rem;
    }

    .filters-form {
        grid-template-columns: repeat(5, 1fr) auto;
        align-items: end;
    }

    .filter-actions {
        grid-column: auto;
        flex-direction: column;
    }

    .remates-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .detail-layout {
        grid-template-columns: 420px 1fr;
        gap: 3rem;
    }

    .main-image {
        height: 250px;
    }
}

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

    .filters-form {
        display: none;
    }

    .filters-form.active {
        display: grid;
        margin-top: 1rem;
    }
}

@media (min-width: 1200px) {
    .remates-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Instructions Box --- */
.instructions-box {
    margin-top: 1.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.instructions-box h4 {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 0.75rem;
}

.instructions-box ul {
    padding-left: 1.5rem;
}

.instructions-box li {
    margin-bottom: 0.5rem;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination.hidden {
    display: none;
}

.page-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background-color: var(--white);
    color: var(--gray-700);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background-color: var(--gray-100);
}

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

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

/* --- Lightbox --- */
.lightbox {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
}

.lightbox.hidden {
    display: none;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: 0.2s;
}

.lightbox-close:hover {
    color: var(--gray-300);
}

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

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

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}