/* ============================================
   ARJUN REALTY - Mobile Fixes & AI UX Enhancements
   Touch-optimized, Zero-lag, All-device responsive
   ============================================ */

/* === SCROLL PROGRESS ENHANCEMENT === */
.scroll-progress {
    height: 3px;
    background: var(--gradient-gold);
    box-shadow: 0 0 10px rgba(212, 168, 83, 0.5);
    transition: width 0.05s linear;
    will-change: width;
}

/* === ENHANCED BACK-TO-TOP === */
.back-to-top {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: all 0.3s var(--ease-out-expo), transform 0.2s ease;
}

.back-to-top:active {
    transform: scale(0.88) translateY(2px);
}

.back-to-top.visible {
    animation: backToTopEntry 0.4s var(--ease-out-expo) forwards;
}

@keyframes backToTopEntry {
    from { opacity: 0; transform: translateY(20px) scale(0.8); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* === TOUCH INTERACTION OPTIMIZATIONS === */
.btn-primary,
.btn-secondary,
.nav-link,
.nav-toggle,
.quick-action-item,
.gallery-filter-btn,
.gallery-zoom-btn,
.gallery-video-sound-btn,
.gallery-video-play-indicator,
.whatsapp-float,
.hero-unmute-btn,
.back-to-top,
.chatbot-trigger,
.chatbot-input button,
.faq-item summary,
.social-link,
.service-arrow,
.lightbox-close,
.lightbox-prev,
.lightbox-next,
.nav-search-trigger {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Smooth press feedback for all buttons on touch */
@media (hover: none) and (pointer: coarse) {
    .btn-primary:active {
        transform: scale(0.96) !important;
        transition: transform 0.1s ease !important;
    }
    .btn-secondary:active {
        transform: scale(0.96) !important;
        transition: transform 0.1s ease !important;
    }
    .quick-action-item:active {
        transform: scale(0.88);
        background: rgba(212, 168, 83, 0.08);
    }
    .whatsapp-float:active {
        transform: scale(0.94) !important;
        transition: transform 0.1s ease !important;
    }
    .hero-unmute-btn:active {
        transform: scale(0.94) !important;
        transition: transform 0.1s ease !important;
    }
    .gallery-filter-btn:active {
        transform: scale(0.94);
        transition: transform 0.1s ease;
    }
    .faq-item summary:active {
        opacity: 0.7;
    }
    .service-item-luxury:active {
        background: rgba(212, 168, 83, 0.02);
    }
    .chatbot-trigger:active {
        transform: scale(0.9) !important;
    }
    .social-link:active {
        transform: scale(0.9) !important;
    }
    .nav-link:active {
        opacity: 0.7;
    }
    .feature-card-luxury:active,
    .project-card-compact:active,
    .award-card:active,
    .innovation-card:active,
    .media-card:active,
    .testimonial-card:active {
        transform: scale(0.98) !important;
        transition: transform 0.1s ease !important;
    }
}

/* === SECTION REVEAL ANIMATIONS === */
.section-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.section-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* === AI SMART SEARCH OVERLAY === */
.ai-search-overlay {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.ai-search-overlay.active {
    display: flex;
}

.ai-search-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: searchFadeIn 0.2s ease;
}

.ai-search-modal {
    position: relative;
    width: 90%;
    max-width: 580px;
    max-height: 70vh;
    background: var(--dark-card, #0C1220);
    border: 1px solid rgba(212, 168, 83, 0.2);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(212, 168, 83, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: searchSlideIn 0.25s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
}

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

@keyframes searchSlideIn {
    from { opacity: 0; transform: translateY(-20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-search-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(212, 168, 83, 0.1);
}

.ai-search-icon {
    color: var(--primary, #D4A853);
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.ai-search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--light, #F0D98C);
    font-family: var(--font-body, 'Plus Jakarta Sans', sans-serif);
    font-size: 1rem;
    font-weight: 400;
    caret-color: var(--primary, #D4A853);
}

.ai-search-input::placeholder {
    color: rgba(200, 180, 140, 0.4);
}

.ai-search-kbd {
    font-family: var(--font-accent, 'Outfit', sans-serif);
    font-size: 0.65rem;
    color: rgba(200, 180, 140, 0.5);
    padding: 0.2rem 0.5rem;
    border: 1px solid rgba(212, 168, 83, 0.15);
    border-radius: 4px;
    background: rgba(212, 168, 83, 0.05);
    flex-shrink: 0;
}

.ai-search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem 0;
    -webkit-overflow-scrolling: touch;
}

.ai-search-section {
    padding: 0 1rem;
    margin-bottom: 1rem;
}

.ai-search-section:last-child {
    margin-bottom: 0;
}

.ai-search-section-title {
    display: block;
    font-family: var(--font-accent, 'Outfit', sans-serif);
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(200, 180, 140, 0.4);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.4rem 0.8rem;
    margin-bottom: 0.3rem;
}

.ai-search-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-search-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    color: var(--light-muted, #C9A96E);
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
}

.ai-search-item:hover,
.ai-search-item.ai-search-active {
    background: rgba(212, 168, 83, 0.08);
    color: var(--light, #F0D98C);
}

.ai-search-item-icon {
    font-size: 1.1rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.ai-search-item-text {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 400;
}

.ai-search-item-hint {
    font-family: var(--font-accent, 'Outfit', sans-serif);
    font-size: 0.65rem;
    color: rgba(200, 180, 140, 0.4);
    flex-shrink: 0;
}

.ai-search-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.7rem 1rem;
    border-top: 1px solid rgba(212, 168, 83, 0.1);
    font-family: var(--font-accent, 'Outfit', sans-serif);
    font-size: 0.65rem;
    color: rgba(200, 180, 140, 0.35);
}

/* Search trigger button in navbar */
.nav-search-trigger {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--dark-border, rgba(212, 168, 83, 0.1));
    border-radius: 50%;
    color: var(--light-muted, #C9A96E);
    cursor: pointer;
    transition: all 0.3s ease;
    background: none;
}

.nav-search-trigger:hover {
    border-color: var(--primary, #D4A853);
    color: var(--primary, #D4A853);
    box-shadow: 0 0 20px rgba(212, 168, 83, 0.1);
}

/* === MOBILE SEARCH RESPONSIVENESS === */
@media (max-width: 768px) {
    .ai-search-overlay {
        padding-top: 2vh;
        align-items: flex-start;
    }
    
    .ai-search-modal {
        width: 95%;
        max-height: 80vh;
        border-radius: 12px;
    }
    
    .ai-search-input {
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .ai-search-kbd {
        display: none;
    }
    
    .ai-search-footer {
        display: none;
    }
    
    .ai-search-item {
        padding: 0.8rem;
    }
    
    .ai-search-item-text {
        font-size: 0.9rem;
    }
    
    .nav-search-trigger {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    .ai-search-modal {
        width: 97%;
        max-height: 85vh;
    }
    
    .ai-search-header {
        padding: 0.9rem 1rem;
    }
}

/* === MOBILE PERFORMANCE: GPU ACCELERATION === */
@media (max-width: 768px) {
    .navbar,
    .floating-actions-container,
    .quick-actions-bar,
    .whatsapp-float,
    .hero-unmute-btn,
    .back-to-top,
    .chatbot-widget {
        will-change: transform;
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    .hero-grain {
        display: none;
    }
    
    .section {
        contain: layout style;
    }
    
    .footer-bottom {
        position: relative;
        z-index: 1;
    }
    
    .footer-credit .credit-company {
        padding: 0.5rem 1.2rem;
    }
    
    .footer-credit .credit-name {
        font-size: 0.8rem;
    }
    
    .footer-credit .credit-type {
        font-size: 0.6rem;
    }
}

/* === 480px SMALL MOBILE === */
@media (max-width: 480px) {
    .floating-actions-container {
        bottom: 4.5rem !important;
        right: 0.8rem;
        gap: 0.5rem;
    }
    
    .floating-actions-container .hero-unmute-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.65rem;
    }
    
    .floating-actions-container .unmute-text {
        font-size: 0.65rem;
        max-width: 65px;
    }
    
    .whatsapp-float {
        padding: 0.55rem 0.9rem;
    }
    
    .whatsapp-label {
        font-size: 0.65rem;
    }
    
    .whatsapp-icon-wrap svg {
        width: 24px;
        height: 24px;
    }
    
    .footer-bottom {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
    }
    
    .footer-credit {
        margin-top: 0.5rem;
    }
    
    .footer-credit .credit-company {
        padding: 0.4rem 1rem;
    }
}

/* === SMOOTH PAGE TRANSITIONS === */
.page-transition-active * {
    transition-duration: 0s !important;
    animation-duration: 0s !important;
}

/* === ENHANCED FAQ INTERACTION === */
.faq-item {
    transition: all 0.3s var(--ease-out-expo);
}

.faq-item[open] {
    padding-bottom: 2rem;
}

.faq-item summary {
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* === FORM TOUCH IMPROVEMENTS === */
@media (hover: none) {
    .form-group input:focus,
    .form-group textarea:focus,
    .form-group select:focus {
        font-size: 16px;
        transform: translateZ(0);
    }
    
    .contact-form-container {
        -webkit-overflow-scrolling: touch;
    }
}

/* === QUICK ACTIONS BAR POLISH === */
.quick-actions-bar {
    transition: transform 0.3s var(--ease-out-expo);
}

.quick-actions-bar.hidden {
    transform: translateY(100%);
}

/* === REDUCE MOTION PREFERENCE === */
@media (prefers-reduced-motion: reduce) {
    .scroll-progress {
        transition: none;
    }
    .section-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .back-to-top.visible {
        animation: none;
    }
    .ai-search-modal {
        animation: none;
    }
    .ai-search-backdrop {
        animation: none;
    }
}

/* === iOS NOTCH & SAFE AREA === */
@supports (padding: env(safe-area-inset-bottom)) {
    .quick-actions-bar {
        padding-bottom: calc(0.6rem + env(safe-area-inset-bottom, 0px));
    }
    
    @media (max-width: 768px) {
        .floating-actions-container {
            bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
        }
    }
}

/* === LANDSCAPE MOBILE FIX === */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: 100vh;
    }
    
    .quick-actions-bar {
        padding: 0.4rem 1rem;
    }
    
    .floating-actions-container {
        bottom: 4rem !important;
    }
    
    .section {
        padding: clamp(3rem, 8vh, 6rem) 0;
    }
    
    .ai-search-overlay {
        padding-top: 2vh;
    }
    
    .ai-search-modal {
        max-height: 90vh;
    }
}

/* === NIGHT MODE ADJUSTMENTS (set by JS) === */
.time-night .hero-video-overlay {
    background: 
        radial-gradient(ellipse at 30% 50%, rgba(5,5,8,0.5) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(5,5,8,0.7) 0%, transparent 50%),
        linear-gradient(180deg, rgba(5,5,8,0.4) 0%, rgba(5,5,8,0.8) 100%);
}

.time-night .gallery-image-wrap img {
    filter: brightness(0.9);
}

/* === REDUCE ANIMATIONS (slow network) === */
.reduce-animations * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
}

.reduce-animations .marquee-track {
    animation: none !important;
}

.reduce-animations .hero-particles {
    display: none;
}

/* === PRINT === */
@media print {
    .ai-search-overlay,
    .scroll-progress,
    .nav-search-trigger {
        display: none !important;
    }
}
