/* HomeHub Custom Styles - UX/UI Polish */

/* Base improvements */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Smooth scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Line clamp */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hero Swiper */
.heroSwiper .swiper-pagination-bullet {
    background: white;
    opacity: 0.5;
    width: 10px;
    height: 10px;
}
.heroSwiper .swiper-pagination-bullet-active {
    opacity: 1;
    background: #D4A017;
    width: 28px;
    border-radius: 5px;
}

/* Gallery Swiper */
.gallerySwiper .swiper-pagination-bullet-active {
    background: #3b82f6;
}

/* Property Detail - Image Grid */
.grid-gallery img {
    transition: transform 0.5s ease;
}
.grid-gallery > div:hover img {
    transform: scale(1.05);
}

/* Property Detail - Lightbox */
#galleryOverlay {
    backdrop-filter: blur(8px);
}
#galleryOverlay img {
    transition: opacity 0.3s ease;
}

/* Property Detail - Description fade */
#descriptionContent {
    transition: max-height 0.3s ease;
}

/* Property Detail - Spec table rows */
.grid .border-b:last-child {
    border-bottom: none;
}

/* Line clamp 1 */
.line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Leaflet map z-index fix */
.leaflet-pane { z-index: 1 !important; }
.leaflet-top, .leaflet-bottom { z-index: 2 !important; }
#propertyMap, #sellMap { z-index: 0; position: relative; }

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 12px !important;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15) !important;
    padding: 0 !important;
}
.leaflet-popup-content {
    margin: 12px 16px !important;
    font-family: 'Noto Sans Thai', 'Inter', sans-serif !important;
}
.leaflet-popup-close-button {
    color: #9ca3af !important;
    font-size: 20px !important;
    top: 4px !important;
    right: 8px !important;
}

/* Facility card selection */
.facility-card {
    position: relative;
    display: block;
}
.facility-card > div {
    min-height: 110px;
}
.facility-card:hover > input:not(:checked) + div {
    border-color: #93c5fd;
    background: #f8fafc;
}
.facility-card input:checked + div {
    transform: scale(1.03);
    background: var(--fc-bg, #f0fdf4);
    border-color: var(--fc-border, #86efac);
    box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}
.facility-card input:checked + div::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(34,197,94,0.4);
    animation: checkPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.facility-card input:not(:checked) + div::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: white;
    transition: all 0.2s;
}
@keyframes checkPop {
    0% { transform: scale(0) rotate(-45deg); }
    60% { transform: scale(1.3) rotate(0deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Print styles */
@media print {
    nav, footer, aside, .no-print, #galleryOverlay { display: none !important; }
    .shadow-sm, .shadow-xl { box-shadow: none !important; }
    .rounded-2xl { border-radius: 0 !important; }
    #propertyMap, #sellMap { display: none !important; }
}

/* Property card hover */
.property-card {
    transition: all 0.3s ease;
}
.property-card:hover {
    transform: translateY(-4px);
}

/* Nav link active */
.nav-link.active {
    color: #1e3a8a;
    background: #eff6ff;
}

/* Search tab active */
.search-tab-active {
    color: #1e3a8a;
    border-bottom: 3px solid #1e3a8a;
    background: #eff6ff;
}

/* Search suggestion item hover */
#searchSuggestions a:hover mark {
    background: #dbeafe;
}

/* Custom scrollbar for suggestions */
#searchSuggestions::-webkit-scrollbar {
    width: 4px;
}
#searchSuggestions::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

/* Filter chip active state */
.filter-chip-active {
    background: #eff6ff !important;
    border-color: #93c5fd !important;
    color: #1d4ed8 !important;
}

/* Dropdown animation */
[id$="DD"]:not(.hidden) {
    animation: dropIn 0.15s ease-out;
}
@keyframes dropIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mobile menu slide down */
.animate-slideDown {
    animation: slideDown 0.25s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Select dropdown styling */
select.appearance-none {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 24px;
}

/* Hero filter row - peer-checked highlight */
.peer:checked + span {
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* Responsive filter grid on mobile */
@media (max-width: 768px) {
    .grid-cols-1.md\:grid-cols-3 > div {
        margin-bottom: 2px;
    }
}

/* Favorite heart animation */
@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1); }
    75% { transform: scale(1.3); }
    100% { transform: scale(1); }
}
.heart-beat {
    animation: heartBeat 0.6s ease-in-out;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Form focus states - improved UX */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
}
input:hover, select:hover, textarea:hover {
    border-color: #93c5fd;
}
input::placeholder, textarea::placeholder {
    color: #9ca3af;
}

/* Button press feedback */
button:active, .btn-primary:active, a[role="button"]:active {
    transform: scale(0.98);
}
button:disabled, .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Card hover - softer lift */
.card-hover {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(0,0,0,0.12);
}

/* Nav link - smoother transition */
.nav-link {
    transition: all 0.2s ease;
}
.nav-link:hover {
    transform: translateY(-1px);
}

/* Stat card - clickable feedback */
.stat-card {
    transition: all 0.25s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(0,0,0,0.1);
}

/* Sidebar nav item - active indicator */
.sidebar-nav-item {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin-left: 2px;
}
.sidebar-nav-item:hover:not(.active) {
    background: #f8fafc !important;
}
.sidebar-nav-item.active {
    border-left-color: #2563eb;
}

/* Loading skeleton - smoother */
.skeleton {
    border-radius: 8px;
}

/* Toast - better visibility */
.toast {
    box-shadow: 0 10px 40px -10px rgba(0,0,0,0.3);
}

/* Back to top - improved */
#backToTop {
    transition: opacity 0.3s ease, transform 0.2s ease;
}
#backToTop:hover {
    transform: translateY(-2px);
}
#backToTop:active {
    transform: translateY(0);
}

/* Fade in animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.fade-in-up {
    animation: fadeInUp 0.5s ease-out forwards;
}

/* Category card hover */
.category-card:hover .category-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Price tag styling - Gold */
.price-tag {
    background: linear-gradient(135deg, #b8860b, #D4A017);
    clip-path: polygon(0 0, 100% 0, 92% 100%, 0 100%);
}

/* Gallery thumbnail active */
.gallery-thumb.active {
    border-color: #3b82f6;
    opacity: 1;
}
.gallery-thumb {
    opacity: 0.6;
    transition: all 0.2s;
}
.gallery-thumb:hover {
    opacity: 0.8;
}

/* Map placeholder */
.map-placeholder {
    background: linear-gradient(135deg, #e0f2fe, #bfdbfe);
}

/* Sticky sidebar */
@media (min-width: 1024px) {
    .sticky-sidebar {
        position: sticky;
        top: 100px;
    }
}

/* Custom checkbox */
.custom-checkbox:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}

/* Step indicator */
.step-line {
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #93c5fd);
}

/* Toast notification */
.toast {
    animation: slideIn 0.3s ease-out, fadeOut 0.3s 2.7s ease-in forwards;
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
