/**
 * Shortcodes Styles
 * 
 * Styles for plugin shortcodes:
 * - [property_grid]
 * - [featured_properties]
 * - [agent_grid]
 * - [property_search]
 * 
 * @package Premium_Estate
 * @since 1.5.0
 */

/* ==========================================================================
   Property Grid & Agent Grid
   ========================================================================== */

.premium-estate-property-grid,
.premium-estate-agent-grid {
    display: grid;
    gap: 30px;
    margin: 40px 0;
}

/* Grid Columns */
.premium-estate-property-grid.columns-2,
.premium-estate-agent-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.premium-estate-property-grid.columns-3,
.premium-estate-agent-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.premium-estate-property-grid.columns-4,
.premium-estate-agent-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Responsive */
@media (max-width: 1024px) {
    .premium-estate-property-grid.columns-4,
    .premium-estate-agent-grid.columns-4,
    .premium-estate-property-grid.columns-3,
    .premium-estate-agent-grid.columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .premium-estate-property-grid,
    .premium-estate-agent-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* No Results Message */
.no-properties-found,
.no-agents-found {
    text-align: center;
    padding: 40px 20px;
    font-size: 1.1rem;
    color: #666;
}

/* ==========================================================================
   Property Card
   ========================================================================== */

.property-card {
    position: relative;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.property-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(91, 99, 255, 0.15);
    border-color: rgba(91, 99, 255, 0.1);
}

/* Property Badges */
.property-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    z-index: 10;
}

.property-badge.featured-badge {
    background: #f59e0b;
    color: #fff;
}

.property-badge.status-badge {
    top: auto;
    bottom: 15px;
    right: 15px;
    background: #10b981;
    color: #fff;
}

.property-badge.status-badge.status-for-rent {
    background: #3b82f6;
}

.property-badge.status-badge.status-sold {
    background: #6b7280;
}

/* Favorites Heart Icon */
.property-card .property-favorite {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: none;
}

.property-card .property-favorite:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.property-card .property-favorite i {
    font-size: 18px;
    color: #6b7280;
    transition: all 0.3s ease;
}

.property-card .property-favorite:hover i {
    color: #ef4444;
}

.property-card .property-favorite.is-favorite i {
    color: #ef4444;
}

/* Property Image */
.property-card .property-image {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
}

.property-card .property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.property-card:hover .property-image img {
    transform: scale(1.05);
}

/* Property Content */
.property-card .property-content {
    padding: 20px;
}

.property-card .property-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.property-card .property-type {
    font-size: 0.875rem;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}

.property-card .property-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #5b63ff;
    margin: 0; /* No bottom margin */
}

.property-card .property-title {
    margin: 0 0 12px 0;
    font-size: 1.25rem;
    line-height: 1.4;
}

.property-card .property-title a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.property-card .property-title a:hover {
    color: #5b63ff;
}

.property-card .property-location {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #6b7280;
    margin-bottom: 5px;
    font-size: 0.938rem;
}

.property-card .property-location .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Property Features */
.property-card .property-features {
    display: flex;
    gap: 5px; /* Matches verticalSpacing default - DYNAMIC via Gutenberg for carousel */
    margin: 5px 0;
    padding: 5px 0; /* Reduced from 15px */
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.property-card .property-features .feature {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.938rem;
    color: #4b5563;
}

.property-card .property-features .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: #6b7280;
}

/* Property Excerpt */
.property-card .property-excerpt {
    margin: 15px 0;
    color: #6b7280;
    line-height: 1.6;
    font-size: 0.938rem;
}

/* Property Footer */
.property-card .property-footer {
    margin-top: 20px;
}

.property-card .property-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    background: #5b63ff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.property-card .property-link:hover {
    background: #4a52cc;
    color: #fff !important; /* Force white text on hover */
}

.property-card .property-link .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* ==========================================================================
   Agent Card
   ========================================================================== */

.agent-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
}

