/**
 * ThuducReal ProjectBook Page Enhancements
 * Optimized UI and performance for property listing pages
 */

/* ========================================
   PROJECT BOOK HEADER ENHANCEMENTS
   ======================================== */

.project-book-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 0;
    position: relative;
    overflow: hidden;
    margin-bottom: 0;
}

.project-book-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 123, 255, 0.03);
    z-index: 1;
}

.wrap-property-v2.style-1 {
    position: relative;
    z-index: 2;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 20px 0;
    min-height: auto;
}

.box-inner-left {
    margin-bottom: 20px;
}

.box-inner-left img {
    border-radius: 12px;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: cover;
}

.box-inner-left:hover img {
    transform: scale(1.02);
}

.box-inner-right {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 25px;
    margin-left: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 123, 255, 0.1);
}

/* Breadcrumb Improvements */
.project-breadcrumb {
    background: rgba(255, 255, 255, 0.9);
    padding: 15px 0;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(0, 123, 255, 0.1);
}

.project-breadcrumb .breadcrumb {
    margin: 0;
    padding: 0;
    background: transparent;
    display: flex;
    flex-wrap: wrap;
    list-style: none;
}

.project-breadcrumb .breadcrumb-item {
    color: #6c757d;
    font-size: 14px;
}

.project-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    color: #dee2e6;
    padding: 0 8px;
}

.project-breadcrumb .breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.project-breadcrumb .breadcrumb-item a:hover {
    color: #0056b3;
}

.project-breadcrumb .breadcrumb-item.active {
    color: #333;
    font-weight: 500;
}

/* ========================================
   PROPERTY CARDS ENHANCEMENT
   ======================================== */

.homeya-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 16px rgba(0, 123, 255, 0.08);
    border: 1px solid rgba(0, 123, 255, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    margin-bottom: 30px;
}

.homeya-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0, 123, 255, 0.15);
    border-color: rgba(0, 123, 255, 0.2);
}

.images-group {
    position: relative;
    overflow: hidden;
    border-radius: 16px 16px 0 0;
    height: 250px;
    display: block;
    background: #f8f9fa;
}

.images-style {
    height: 100%;
    position: relative;
}

.images-style img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.homeya-box:hover .images-style img {
    transform: scale(1.05);
}

/* Enhanced property card overlay */
.top {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    z-index: 3;
}

.bottom {
    position: absolute;
    bottom: 15px;
    left: 15px;
    z-index: 3;
}

.flag-tag {
    background: rgba(0, 123, 255, 0.9);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.flag-tag.success {
    background: rgba(40, 167, 69, 0.9);
}

.flag-tag.style-1 {
    background: rgba(255, 193, 7, 0.9);
    color: #333;
}

.flag-tag.style-2 {
    background: rgba(108, 117, 125, 0.9);
}

/* ========================================
   PROPERTY CARD CONTENT
   ======================================== */

.content {
    padding: 25px;
}

.content .h7 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
    line-height: 1.4;
    color: #333;
}

.content .h7 a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.content .h7 a:hover {
    color: #007bff;
}

.desc {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.desc i {
    color: #007bff;
}

.meta-list {
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.meta-list .item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #666;
    font-size: 0.9rem;
}

.meta-list .item i {
    color: #007bff;
    font-size: 16px;
}

/* ========================================
   PROPERTY CARD FOOTER
   ======================================== */

.archive-bottom {
    padding: 20px 25px;
    border-top: 1px solid rgba(0, 123, 255, 0.1);
    background: #f8f9fa;
}

.avatar {
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.1);
}

.archive-bottom .h7 {
    color: #007bff;
    font-weight: 700;
    font-size: 1.1rem;
}

/* ========================================
   SECTION IMPROVEMENTS
   ======================================== */

.flat-recommended-v2 {
    padding: 60px 0;
    background: #ffffff;
    position: relative;
}

.flat-recommended-v2:nth-child(even) {
    background: #f8f9fa;
}

.flat-recommended-v2:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 123, 255, 0.1), transparent);
}

.box-title-listing {
    margin-bottom: 40px;
    text-align: center;
    padding: 0 15px;
}

.box-title-listing h5 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.box-title-listing h5::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 2px;
}

/* ========================================
   INTERACTIVE ELEMENTS
   ======================================== */

.box-icon {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 123, 255, 0.2);
    transition: all 0.3s ease;
    border-radius: 8px;
}

.box-icon:hover {
    background: #007bff;
    color: white;
    transform: scale(1.05);
    border-color: #007bff;
}

