/* ==========================================================================
   BASE STYLES
   ========================================================================== */

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

:root {
    --primary-color: #111827;
    --text-color: #1f2937;
    --light-text: #64748b;
    --background-color: #f3f4f6;
    --border-color: #e5e7eb;
    --card-background: #ffffff;
    --card-padding: 1.25rem;
    --detail-background: #f8fafc;
    --logo-height: 60px;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
    min-height: 100vh;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.loading, .error {
    text-align: center;
    padding: 2rem;
    font-size: 1.25rem;
}

.error {
    color: #dc2626;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   LISTING COMPONENTS
   ========================================================================== */

.listing {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    margin: 0 auto;
    width: 100%;
}

.listing-container {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 1rem;
}

.listing-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0;
}

.listing-info-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    padding-left: 0;
    padding-right: 0;
}

.listing-info-map {
    position: relative;
    height: 100%;
    min-height: 300px;
    display: flex;
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    padding-left: 0;
    padding-right: 0;
}

.map-placeholder {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 300px;
    background: var(--detail-background);
    border-radius: 1rem;
    border: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
}

.map-placeholder i {
    font-size: 3rem;
    color: var(--light-text);
}

.map-placeholder span {
    color: var(--light-text);
    font-size: 1rem;
}

/* Logo Component */
.logo-component .logo {
    width: 160px;
    height: auto;
    display: block;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
}

/* Listing Header */
.listing-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
    box-sizing: border-box;
}

.listing-title {
    font-size: 1.5rem;
    line-height: 1.2;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.listing-title::first-word {
    color: #2563eb;
    font-weight: 700;
}

.property-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: var(--light-text);
}

.property-info i {
    font-size: 1.25rem;
    color: var(--primary-color);
}

.stratum-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    width: fit-content;
}

.listing-price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

.listing-area {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    color: #4b5563;
    margin: 0;
}

.listing-area i {
    color: var(--primary-color);
}

.listing-specs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.spec-item {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    justify-content: center;
}

/* Listing Content */
.listing-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 0 1rem;
    box-sizing: border-box;
    flex: 1;
}

.listing-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--detail-background);
    border-radius: 0.75rem;
}

.detail-label {
    font-size: 0.875rem;
    color: var(--light-text);
    font-weight: 500;
}

.detail-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--primary-color);
}

.listing-description {
    line-height: 1.7;
    font-size: 1rem;
    color: #4b5563;
}

.listing-description ul,
.listing-description ol {
    padding-left: 1.5rem;
    margin: 0.5rem 0;
}

.listing-description li {
    margin: 0.25rem 0;
}

.listing-description ul li {
    list-style-type: disc;
}

.listing-description ol li {
    list-style-type: decimal;
}

/* Listing Footer */
.listing-footer {
    padding: var(--card-padding);
    font-size: 0.875rem;
    color: #94a3b8;
    border-top: 1px solid #e2e8f0;
    background: var(--detail-background);
    box-sizing: border-box;
    margin-top: auto;
}

/* ==========================================================================
   CAROUSEL COMPONENTS
   ========================================================================== */

.carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 2/1;
    background: #000;
    overflow: hidden;
    margin: 0;
    border-radius: 0;
}

.carousel-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.4s ease, transform 0.4s ease;
    display: none;
    z-index: 1;
}

.carousel-item.active {
    opacity: 1;
    transform: scale(1);
    display: block;
    z-index: 2;
}

.carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 6s ease;
    animation: imageFadeIn 0.5s ease forwards;
}

.carousel-item.active img {
    transform: scale(1.05);
}

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 3.5rem;
    height: 3.5rem;
    cursor: pointer;
    z-index: 20;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 1rem;
    pointer-events: auto !important;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.carousel-control:hover {
    background: rgba(0, 0, 0, 0.8);
    opacity: 1;
    transform: translateY(-50%) scale(1.05);
}

.carousel-control:active {
    transform: translateY(-50%) scale(0.95);
}

.carousel-prev {
    left: 0;
}

.carousel-next {
    right: 0;
}

.carousel-indicators {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    width: fit-content;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
    z-index: 10;
    background: rgba(0, 0, 0, 0.4);
    padding: 0.5rem;
    border-radius: 1rem;
    pointer-events: auto !important;
}

.carousel-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    pointer-events: auto !important;
    transform: scale(1);
}

.carousel-indicator.active {
    background: white;
    transform: scale(1.2);
}

