/**
 * Mobile Enhancements CSS
 * Gelişmiş mobil optimizasyonlar ve animasyonlar
 */

/* ===================================
   MOBILE MENU OVERLAY & ANIMATION
   =================================== */

/* Mobile Menu Overlay Backdrop */
#mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Container */
#mobile-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100vh;
    background: #FFD93D;
    z-index: 9999;
    overflow-y: auto;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
    padding: 0;
}

#mobile-menu.active {
    right: 0;
}

/* Mobile Menu Header */
.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.1);
}

.mobile-menu-header .logo {
    font-weight: bold;
    font-size: 1.25rem;
    color: #212121;
}

.mobile-menu-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #212121;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.mobile-menu-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.mobile-menu-close:active {
    background: rgba(0, 0, 0, 0.2);
}

/* Mobile Menu Items */
#mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#mobile-menu li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

#mobile-menu li a {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: #212121;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s;
    min-height: 48px;
}

#mobile-menu li a:active {
    background: rgba(0, 0, 0, 0.1);
}

#mobile-menu li a .material-icons {
    margin-right: 12px;
    font-size: 20px;
}

/* ===================================
   HEADER MOBILE OPTIMIZATIONS
   =================================== */

@media (max-width: 768px) {
    .header-container {
        padding: 0.75rem 1rem !important;
    }

    .logo {
        font-size: 1.1rem !important;
    }

    .logo .material-icons {
        font-size: 1.75rem !important;
    }

    #mobile-menu-btn {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===================================
   HERO SECTION MOBILE
   =================================== */

@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem !important;
        min-height: auto !important;
    }

    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem !important;
        margin-bottom: 1.5rem;
    }

    .hero-cta {
        width: 100%;
        padding: 1rem !important;
        font-size: 1rem !important;
    }
}

/* ===================================
   PROPERTY GRID MOBILE
   =================================== */

@media (max-width: 768px) {
    .properties-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .property-card {
        margin-bottom: 0;
    }

    .property-card-image {
        padding-bottom: 75% !important;
    }

    .property-card-content {
        padding: 0.75rem !important;
    }

    .property-card-title {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .property-card-location {
        font-size: 0.75rem !important;
        margin-bottom: 0.5rem;
    }

    .property-card-location .material-icons {
        font-size: 14px !important;
    }

    .property-card-specs {
        gap: 0.5rem !important;
        margin-bottom: 0.75rem;
    }

    .property-spec {
        font-size: 0.7rem !important;
    }

    .property-spec .material-icons {
        font-size: 14px !important;
    }

    .property-card-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .property-price {
        font-size: 0.85rem !important;
    }

    .property-price-label {
        font-size: 0.65rem !important;
    }

    .property-price {
        font-size: 2rem !important;
    }

    .property-card-cta {
        display: none !important;
    }

    .property-card-badge {
        font-size: 0.7rem !important;
        padding: 0.25rem 0.5rem !important;
    }

    .property-card-favorite {
        width: 32px !important;
        height: 32px !important;
    }

    .property-card-favorite .material-icons {
        font-size: 18px !important;
    }

    /* Back to Top butonunu mobilde gizle */
    #backToTop {
        display: none !important;
    }
}

/* Son Eklenen İlanlar Grid - Mobilde 2 sütun */
@media (max-width: 768px) {
    .grid.grid-cols-1.md\:grid-cols-2.lg\:grid-cols-6 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}

/* ===================================
   FILTER DRAWER (MOBILE)
   =================================== */

.filter-drawer {
    position: fixed;
    bottom: -100%;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    border-radius: 24px 24px 0 0;
    z-index: 10000;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 65, 199, 0.2);
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-top: 3px solid #3ACBE8;
}

.filter-drawer.active {
    bottom: 0;
}

.filter-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 2px solid rgba(58, 203, 232, 0.2);
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #3ACBE8 0%, #1E88E5 100%);
    z-index: 1;
}

.filter-drawer-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.filter-drawer-close {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    transition: all 0.3s ease;
    color: white;
}

