/* Residences Page Styles */
.residences-hero {
    position: relative;
    height: 60vh;
    color: var(--white);
    overflow: hidden;
}

.residences-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url('../img/programok/sio.jpg');
    background-size: cover;
    background-position: center;
}

.residences-hero .hero-content {
    position: relative;
    text-align: center;
    justify-content: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.residences-hero h1 {
    font-size: 3.5rem;
    font-weight: bold;
    margin-bottom: 1.5rem;
    color: var(--white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.residences-hero p {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.25rem;
    color: var(--white);
    line-height: 1.6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.residences-list {
    padding: 4rem 0;
    background-color: var(--bg-light);
}

.residences-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1rem;
}

/* Index page grid layout */
.index-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    padding: 1rem;
}

.index-grid .residence-card {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    margin-bottom: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.index-grid .residence-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.index-grid .carousel {
    height: 180px;
    width: 100%;
}

.index-grid .carousel img {
    object-fit: cover;
    transition: transform 0.3s ease;
}

.index-grid .residence-card:hover .carousel img {
    transform: scale(1.05);
}

.index-grid .residence-content {
    padding: 1rem;
    background: white;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.index-grid .residence-header {
    margin-bottom: 0.75rem;
    text-align: center;
}

.index-grid .residence-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.index-grid .residence-description {
    font-size: 1rem;
    color: var(--text-light);
    line-height: 1.6;
}

.index-grid .residence-description ul {
    margin: 1rem 0;
}

.index-grid .residence-description li {
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.index-grid .residence-description li:last-child {
    border-bottom: none;
}

.index-grid .residence-cta {
    margin-top: auto;
    padding-top: 0.75rem;
}

.index-grid .cta-button {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    text-align: center;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.index-grid .cta-button:hover {
    background: #ffffff;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary);
}

/* Carousel controls for index grid */
.index-grid .carousel-control {
    opacity: 0;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-dark);
}

.index-grid .residence-card:hover .carousel-control {
    opacity: 1;
}

.index-grid .carousel-control:hover {
    background: white;
    transform: scale(1.1);
}

/* Responsive design for index grid */
@media (max-width: 1024px) {
    .index-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 0.5rem;
    }

    .residence-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .residence-image {
        height: 300px;
    }

    .carousel {
        height: 300px;
    }

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

@media (max-width: 768px) {
    .residences-hero {
        height: 50vh;
    }

    .residences-hero h1 {
        font-size: 2.5rem;
        padding: 0 1rem;
    }

    .residences-hero p {
        font-size: 1.1rem;
        padding: 0 1rem;
    }

    .index-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }
    
    .index-grid .carousel {
        height: 200px;
    }
    
    .index-grid .residence-content {
        padding: 1.5rem;
    }
    
    .index-grid .residence-title {
        font-size: 1.3rem;
    }

    .index-grid .residence-description {
        font-size: 0.95rem;
    }

    .residence-card {
        grid-template-columns: 1fr;
        margin-bottom: 1rem;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .residence-card.reverse {
        direction: ltr;
    }

    .carousel {
        margin: 0.75rem;
    }

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

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

    .residence-content {
        padding: 1.25rem;
    }

    .residence-description {
        font-size: 0.95rem;
    }

    .residence-features {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .key-features-grid {
        grid-template-columns: 1fr;
    }

    .amenities-list {
        gap: 0.4rem;
    }
}

@media (max-width: 480px) {
    .residences-hero {
        height: 40vh;
    }

    .residences-hero h1 {
        font-size: 2rem;
    }

    .residences-hero p {
        font-size: 1rem;
    }

    .index-grid {
        padding: 0.75rem;
        gap: 1rem;
    }

    .index-grid .carousel {
        height: 180px;
    }

    .index-grid .residence-content {
        padding: 1rem;
    }

    .index-grid .residence-title {
        font-size: 1.2rem;
    }

    .index-grid .residence-description {
        font-size: 0.9rem;
    }

    .residence-title {
        font-size: 1.4rem;
    }

    .residence-description {
        font-size: 0.9rem;
    }

    .price-amount {
        font-size: 1.25rem;
    }

    .residence-card {
        padding: 0.75rem;
        box-sizing: border-box;
    }
    
    /* Apply consistent margins and ensure proper sizing */
    .carousel,
    .residence-content {
        margin: 0.5rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Add more margin on the right side of the carousel */
    .carousel {
        height: 250px;
        margin-right: 1.5rem;
    }
    
    .carousel-inner,
    .carousel-item,
    .carousel img {
        width: 100%;
        height: 100%;
    }
    
    .residence-content {
        padding: 1rem;
        text-align: left;
    }
    
    /* Ensure consistent layout for both normal and reversed cards */
    .residence-card,
    .residence-card.reverse {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }
    
    .carousel-control {
        width: 30px;
        height: 30px;
    }
}

/* Original list layout styles */
.residence-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
}

.residence-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.residence-image {
    position: relative;
    height: auto;
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.residence-content {
    padding: 2rem;
}

.residence-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.residence-title {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-dark);
}

.residence-price {
    text-align: right;
}

.price-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
}

.price-period {
    font-size: 0.875rem;
    color: var(--text-light);
}

.residence-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.residence-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.feature {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
}

.feature svg {
    color: var(--primary);
}

.key-features {
    margin-bottom: 2rem;
}

.key-features h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.key-features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
}

.key-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.key-feature svg {
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.amenities-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.amenity-tag {
    background-color: var(--bg-light);
    color: var(--text-dark);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
}

/* Carousel Styles */
.carousel {
    position: relative;
    width: 100%;
    height: 400px;
    overflow: hidden;
    border-radius: var(--border-radius);
    margin: 1rem;
}

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

.carousel-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 0;
}

.carousel-item.active {
    opacity: 1;
    z-index: 1;
    transition: opacity 0.8s ease 0.2s;
}

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

.carousel-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 2;
}

.carousel-control:hover {
    background: rgba(0, 0, 0, 0.8);
}

.carousel-control.prev {
    left: 20px;
}

.carousel-control.next {
    right: 20px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .residence-card {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .residence-image {
        height: 400px;
    }

    .carousel {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .residences-hero h1 {
        font-size: 2.5rem;
    }

    .residence-content {
        padding: 1.5rem 2rem 1.5rem 2.5rem;
    }

    .carousel {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .residences-hero h1 {
        font-size: 2rem;
    }

    .residence-image {
        height: 300px;
    }

    .carousel {
        height: 250px;
    }
    
    .carousel-control {
        width: 30px;
        height: 30px;
        padding: 8px;
    }
}

/* Add this to the existing CSS */
.residence-card.reverse {
    grid-template-columns: 1fr 1fr;
    direction: rtl;
}

.residence-card.reverse .residence-content {
    direction: ltr;
}

/* Update the carousel control positions for reversed cards */
.residence-card.reverse .carousel-control.prev {
    left: 20px;
    right: auto;
}

.residence-card.reverse .carousel-control.next {
    right: 20px;
    left: auto;
}

/* Ensure carousel controls are properly positioned */
.residence-card.reverse .carousel {
    direction: ltr;
}

.residence-location {
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-dark);
    text-decoration: none;
    cursor: default;
}

.residence-location strong {
    font-weight: bold;
}

.residence-cta {
    margin-top: 2rem;
    text-align: center;
}

.cta-button {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background-color: var(--primary);
    color: #ffffff;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background-color: #ffffff;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--primary);
}

@media (max-width: 768px) {
    .residence-card {
        grid-template-columns: 1fr;
        margin-bottom: 1rem;
    }

    .residence-card.reverse {
        direction: ltr;
    }

    .carousel {
        aspect-ratio: 16/9;
    }

    .residence-content {
        padding: 2rem 2.5rem;
    }

    .residence-description {
        font-size: 0.95rem;
    }
}

.quote {
    margin-bottom: 2rem;
}

.quote-text {
    font-size: 1.8rem;
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 1rem;
    color: var(--white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.quote-author {
    font-size: 1.2rem;
    color: var(--white);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .residence-card {
        padding: 1.5rem;
    }
    
    .carousel {
        margin: 0.75rem;
    }
    
    .residence-content {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .residence-card {
        padding: 1rem;
    }
    
    /* Apply consistent margins to both carousel and content */
    .carousel,
    .residence-content {
        margin: 0.5rem;
    }
    
    /* Add more margin on the right side of the carousel */
    .carousel {
        margin-right: 1.5rem;
    }
    
    .residence-content {
        padding: 1rem;
    }
    
    .carousel-control {
        width: 30px;
        height: 30px;
    }
}