.btn-favorite,
.btn-compare {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-favorite:hover,
.btn-compare:hover {
    color: #dc3545;
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    .project-book-header {
        padding: 15px 0;
        margin-bottom: 20px;
    }
    
    .wrap-property-v2.style-1 {
        flex-direction: column;
        padding: 15px 0;
        min-height: auto;
    }
    
    .box-inner-left {
        width: 100%;
        margin-bottom: 20px;
        padding: 0 15px;
    }
    
    .box-inner-left img {
        max-height: 250px;
        border-radius: 8px;
    }
    
    .box-inner-right {
        margin-left: 0;
        margin: 0 15px;
        padding: 20px;
    }
    
    .project-breadcrumb {
        margin: 0 15px 20px;
        padding: 10px 15px;
    }
    
    .project-breadcrumb .breadcrumb {
        font-size: 12px;
    }
    
    .content-property .title h1 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 10px;
    }
    
    .pricing-property h2 {
        font-size: 1.3rem;
    }
    
    .box-tag {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .flag-tag {
        font-size: 11px;
        padding: 4px 8px;
    }
    
    .list-info {
        margin: 15px 0;
    }
    
    .pricing-property {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start !important;
    }
    
    .pricing-property .d-flex {
        width: 100%;
    }
    
    .pricing-property ul {
        justify-content: center;
        width: 100%;
    }
    
    .box-icon {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Property Cards Mobile */
    .images-group {
        height: 200px;
    }
    
    .meta-list {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .content {
        padding: 20px;
    }
    
    .archive-bottom {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .homeya-box {
        margin-bottom: 20px;
    }
    
    .box-title-listing h5 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .flat-recommended-v2 {
        padding: 40px 0;
    }
    
    /* Fix section spacing */
    .flat-section-v30 {
        padding-bottom: 20px;
    }
    
    /* Ensure no overlap */
    section + section {
        margin-top: 0;
        clear: both;
    }
}

/* ========================================
   LOADING STATES FOR PROPERTY CARDS
   ======================================== */

.property-card-skeleton {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #f0f0f0;
    margin-bottom: 30px;
    overflow: hidden;
    position: relative;
}

.property-card-skeleton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: skeleton-loading 1.5s infinite;
    z-index: 1;
}

.skeleton-image {
    height: 250px;
    background: #f0f0f0;
}

.skeleton-content {
    padding: 25px;
}

.skeleton-title {
    height: 20px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
    width: 80%;
}

.skeleton-text {
    height: 16px;
    background: #e0e0e0;
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 75%; }
.skeleton-text.long { width: 90%; }

.skeleton-footer {
    padding: 20px 25px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    background: #e0e0e0;
    border-radius: 50%;
}

.skeleton-price {
    height: 18px;
    width: 80px;
    background: #e0e0e0;
    border-radius: 4px;
}

/* ========================================
   ENHANCED ANIMATIONS
   ======================================== */

.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in-up.delay-1 { animation-delay: 0.1s; }
.fade-in-up.delay-2 { animation-delay: 0.2s; }
.fade-in-up.delay-3 { animation-delay: 0.3s; }
.fade-in-up.delay-4 { animation-delay: 0.4s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes skeleton-loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ========================================
   FIX FOR SECTION OVERLAP ISSUE
   ======================================== */

/* Override problematic CSS that causes section overlap on mobile */
@media only screen and (max-width: 991px) {
    /* Ensure mobile menu has proper z-index priority */
    .main-header {
        z-index: 99999 !important;
    }
    
    .mobile-menu {
        z-index: 99998 !important;
    }
    
    /* Fix for fixed sidebars that might interfere with mobile menu */
    .fixed-sidebar {
        position: static !important;
        top: auto !important;
    }
    
    /* Fix section overlaps */
    .flat-recommended-v2 {
        padding-top: 60px !important;
        margin-top: 0 !important;
    }
    
    .flat-service-v5 {
        padding-top: 60px !important;
        margin-top: 0 !important;
    }
    
    /* Ensure proper section spacing */
    .flat-section-v5 {
        padding: 60px 0 !important;
        margin: 0 !important;
    }
    
    /* Prevent negative margins that cause overlap */
    section[class*="flat-"] {
        margin-top: 0 !important;
    }
    
    /* Fix spacing between sections */
    .flat-recommended-v2 + .flat-recommended-v2 {
        margin-top: 0 !important;
    }
}

/* Additional mobile section fixes */
@media only screen and (max-width: 767px) {
    .flat-recommended-v2,
    .flat-service-v5,
    .flat-section-v5 {
        padding: 40px 0 !important;
        margin: 0 !important;
    }
    
    /* Fix mobile archive-bottom alignment */
    .archive-bottom {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        flex-direction: row !important;
        padding: 15px 20px !important;
        gap: 10px !important;
    }
    
    .archive-bottom > div:first-child {
        flex: 1 !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .archive-bottom > div:last-child {
        flex-shrink: 0 !important;
        margin-left: auto !important;
        display: flex !important;
        align-items: center !important;
        gap: 4px !important;
        white-space: nowrap !important;
    }
    
    /* Ensure avatar and agent name don't wrap */
    .archive-bottom .avatar {
        flex-shrink: 0 !important;
        width: 32px !important;
        height: 32px !important;
    }
    
    .archive-bottom span {
        font-size: 12px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: 80px !important;
    }
    
    /* Price styling for mobile */
    .archive-bottom .h7 {
        font-size: 14px !important;
        font-weight: 700 !important;
        color: #007bff !important;
    }
    
    .archive-bottom .body-1 {
        font-size: 12px !important;
    }
}

/* Extra small mobile devices */
@media only screen and (max-width: 480px) {
    .archive-bottom {
        padding: 12px 15px !important;
        gap: 8px !important;
    }
    
    .archive-bottom .avatar {
        width: 28px !important;
        height: 28px !important;
    }
    
    .archive-bottom span {
        font-size: 11px !important;
        max-width: 60px !important;
    }
    
    .archive-bottom .h7 {
        font-size: 13px !important;
    }
    
    .archive-bottom .body-1 {
        font-size: 11px !important;
    }
}

/* ========================================
   ACCESSIBILITY ENHANCEMENTS
   ======================================== */

.homeya-box:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.images-group:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .homeya-box {
        border: 2px solid #333;
    }
    
    .flag-tag {
        border: 1px solid #333;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .homeya-box,
    .images-style img,
    .box-icon,
    .fade-in-up {
        transition: none;
        animation: none;
    }
    
    .property-card-skeleton::before {
        animation: none;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .homeya-box {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
    }
    
    .images-group {
        height: auto;
    }
    
    .flag-tag,
    .box-icon {
        background: white !important;
        color: black !important;
        border: 1px solid #ccc !important;
    }
}