.filter-drawer-close:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.filter-drawer-close .material-icons {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.filter-drawer-content {
    padding: 1.25rem;
}

/* Filter Drawer Overlay */
.filter-drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(58, 203, 232, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.filter-drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Filter Toggle Button (Mobile) */
.filter-toggle-btn {
    position: fixed;
    bottom: 80px; /* Bottom navigation yüksekliği + margin */
    right: 1rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3ACBE8 0%, #0041C7 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 65, 199, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99; /* Bottom nav altında kalır (bottom nav z-index: 1000) */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.filter-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 65, 199, 0.4);
}

.filter-toggle-btn:active {
    transform: scale(0.95) translateY(0);
}

.filter-toggle-btn .material-icons {
    font-size: 24px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Filter button badge (örn: aktif filtre sayısı) */
.filter-toggle-btn .filter-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

@media (min-width: 769px) {
    .filter-toggle-btn {
        display: none;
    }
}

/* ===================================
   MAP SECTION MOBILE
   =================================== */

@media (max-width: 768px) {
    #properties-map {
        height: 300px !important;
        border-radius: 12px;
    }

    .map-filters-sidebar {
        display: none !important;
    }

    .map-container {
        margin-bottom: 1rem;
    }
}

/* ===================================
   MODAL MOBILE OPTIMIZATIONS
   =================================== */

@media (max-width: 768px) {
    .modal {
        width: 95% !important;
        max-width: 95% !important;
        margin: 0 !important;
        border-radius: 16px 16px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        top: auto !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(100%) !important;
        max-height: 90vh;
        overflow-y: auto;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }

    .modal.active {
        transform: translateX(-50%) translateY(0) !important;
    }

    .modal-overlay {
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
    }
}

/* ===================================
   TOUCH OPTIMIZATIONS
   =================================== */

@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .hover-lift:hover {
        transform: none !important;
    }

    .card-hover:hover {
        transform: none !important;
    }

    /* Active states instead of hover */
    .property-card:active {
        transform: scale(0.98);
    }

    button:active,
    a:active {
        opacity: 0.8;
    }

    /* Better touch targets */
    a, button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
}

/* ===================================
   SWIPE GESTURES (Image Gallery)
   =================================== */

.swipe-container {
    position: relative;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.swipe-wrapper {
    display: flex;
    transition: transform 0.3s ease;
    will-change: transform;
}

.swipe-item {
    flex: 0 0 100%;
    width: 100%;
}

/* Swipe indicators */
.swipe-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 1rem;
}

.swipe-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    transition: background 0.3s, transform 0.3s;
}

.swipe-indicator.active {
    background: #FFD93D;
    transform: scale(1.2);
}

/* ===================================
   STICKY ELEMENTS (MOBILE)
   =================================== */

@media (max-width: 768px) {
    .sticky-contact-buttons {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 100;
        display: flex;
        gap: 0.75rem;
    }

    .sticky-contact-buttons button,
    .sticky-contact-buttons a {
        flex: 1;
        min-height: 48px;
        font-size: 1rem;
        font-weight: 600;
    }

    /* Add padding to body when sticky buttons are active */
    body.has-sticky-buttons {
        padding-bottom: 80px;
    }
}

/* ===================================
   BOTTOM NAVIGATION (MOBILE)
   =================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #3ACBE8 0%, #1E88E5 50%, #0041C7 100%);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 -4px 16px rgba(0, 65, 199, 0.3);
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0.5rem;
    min-width: 60px;
    text-decoration: none;
    color: white;
    font-size: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-tap-highlight-color: transparent;
    border: none;
    background: transparent;
    cursor: pointer;
    position: relative;
}

.bottom-nav-item span:not(.material-icons):not(.badge) {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bottom-nav-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.bottom-nav-item:active::after {
    width: 80px;
    height: 80px;
}

.bottom-nav-item:active {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.bottom-nav-item.active {
    color: white;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, transparent 100%);
}

.bottom-nav-item.active span:not(.material-icons):not(.badge) {
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.bottom-nav-item.active .material-icons {
    transform: scale(1.15);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.bottom-nav-item .material-icons {
    font-size: 24px;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.bottom-nav-item .badge {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    border: 2px solid white;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
}

/* ===================================
   PULL TO REFRESH (MOBILE)
   =================================== */

.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    transition: top 0.3s;
}

.pull-to-refresh.active {
    top: 20px;
}

.pull-to-refresh .material-icons {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===================================
   UTILITY CLASSES
   =================================== */

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 768px) {
    .show-mobile {
        display: block !important;
    }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
    .safe-area-top {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .safe-area-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .safe-area-left {
        padding-left: max(1rem, env(safe-area-inset-left));
    }

    .safe-area-right {
        padding-right: max(1rem, env(safe-area-inset-right));
    }
}

/* ===================================
   PROPERTY DETAIL PAGE - MOBILE REORDERING
   =================================== */
@media (max-width: 768px) {
    /* Sidebar sticky ayarını kaldır */
    .lg\:col-span-1 .sticky {
        position: relative !important;
        top: auto !important;
        display: flex;
        flex-direction: column;
    }

    /* Sıralama: Price Card (gizli) -> Details Card -> Calculator Card -> Share Card -> Description -> Features */
    .property-price-card {
        order: 1;
        display: none !important;
    }

    .property-details-card {
        order: 2;
    }

    .property-calculator-card {
        order: 3;
    }

    .property-share-card {
        order: 4;
    }

    .property-description {
        order: 5;
    }

    .property-features {
        order: 6;
    }

    /* İletişim Butonları - Mobilde yan yana */
    .contact-btn-mobile {
        font-size: 0.9rem !important;
    }

    /* WhatsApp buton yazısını mobilde kısalt */
    .contact-btn-text {
        display: none;
    }

    .contact-btn-text-short {
        display: inline !important;
    }

    /* WhatsApp ve Telefon butonları yan yana */
    .grid.grid-cols-1.md\:grid-cols-1 {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Mobilde location altındaki fiyat kartını göster */
    .mobile-price-display {
        display: block !important;
    }
}



