/**
 * Estate Listing Frontend Styles
 */

/* Grid Layout */
.ele-listing-wrapper {
    width: 100%;
}

.ele-listing-grid {
    display: grid;
    grid-template-columns: repeat(var(--ele-columns, 2), 1fr);
    gap: var(--ele-gap, 20px);
}

/* Card Base */
.ele-card {
    perspective: 1000px;
    height: var(--ele-card-height, 500px);
}

.ele-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.ele-card.flipped .ele-card-inner {
    transform: rotateY(180deg);
}

/* Card Front & Back */
.ele-card-front,
.ele-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    overflow: hidden;
    background: transparent;
}

.ele-card-front {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: 100%;
}

.ele-card-back {
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #1a1a1a;
    padding: 20px;
    overflow: visible;
}

/* Card Image Wrapper - osobny div z własnym border-radius */
.ele-card-image-wrapper {
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    height: 220px;
    border-radius: 16px;
    border: 1px solid #1a1a1a;
    border-style: solid;
}

.ele-card-image-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Card Content Wrapper - osobny div z własnym border-radius */
.ele-card-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #1a1a1a;
    border-style: solid;
    padding: 20px 24px;
    margin-top: -20px;
    position: relative;
    z-index: 1;
}

/* Details Button */
.ele-details-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 10px 20px;
    background: #fff;
    border: none;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.ele-details-btn:hover {
    background: #f5f5f5;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

/* Card Content */
.ele-card-content {
    padding: 20px 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ele-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.ele-card-left {
    flex: 1;
}

.ele-card-right {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
}

/* Card Title */
.ele-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Title Icon */
.ele-title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.ele-title-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ele-title-icon svg {
    width: 100%;
    height: 100%;
}

/* Card Status */
.ele-card-status {
    font-size: 14px;
    font-weight: 500;
}

.ele-status-dostepny {
    color: #4caf50;
}

.ele-status-zarezerwowany {
    color: #ff9800;
}

.ele-status-sprzedany {
    color: #f44336;
}

/* Card Info */
.ele-card-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.ele-info-label {
    font-size: 12px;
    color: #888;
    font-weight: 400;
}

.ele-info-value {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
}

.ele-info-badge {
    background: #1a1a1a;
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 13px;
}

/* Card Buttons */
.ele-card-buttons {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.ele-btn {
    padding: 12px 20px;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    text-decoration: none;
    border: 1px solid #e0e0e0;
    background: #fff;
    color: #333;
}

.ele-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.ele-btn-outline {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: #333;
}

.ele-btn-outline:hover {
    background: #f5f5f5;
}

.ele-btn-filled {
    background: #1a1a1a;
    border-color: #1a1a1a;
    color: #fff;
}

.ele-btn-filled:hover {
    background: #333;
    border-color: #333;
}

/* Back Side Content */
.ele-card-back-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Back Top - 2 columns: title/status left, areas right */
.ele-back-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.ele-back-top-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ele-back-top-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.ele-back-title {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ele-back-status {
    font-size: 16px;
    font-weight: 500;
}

/* Back Area - with badge */
.ele-back-area {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.ele-back-area-label {
    font-size: 13px;
    color: #666;
}

.ele-back-area-value {
    background: #1a1a1a;
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
}

/* Back Details List - full width, left aligned */
.ele-back-details-list {
    margin-bottom: 16px;
}

.ele-back-detail-item {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.ele-back-detail-label {
    font-size: 16px;
    color: #1a1a1a;
}

.ele-back-detail-value {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Back Options Simple */
.ele-back-options-simple {
    margin-bottom: 20px;
}

.ele-back-options-label {
    font-size: 16px;
    color: #1a1a1a;
    display: block;
    margin-bottom: 8px;
}

.ele-back-options-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ele-back-option {
    font-size: 16px;
    color: #1a1a1a;
    font-weight: 500;
    padding-left: 12px;
    border-left: 1px solid #ccc;
}

.ele-back-option:first-child {
    padding-left: 0;
    border-left: none;
}

/* Back Footer - pushes price and buttons to bottom */
.ele-back-footer {
    margin-top: auto;
}

/* Back Price Section */
.ele-back-price-section {
    margin-bottom: 16px;
}

.ele-price-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ele-price-item {
    display: flex;
    flex-direction: column;
}

.ele-price-label {
    font-size: 14px;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.ele-price-label strong {
    color: #1a1a1a;
    font-weight: 700;
}

.ele-price-value {
    font-size: 26px;
    font-weight: 700;
    color: #1a1a1a;
}

/* Back Buttons */
.ele-back-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ele-back-buttons .ele-btn {
    justify-content: center;
    padding: 10px 16px;
    font-size: 13px;
}

/* Back Close Button */
.ele-back-close-btn {
    position: absolute;
    top: -18px;
    right: -18px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    max-width: 36px;
    max-height: 36px;
    padding: 0;
    border: none;
    background: #1a1a1a;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    aspect-ratio: 1 / 1;
}

.ele-back-close-btn:hover {
    background: #333;
    color: #fff;
    transform: scale(1.1);
}

.ele-back-close-btn svg {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px;
    min-height: 16px;
    flex-shrink: 0;
    fill: #fff;
}

/* Promo Card */
.ele-promo-card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    height: auto;
    min-height: 500px;
}

.ele-promo-content {
    padding: 40px;
    text-align: justify;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ele-promo-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 20px 0;
}

.ele-promo-text {
    font-size: 16px;
    color: #666;
    line-height: 1.7;
    margin: 0 0 60px 0;
    text-align: justify;
}

.ele-promo-card .ele-btn {
    margin: 0;
    align-self: flex-end;
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .ele-listing-grid {
        grid-template-columns: repeat(var(--ele-columns-tablet, 2), 1fr);
    }
}

/* Responsive - Mobile */
@media (max-width: 767px) {
    .ele-listing-grid {
        grid-template-columns: repeat(var(--ele-columns-mobile, 1), 1fr);
    }

    .ele-card {
        height: auto;
        min-height: 450px;
    }

    .ele-card-header {
        flex-direction: column;
        gap: 16px;
    }

    .ele-card-right {
        align-items: flex-start;
        flex-direction: row;
        gap: 16px;
    }

    .ele-card-info {
        align-items: flex-start;
    }

    .ele-card-buttons {
        flex-direction: column;
    }

    .ele-btn {
        width: 100%;
        justify-content: center;
    }

    /* Hide promo card on mobile */
    .ele-promo-card {
        display: none;
    }

    .ele-price-row {
        flex-direction: column;
        gap: 12px;
    }
}

/* Animation for scroll-to-flip */
.ele-card.highlight-flip {
    animation: highlightPulse 0.5s ease-out;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(76, 175, 80, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Editor Preview - Allow flip in editor for styling */
.elementor-editor-active .ele-card.flipped .ele-card-inner {
    transform: rotateY(180deg);
}

.elementor-editor-active .ele-card-back {
    display: flex;
}