.agent-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Agent Image */
.agent-card .agent-image {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.agent-card .agent-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.agent-card:hover .agent-image img {
    transform: scale(1.05);
}

/* Agent Content */
.agent-card .agent-content {
    padding: 25px 20px;
}

.agent-card .agent-name {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    line-height: 1.3;
}

.agent-card .agent-name a {
    color: #1f2937;
    text-decoration: none;
    transition: color 0.2s ease;
}

.agent-card .agent-name a:hover {
    color: #5b63ff;
}

.agent-card .agent-position {
    color: #6b7280;
    margin-bottom: 15px;
    font-size: 1rem;
}

.agent-card .agent-specialization {
    margin: 15px 0;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 6px;
    font-size: 0.938rem;
    text-align: left;
}

.agent-card .agent-specialization strong {
    display: block;
    margin-bottom: 5px;
    color: #1f2937;
}

.agent-card .agent-experience {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: #f3f4f6;
    border-radius: 20px;
    font-size: 0.875rem;
    color: #4b5563;
    margin: 10px 0;
}

.agent-card .agent-experience .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Agent Contact */
.agent-card .agent-contact {
    margin: 20px 0;
    padding: 20px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}

.agent-card .agent-phone,
.agent-card .agent-email {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 10px 0;
    font-size: 0.938rem;
}

.agent-card .agent-phone a,
.agent-card .agent-email a {
    color: #4b5563;
    text-decoration: none;
    transition: color 0.2s ease;
}

.agent-card .agent-phone a:hover,
.agent-card .agent-email a:hover {
    color: #5b63ff;
}

.agent-card .agent-contact .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
    color: #6b7280;
}

/* Agent Social */
.agent-card .agent-social {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

.agent-card .agent-social .social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s ease;
}

.agent-card .agent-social .social-link:hover {
    background: #5b63ff;
    color: #fff;
    transform: translateY(-2px);
}

.agent-card .agent-social .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Agent Footer */
.agent-card .agent-footer {
    margin-top: 20px;
}

.agent-card .agent-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 12px 24px;
    background: #5b63ff;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.agent-card .agent-link:hover {
    background: #4a52cc;
}

.agent-card .agent-link .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* ==========================================================================
   Property Search Form
   ========================================================================== */

.premium-estate-search-form {
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 40px 0;
}

.premium-estate-search-form .search-form-inner {
    display: grid;
    gap: 20px;
}

/* Horizontal Style */
.premium-estate-search-form.style-horizontal .search-form-inner {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Vertical Style */
.premium-estate-search-form.style-vertical .search-form-inner {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
}

/* Search Field */
.premium-estate-search-form .search-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.premium-estate-search-form .search-field label {
    font-weight: 600;
    font-size: 0.938rem;
    color: #1f2937;
}

.premium-estate-search-form .search-field select,
.premium-estate-search-form .search-field input[type="number"] {
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.premium-estate-search-form .search-field select:focus,
.premium-estate-search-form .search-field input[type="number"]:focus {
    outline: none;
    border-color: #5b63ff;
}

/* Price Inputs */
.premium-estate-search-form .search-field-price .price-inputs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
}

.premium-estate-search-form .price-separator {
    color: #6b7280;
    font-weight: 600;
}

/* Submit Button */
.premium-estate-search-form .search-submit {
    justify-content: flex-end;
}

.premium-estate-search-form .search-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    background: #5b63ff;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.premium-estate-search-form .search-button:hover {
    background: #4a52cc;
}

.premium-estate-search-form .search-button .dashicons {
    width: 20px;
    height: 20px;
    font-size: 20px;
}

/* Vertical style - full width button */
.premium-estate-search-form.style-vertical .search-button {
    width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    .premium-estate-search-form {
        padding: 20px;
    }
    
    .premium-estate-search-form.style-horizontal .search-form-inner {
        grid-template-columns: 1fr;
    }
    
    .premium-estate-search-form .search-submit {
        justify-content: stretch;
    }
    
    .premium-estate-search-form .search-button {
        width: 100%;
    }
}

/* ==========================================================================
   Property Carousel
   ========================================================================== */

