/**
 * 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) {
    /* Navigation */
    .navbar-toggler {
        border: 1px solid rgba(12, 35, 64, 0.16);
        border-radius: 10px;
        padding: 9px 10px;
        background: #fff;
    }
    
    .navbar-toggler:focus {
        box-shadow: none;
    }
    
    .navbar-collapse {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw !important;
        max-width: 100vw !important;
        min-height: 100vh;
        height: 100vh;
        height: 100dvh;
        margin: 0 !important;
        background: #ffffff;
        box-shadow: none;
        padding: 82px 18px 22px;
        transform: translateX(100%);
        transition: transform 0.28s ease;
        z-index: 2001;
        overflow-y: auto;
        overflow-x: hidden;
        border-left: 0;
        opacity: 1;
        border-radius: 0;
        isolation: isolate;
    }
    
    .navbar-collapse.show {
        transform: translateX(0);
    }

    .navbar-collapse.mobile-nav-open {
        box-shadow: inset 0 1px 0 rgba(12, 35, 64, 0.06);
    }
    
    .navbar-nav {
        padding-top: 0;
        align-items: stretch !important;
        gap: 5px;
    }

    .navbar-nav .nav-item {
        width: 100%;
    }
    
    .navbar-nav .nav-link {
        padding: 12px 14px;
        border: 1px solid transparent;
        border-radius: 12px;
        text-align: left;
        font-size: 1.04rem;
        font-weight: 700;
        line-height: 1.25;
    }
    
    .navbar-nav .nav-link.active::after {
        display: none;
    }

    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link.active {
        background: #f3f7fd;
        border-color: #e2e9f4;
        color: var(--color-primary);
    }
    
    .navbar-nav .dropdown-menu {
        box-shadow: none;
        padding: 8px;
        border: 1px solid #e4eaf5;
        border-radius: 12px;
        background: #f8fbff;
    }

    .navbar-nav .dropdown-item {
        padding: 9px 12px;
        border-radius: 9px;
    }

    .mobile-nav-meta,
    .mobile-nav-footer {
        display: block;
    }

    .mobile-nav-meta {
        position: sticky;
        top: -2px;
        z-index: 3;
        background: #fff;
        margin: -8px 0 14px;
        padding: 10px 0 12px;
    }

    .mobile-nav-footer {
        position: sticky;
        bottom: -1px;
        z-index: 3;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.35) 0%, #ffffff 28%);
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        margin-bottom: -10px;
    }

    .nav-search,
    .nav-compare {
        display: none !important;
    }
    
    .nav-cta {
        margin-top: 20px;
    }
    
    .nav-cta .btn {
        width: 100%;
    }

    .logo-img {
        height: 48px;
        max-width: 220px;
    }

    #mainNav.scrolled .logo-img {
        height: 42px;
    }
    
    /* Close button for mobile menu */
    .mobile-menu-close {
        position: absolute;
        top: 18px;
        right: 16px;
        width: 42px;
        height: 42px;
        border-radius: 50%;
        background: #f2f5fa;
        border: 1px solid #dfe6f2;
        color: #122944;
        font-size: 1.15rem;
        cursor: pointer;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-close:hover {
        background: #eaf0f8;
    }
    
    /* Mobile Menu Overlay */
    .mobile-menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(3, 12, 26, 0.5);
        z-index: 2000;
        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: 28px 0 20px;
    }
    
    .footer-widget {
        margin-bottom: 8px;
    }

    .footer-contact-layout {
        grid-template-columns: 1fr;
    }

    .footer-contact-compact {
        columns: 1;
    }
}

/* =====================================================
   SMALL DEVICES (Landscape phones, less than 768px)
   ===================================================== */
@media (max-width: 767.98px) {
    .top-bar-mobile-inner {
        gap: 8px;
    }

    .mobile-contact-link {
        font-size: 11.5px;
        padding: 4px 8px;
    }
    
    /* 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: 24px 0 18px;
    }
    
    .footer-clean-shell {
        padding: 18px 16px 14px;
    }

    .footer-title {
        margin-top: 0;
    }
    
    .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) {
    .navbar-collapse {
        padding: 76px 14px 18px;
    }

    .navbar-nav {
        gap: 6px;
    }

    .navbar-nav .nav-link {
        font-size: 1rem;
        padding: 12px 13px;
    }

    .navbar-nav .dropdown-menu {
        padding: 6px;
    }

    .navbar-nav .dropdown-item {
        font-size: 0.94rem;
        padding: 8px 10px;
    }

    .mobile-menu-close {
        top: 14px;
        right: 12px;
        width: 40px;
        height: 40px;
    }

    .mobile-nav-title {
        font-size: 0.88rem;
    }

    .mobile-nav-subtitle {
        font-size: 0.64rem;
    }

    .mobile-nav-chip {
        font-size: 0.76rem;
        padding: 6px 9px;
    }

    /* General */
    body {
        font-size: 14px;
    }
    
    /* Logo */
    .logo-img {
        height: 42px;
    }
    
    #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: 20px 0 14px;
    }

    .footer-company-th {
        font-size: 0.95rem;
    }

    .footer-company-en {
        font-size: 0.74rem;
    }

    .footer-about {
        font-size: 0.9rem;
    }
}

/* =====================================================
   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));
    }
}