.carousel-indicator:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.2);
}

.carousel::after {
    content: attr(data-slide-number);
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    z-index: 20;
    pointer-events: none;
    opacity: 0.7;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes imageFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   MEDIA QUERIES
   ========================================================================== */

/* Mobile Styles */
@media (max-width: 768px) {
    .container {
        height: auto;
        display: block;
        padding: 0;
        margin: 0;
        width: 100vw;
        max-width: 100vw;
    }
    
    .listing-grid {
        display: flex;
        flex-direction: column;
    }
    
    .listing-container,
    .listing-info {
        padding: 0;
        display: flex;
        flex-direction: column;
    }
    
    .listing-header {
        margin-top: 0;
        padding: 0;
        box-sizing: border-box;
    }
    
    .listing-content {
        padding: 0;
        box-sizing: border-box;
        flex: 1;
    }
    
    .listing-footer {
        padding: var(--card-padding);
        box-sizing: border-box;
        margin-bottom: 0;
        display: block;
        text-align: center;
    }

    .listing {
        margin: 0;
        border-radius: 0;
        width: 100vw;
        max-width: 100vw;
    }

    .listing-title {
        font-size: 1.25rem;
    }

    .listing-price {
        font-size: 2rem;
    }

    .listing-area {
        font-size: 1rem;
    }

    .spec-item {
        padding: 0.5rem;
        font-size: 0.875rem;
    }

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

    .listing-description {
        font-size: 0.875rem;
    }

    /* Carousel Mobile Styles */
    .carousel {
        order: -1;
        width: 100vw;
        height: 50vh;
        margin: 0;
        padding: 0;
        max-width: 100vw;
        border-radius: 0 !important;
        overflow: hidden;
    }

    .carousel-inner,
    .carousel-item {
        width: 100vw;
        height: 50vh;
    }

    .carousel-item img {
        width: 100vw;
        height: 50vh;
        object-fit: cover;
        object-position: center;
    }
    
    .carousel-indicator {
        border-radius: 50% !important;
        width: 0.4rem;
        height: 0.4rem;
    }
    
    .carousel-control, 
    .carousel-indicators, 
    .carousel-indicator {
        pointer-events: auto !important;
    }
    
    .carousel-indicators {
        bottom: 1rem;
        padding: 0.5rem 1rem;
        width: auto;
        min-width: 85%;
        max-width: 95%;
        gap: 0.5rem;
    }

    .carousel-control {
        width: 2.5rem;
        height: 2.5rem;
        margin: 0 0.5rem;
        background: rgba(0, 0, 0, 0.5);
    }

    /* Remove rounded corners on mobile */
    .listing, 
    .carousel, 
    .carousel-item, 
    .carousel-item img,
    .carousel div:not(.carousel-indicator):not(.carousel-indicators),
    .carousel-inner {
        border-radius: 0 !important;
        overflow: hidden;
    }

    .listing-info {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0 1rem;
    }
    
    .listing-info-map {
        position: static;
        min-height: 200px;
        height: 200px;
        display: flex;
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0;
        padding-right: 0;
    }
    
    .map-placeholder {
        min-height: 200px;
        height: 100%;
        padding: 0;
    }

    .listing-info-main {
        padding-top: 0;
        padding-bottom: 0;
        padding-left: 0;
        padding-right: 0;
    }
}

/* Desktop Styles */
@media (min-width: 768px) {
    .container {
        margin: 1rem auto;
    }

    .listing-grid {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr;
    }

    .listing-container,
    .listing-info {
        padding: 0;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
    }

    .listing-content {
        flex: 1;
    }

    .carousel {
        width: 100%;
        height: auto;
        min-height: 600px;
        position: relative;
        overflow: hidden;
        border-radius: 0;
        aspect-ratio: 2/1;
    }

    .listing-info {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
        align-items: start;
    }

    .listing-info-map {
        position: sticky;
        top: 1rem;
        height: 100%;
        min-height: 300px;
        display: flex;
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
        padding-left: 0;
        padding-right: 0;
    }

    .listing-content {
        flex: 1;
    }

    .carousel {
        width: 100%;
        height: auto;
        min-height: 600px;
        position: relative;
        overflow: hidden;
        border-radius: 0;
        aspect-ratio: 2/1;
    }

    .map-placeholder {
        min-height: 300px;
        height: 100%;
        padding: 0;
    }
} 