/**
 * TP-Asset Development Website
 * Responsive Stylesheet
 */

/* =====================================================
   LARGE DEVICES (Desktops, less than 1200px)
   ===================================================== */
@media (max-width: 1199.98px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-section {
        min-height: 550px;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

/* =====================================================
   MEDIUM DEVICES (Tablets, less than 992px)
   ===================================================== */
@media (max-width: 991.98px) {
    /* Top Bar */
    .top-bar {
        font-size: 13px;
    }
    
    .top-bar-left .list-inline-item:not(:last-child) {
        margin-right: 10px;
        padding-right: 10px;
    }
    
    /* Navigation */
    .navbar-toggler {
        border: none;
        padding: 10px;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-collapse {
        position: fixed;
        top: 0;
        right: -300px;
        width: 300px;
        height: 100vh;
        background: var(--color-white);
        box-shadow: var(--shadow-xl);
        padding: 20px;
        transition: right 0.3s ease;
        z-index: var(--z-modal);
        overflow-y: auto;
    }
    
    .navbar-collapse.show {
        right: 0;
    }
    
    .navbar-nav {
        padding-top: 60px;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 0;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .navbar-nav .nav-link.active::after {
        display: none;
    }
    
    .navbar-nav .dropdown-menu {
        box-shadow: none;
        padding-left: 20px;
        border-left: 2px solid var(--color-secondary);
        background: var(--color-gray-100);
    }
    
    .nav-cta {
        margin-top: 20px;
    }
    
    .nav-cta .btn {
        width: 100%;
    }
    
    /* Close button for mobile menu */
    .mobile-menu-close {
        position: absolute;
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--color-gray-100);
        border: none;
        font-size: 1.2rem;
        cursor: pointer;
    }
    
    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-modal) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }
    
    .mobile-menu-overlay.show {
        opacity: 1;
        visibility: visible;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 500px;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-search {
        padding: 20px;
    }
    
    /* Sections */
    .section {
        padding: 60px 0;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    /* Stats */
    .stat-number {
        font-size: 2rem;
    }
    
    /* Footer */
    .footer-main {
        padding: 50px 0;
    }
    
    .footer-widget {
        margin-bottom: 40px;
    }
}

/* =====================================================
   SMALL DEVICES (Landscape phones, less than 768px)
   ===================================================== */
@media (max-width: 767.98px) {
    /* Top Bar */
    .top-bar {
        padding: 5px 0;
        font-size: 12px;
    }
    
    .top-bar-left .list-inline-item {
        display: none;
    }
    
    .top-bar-left .list-inline-item:first-child {
        display: inline-block;
    }
    
    /* Hero Section */
    .hero-section {
        min-height: 450px;
        text-align: center;
    }
    
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-buttons {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .hero-buttons .btn {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Slight scrim behind hero copy on phones (bright banner edges) */
    .hero-content {
        padding: 1rem 1.125rem;
        border-radius: var(--radius-lg);
        background: rgba(6, 20, 37, 0.42);
        -webkit-backdrop-filter: blur(6px);
        backdrop-filter: blur(6px);
    }
    
    .hero-search {
        margin-top: 30px;
    }
    
    .hero-search .nav-tabs .nav-link {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    /* Property Cards */
    .property-card .card-actions {
        opacity: 1;
        transform: translateX(0);
    }
    
    .property-card .card-features {
        gap: 10px;
    }
    
    .property-card .feature-item {
        font-size: 0.85rem;
    }
    
    /* Sections */
    .section {
        padding: 50px 0;
    }
    
    .section-header {
        margin-bottom: 30px;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Stats */
    .stats-section {
        padding: 40px 0;
    }
    
    .stat-item {
        margin-bottom: 25px;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 1.75rem;
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: 20px;
    }
    
    /* Footer */
    .footer-main {
        padding: 40px 0;
    }
    
    .footer-title {
        margin-top: 20px;
    }
    
    .footer-bottom {
        text-align: center;
    }
    
    .footer-bottom-links {
        margin-top: 10px;
    }
    
    .footer-bottom-links a {
        margin: 0 10px;
    }
    
    /* Floating Buttons */
    .floating-buttons {
        bottom: 80px;
        right: 15px;
    }
    
    .floating-btn {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 15px;
    }
    
    /* Buttons */
    .btn-lg {
        padding: 12px 25px;
        font-size: 1rem;
    }
    
    /* Modal */
    .modal-dialog {
        margin: 10px;
    }
}

/* =====================================================
   EXTRA SMALL DEVICES (Portrait phones, less than 576px)
   ===================================================== */
@media (max-width: 575.98px) {
    /* General */
    body {
        font-size: 14px;
    }
    
    /* Top Bar */
    .top-bar-right .list-inline-item:not(:last-child):not(:nth-last-child(2)) {
        display: none;
    }
    
    /* Logo */
    .logo-img {
        height: 40px;
    }
    
    #mainNav.scrolled .logo-img {
        height: 35px;
    }
    
    /* Hero */
    .hero-section {
        min-height: 400px;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-search {
        padding: 15px;
    }
    
    .hero-search .nav-tabs .nav-link {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    /* Property Card */
    .property-card .card-body {
        padding: 15px;
    }
    
    .property-card .card-title {
        font-size: 1rem;
    }
    
    .property-card .price {
        font-size: 1.1rem;
    }
    
    /* Section */
    .section {
        padding: 40px 0;
    }
    
    .section-title {
        font-size: 1.35rem;
    }
    
    /* Footer */
    .footer-main {
        padding: 30px 0;
    }
    
    .footer-newsletter .input-group {
        flex-direction: column;
    }
    
    .footer-newsletter .input-group .form-control {
        border-radius: var(--radius-md) !important;
        margin-bottom: 10px;
    }
    
    .footer-newsletter .input-group .btn {
        border-radius: var(--radius-md) !important;
        width: 100%;
    }
}

/* =====================================================
   PROPERTY LISTING PAGE - RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    .property-filters {
        position: fixed;
        top: 0;
        left: -320px;
        width: 320px;
        height: 100vh;
        background: var(--color-white);
        z-index: var(--z-modal);
        transition: left 0.3s ease;
        overflow-y: auto;
        padding: 20px;
    }
    
    .property-filters.show {
        left: 0;
    }
    
    .filter-toggle-btn {
        display: flex !important;
    }
}

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

/* =====================================================
   PROPERTY DETAIL PAGE - RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    .property-gallery-main {
        height: 300px;
    }
    
    .property-gallery-thumbs {
        display: none;
    }
    
    .property-sticky-cta {
        display: none;
    }
    
    .property-mobile-cta {
        display: block !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--color-white);
        padding: 15px;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
        z-index: var(--z-fixed);
    }
    
    .property-mobile-cta .price {
        font-size: 1.25rem;
        font-weight: 700;
        color: var(--color-secondary);
    }
}

@media (min-width: 992px) {
    .property-mobile-cta {
        display: none !important;
    }
}

/* =====================================================
   SEARCH PAGE - RESPONSIVE
   ===================================================== */
@media (max-width: 767.98px) {
    .search-results-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-view-toggle {
        display: none;
    }
    
    .search-sort {
        width: 100%;
    }
    
    .search-sort .form-select {
        width: 100%;
    }
}

/* =====================================================
   MEMBER PAGES - RESPONSIVE
   ===================================================== */
@media (max-width: 991.98px) {
    .member-sidebar {
        margin-bottom: 30px;
    }
    
    .member-dashboard-cards .card {
        margin-bottom: 15px;
    }
}

@media (max-width: 767.98px) {
    .auth-form-container {
        padding: 20px;
    }
    
    .social-login-btns .btn {
        padding: 10px 15px;
        font-size: 0.875rem;
    }
}

/* =====================================================
   CONTACT PAGE - RESPONSIVE
   ===================================================== */
@media (max-width: 767.98px) {
    .contact-map {
        height: 300px;
    }
    
    .contact-info-card {
        margin-bottom: 15px;
    }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    /* Hide non-essential elements */
    .top-bar,
    #mainNav,
    .footer,
    .floating-buttons,
    .back-to-top,
    .hero-search,
    .social-share,
    .property-actions,
    .related-properties {
        display: none !important;
    }
    
    /* Reset colors for print */
    body {
        color: #000;
        background: #fff;
    }
    
    .property-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    /* Show URLs */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
    
    a[href^="#"]::after,
    a[href^="javascript:"]::after {
        content: "";
    }
}

/* =====================================================
   REDUCED MOTION
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .property-card:hover {
        transform: none;
    }
    
    .property-card .card-image img {
        transform: none;
    }
    
    .floating-btn:hover {
        transform: none;
    }
}

/* =====================================================
   DARK MODE SUPPORT (Future Enhancement)
   ===================================================== */
@media (prefers-color-scheme: dark) {
    /* Reserved for future dark mode implementation */
    /* Users who prefer dark mode will see the standard light theme for now */
}

/* =====================================================
   HIGH CONTRAST MODE
   ===================================================== */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #000066;
        --color-secondary: #cc9900;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-control,
    .form-select {
        border-width: 2px;
    }
}

/* =====================================================
   LANDSCAPE ORIENTATION FIXES
   ===================================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 40px 0;
    }
    
    .navbar-collapse {
        max-height: 80vh;
        overflow-y: auto;
    }
}

/* =====================================================
   RETINA / HIGH DPI DISPLAYS
   ===================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* High-res image replacements if needed */
}

/* =====================================================
   TOUCH DEVICE OPTIMIZATIONS
   ===================================================== */
@media (hover: none) {
    /* Touch device specific styles */
    .property-card .card-actions {
        opacity: 1;
        transform: translateX(0);
    }

    .property-card .card-actions .action-btn {
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .btn:hover {
        transform: none;
    }
    
    .social-link:hover {
        transform: none;
    }
}

/* =====================================================
   SAFE AREA INSETS (Notch devices)
   ===================================================== */
@supports (padding-top: env(safe-area-inset-top)) {
    .top-bar {
        padding-top: calc(8px + env(safe-area-inset-top));
    }
    
    .property-mobile-cta {
        padding-bottom: calc(15px + env(safe-area-inset-bottom));
    }
    
    .footer-bottom {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
}