/* Outer container for carousel + pagination (visual separation) */
.premium-estate-carousel-container {
    width: 100%;
    max-width: 100%; /* NOTE: Inherit page content width - no hardcoded limit */
    margin: 40px 0; /* No auto centering - let parent control alignment */
    padding: 0;
    position: relative;
}

/* Swiper carousel container */
.premium-estate-property-carousel {
    width: 100%;
    padding: 20px 0;
    margin: 0 0 30px 0; /* Bottom margin separates from pagination */
    position: relative;
    overflow: visible;
}

/* Swiper controls .swiper-wrapper layout via JS - don't override! */

.premium-estate-property-carousel .swiper-slide {
    height: auto;
    display: flex; /* Flex for card internal layout */
    /* Padding controlled by Gutenberg 'Gap Between Slides' setting via dynamic CSS */
}

.premium-estate-property-carousel .swiper-slide .property-card {
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    min-height: 500px; /* Ensure consistent card height */
}

/* Carousel Card Image */
.premium-estate-property-carousel .property-card .property-image {
    height: 280px; /* Taller image in carousel */
    flex-shrink: 0;
}

/* Carousel Card Content */
.premium-estate-property-carousel .property-card .property-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

/* Carousel Card Title - Limit lines */
.premium-estate-property-carousel .property-card .property-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
    min-height: 1.5em; /* Reserve space for 2 lines */
}

/* Carousel Card Description - Limit lines */
.premium-estate-property-carousel .property-card .property-description {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    margin-bottom: 15px;
}

/* Carousel Card Meta */
.premium-estate-property-carousel .property-card .property-meta {
    margin-top: auto; /* Push to bottom */
}

/* Carousel Card Button */
.premium-estate-property-carousel .property-card .property-button {
    margin-top: 15px;
}

/* Navigation Arrows - BASE LAYOUT (all styling is DYNAMIC via Gutenberg) */
.premium-estate-property-carousel .swiper-button-prev,
.premium-estate-property-carousel .swiper-button-next {
    /* Shape & Animation - STATIC (always the same) */
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: all;
    transform: translateY(-50%);
    z-index: 15;
    
    /* Layout - CRITICAL (must be !important for visibility) */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    opacity: 1 !important;
    
    /* NOTE: width, height, background, border, box-shadow, top are DYNAMIC (controlled by Gutenberg) */
}

.premium-estate-property-carousel .swiper-button-prev {
    left: 10px !important; /* Slightly inset for visibility */
}

.premium-estate-property-carousel .swiper-button-next {
    right: 10px !important; /* Slightly inset for visibility */
}

/* FULL FALLBACK for :after pseudo-elements (works even if CDN fails) */
.premium-estate-property-carousel .swiper-button-prev:after,
.premium-estate-property-carousel .swiper-button-next:after {
    /* Critical base styles for :after to render */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
    
    /* Font styling - NOTE: font-size & color are DYNAMIC (controlled by Gutenberg) */
    line-height: 1 !important;
    font-weight: 900 !important;
    font-family: Arial, "Helvetica Neue", sans-serif !important;
}

/* Arrow content (Unicode arrows - work everywhere!) */
.premium-estate-property-carousel .swiper-button-prev:after {
    content: '\2039' !important; /* Unicode ‹ LEFT ANGLE QUOTATION */
}

.premium-estate-property-carousel .swiper-button-next:after {
    content: '\203A' !important; /* Unicode › RIGHT ANGLE QUOTATION */
}

.premium-estate-property-carousel .swiper-button-prev:hover,
.premium-estate-property-carousel .swiper-button-next:hover {
    background: #5b63ff; /* Hover bg - can add control later if needed */
    transform: translateY(-50%) scale(1.1);
}

.premium-estate-property-carousel .swiper-button-prev:hover:after,
.premium-estate-property-carousel .swiper-button-next:hover:after {
    color: #fff; /* Hover icon - can add control later if needed */
}

.premium-estate-property-carousel .swiper-button-prev.swiper-button-disabled,
.premium-estate-property-carousel .swiper-button-next.swiper-button-disabled {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Pagination Dots - OUTSIDE swiper (visually separated) */
.premium-estate-carousel-container .swiper-pagination {
    position: relative !important; /* NOTE: Intentional - pagination outside swiper for visual separation */
    bottom: auto !important; /* NOTE: Intentional - using margin-based spacing */
    padding: 15px 0;
    margin: 0;
    width: 100%;
}

.premium-estate-carousel-container .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    opacity: 1;
    transition: all 0.3s ease;
    /* NOTE: background is controlled by dynamic CSS (paginationColorInactive) */
}

.premium-estate-carousel-container .swiper-pagination-bullet-active {
    width: 30px;
    border-radius: 6px;
    /* NOTE: background is controlled by dynamic CSS (paginationColorActive) */
}

.premium-estate-carousel-container .swiper-pagination-bullet:hover {
    background: #5b63ff; /* Hover color - can add control later if needed */
    transform: scale(1.2);
}

/* Dynamic Bullets */
.premium-estate-property-carousel .swiper-pagination-bullets-dynamic {
    overflow: hidden;
    font-size: 0;
}

.premium-estate-property-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet {
    transform: scale(0.33);
    position: relative;
}

.premium-estate-property-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main {
    transform: scale(1);
}

.premium-estate-property-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev,
.premium-estate-property-carousel .swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next {
    transform: scale(0.66);
}

/* Responsive Carousel */
@media (max-width: 1024px) {
    .premium-estate-property-carousel {
        padding: 0 15px;
    }
    
    .premium-estate-property-carousel .swiper {
        padding: 20px 0 0 0; /* Top padding only */
        margin: 0;
    }
    
    .premium-estate-property-carousel .swiper-slides-container {
        margin-bottom: 20px; /* Reduce spacing on tablets */
    }
    
    .premium-estate-property-carousel .swiper-button-prev,
    .premium-estate-property-carousel .swiper-button-next {
        width: 40px;
        height: 40px;
    }
    
    .premium-estate-property-carousel .swiper-button-prev:after,
    .premium-estate-property-carousel .swiper-button-next:after {
        font-size: 18px;
    }
}

@media (max-width: 640px) {
    .premium-estate-carousel-container {
        padding: 0 10px;
    }
    
    .premium-estate-property-carousel {
        margin-bottom: 15px; /* Even less spacing on mobile */
    }
    
    /* NOTE: swiper padding is controlled by dynamic CSS (containerPaddingTop/Bottom) */
    /* NOTE: slide padding is controlled by dynamic CSS (slideGap) */
    
    .premium-estate-property-carousel .swiper-slide .property-card {
        min-height: 450px; /* Shorter on mobile */
    }
    
    .premium-estate-property-carousel .property-card .property-image {
        height: 220px; /* Shorter image on mobile */
    }
    
    .premium-estate-property-carousel .swiper-button-prev,
    .premium-estate-property-carousel .swiper-button-next {
        width: 40px;
        height: 40px;
    }
    
    .premium-estate-property-carousel .swiper-button-prev {
        left: 5px;
    }
    
    .premium-estate-property-carousel .swiper-button-next {
        right: 5px;
    }
    
    .premium-estate-property-carousel .swiper-button-prev:after,
    .premium-estate-property-carousel .swiper-button-next:after {
        font-size: 16px;
    }
    
    .premium-estate-property-carousel .swiper-pagination-bullet {
        width: 10px;
        height: 10px;
    }
    
    .premium-estate-property-carousel .swiper-pagination-bullet-active {
        width: 24px;
    }
}

/* Loading State */
.premium-estate-property-carousel.swiper-loading {
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-estate-property-carousel.swiper-loading:before {
    content: "";
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #5b63ff;
    border-radius: 50%;
    animation: swiper-preloader-spin 1s linear infinite;
}

@keyframes swiper-preloader-spin {
    100% {
        transform: rotate(360deg);
    }
}
