/* Custom CSS for Sheltos Real Estate Application */

:root {
    --primary-color: #dc2626;
    --secondary-color: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Global Image Auto-Resize Rules */
img {
    max-width: 100%;
    height: auto;
    object-fit: cover;
    display: block;
}

/* Responsive images for different containers */
.property-image img,
.gallery-image img,
.property-gallery img,
.property-thumb img,
.thumbnail img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
}

/* Hero and banner images */
.hero-image img,
.banner-image img,
.carousel-image img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* Logo and brand images */
.logo img,
.brand img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Profile and avatar images */
.profile-img img,
.avatar img,
.user-avatar img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 50%;
}

/* Grid and card images */
.property-card img,
.card-image img,
.grid-image img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

/* Modal and popup images */
.modal img,
.popup img,
.lightbox img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Responsive breakpoints for images */
@media (max-width: 768px) {
    .property-card img,
    .card-image img,
    .grid-image img {
        height: 200px;
    }
}

/* Agent Dashboard Images */
.agent-dashboard img,
.agent-panel img {
    max-width: 100%;
    height: auto;
}

.agent-property-thumb img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
}

.agent-profile img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 50%;
}

/* Agent Property Grid */
.agent-property-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

@media (max-width: 768px) {
    .agent-property-grid img {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .agent-property-grid img {
        height: 120px;
    }
}

/* Smooth transitions */
* {
    transition: all 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #b91c1c;
}

/* Hero section animations */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: gradient 15s ease infinite;
    background-size: 400% 400%;
}

/* Hero section with background image */
.hero-section-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

/* Section background with image - Admin controlled */
section.section-bg {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    width: 100%;
    background-attachment: fixed !important;
    isolation: isolate !important;
}

/* Override inline styles specifically for section background */
section.section-bg[style] {
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    isolation: isolate !important;
}

/* Responsive adjustments for section background */
@media (max-width: 768px) {
    .section-bg {
        background-size: cover !important;
        background-position: center !important;
        background-attachment: scroll;
        background-repeat: no-repeat !important;
    }
}

@media (max-width: 480px) {
    .section-bg {
        background-size: cover !important;
        background-position: center center !important;
        background-attachment: scroll;
        background-repeat: no-repeat !important;
    }
}

.section-bg > * {
    position: relative;
    z-index: 2;
}

/* Fix WhatsApp button transparency issue */
a[href*="wa.me"] {
    background-color: #22C55E !important;
    color: white !important;
    filter: none !important;
    mix-blend-mode: normal !important;
    background-blend-mode: normal !important;
    opacity: 1 !important;
}

a[href*="wa.me"]:hover {
    background-color: #16A34A !important;
}

/* Ensure WhatsApp icon is visible */
a[href*="wa.me"] i {
    color: white !important;
    filter: none !important;
}

.hero-section-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1;
}

.hero-section-bg .container {
    position: relative;
    z-index: 2;
}

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

/* Card hover effects */
.property-card {
    transform: translateY(0);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.property-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Button animations */
.btn-primary {
    background: var(--primary-color);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

/* Search bar styling */
.search-bar {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

/* Tab styling */
.tab-active {
    border-bottom: 3px solid var(--primary-color);
    color: var(--primary-color);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .property-grid {
        grid-template-columns: 1fr;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Image gallery styles */
.image-gallery {
    position: relative;
    overflow: hidden;
}

.image-gallery img {
    transition: transform 0.3s ease;
}

.image-gallery:hover img {
    transform: scale(1.05);
}

/* WhatsApp button animation */
.whatsapp-float {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #25d366;
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.4);
    z-index: 1000;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* Form validation styles */
.form-input.error {
    border-color: var(--primary-color);
}

.error-message {
    color: var(--primary-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success message */
.success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

/* Property type icons */
.property-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0 auto 1rem;
}

/* Price tag styling */
.price-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: bold;
    display: inline-block;
}

/* Featured badge */
.featured-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
}

/* Luxury badge */
.luxury-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

/* Premium badge */
.premium-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

/* Multiple badges container */
.property-badges {
    position: absolute;
    top: 1rem;
    left: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 10;
}

.property-badges .featured-badge,
.property-badges .luxury-badge,
.property-badges .premium-badge {
    position: static;
    top: auto;
    left: auto;
}

/* Breadcrumb styling */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.breadcrumb a {
    color: #6b7280;
    text-decoration: none;
}

.breadcrumb a:hover {
    color: var(--primary-color);
}

/* Sticky header */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

/* Mobile menu */
.mobile-menu {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.active {
    transform: translateX(0);
}

/* Filter sidebar */
.filter-sidebar {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    background: white;
    border-radius: 0.25rem;
    cursor: pointer;
}

.pagination button:hover {
    background: var(--primary-color);
    color: white;
}

.pagination button.active {
    background: var(--primary-color);
    color: white;
}

/* Map container */
.map-container {
    height: 400px;
    border-radius: 0.5rem;
    overflow: hidden;
}

/* Contact form */
.contact-form {
    background: white;
    border-radius: 0.5rem;
    padding: 2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Testimonial carousel */
.testimonial-carousel {
    position: relative;
    overflow: hidden;
}

.testimonial-item {
    text-align: center;
    padding: 2rem;
}

.testimonial-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
}

/* Stats counter */
.stats-counter {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: #6b7280;
    font-size: 1rem;
}

/* Newsletter subscription */
.newsletter {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 3rem 0;
    text-align: center;
}

.newsletter-form {
    display: flex;
    gap: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.newsletter-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 0.5rem;
}

/* Footer links */
.footer-link {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: white;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles */
.focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Admin table property column spacing fix */
table tbody td:first-child .text-sm.font-medium.text-gray-900 {
    margin-bottom: 0.25rem !important;
    line-height: 1.3;
}

table tbody td:first-child .text-sm.text-gray-500 {
    margin-top: 0.25rem !important;
    margin-bottom: 0 !important;
    line-height: 1.3;
    display: block;
    clear: both;
}

/* Admin table details spacing fix */
table tbody td .text-sm.text-gray-900 {
    margin-bottom: 0.25rem !important;
    line-height: 1.3;
}

table tbody td .text-sm.text-gray-500 {
    margin-bottom: 0.25rem !important;
    line-height: 1.3;
    display: block;
    clear: both;
}

/* Property card details spacing fix */
.property-card .text-sm.text-gray-600.mb-3 {
    margin-bottom: 1rem !important;
    line-height: 1.4;
}

.property-card .flex.items-center.text-sm.text-gray-600.mb-4 {
    margin-top: 0.5rem !important;
    margin-bottom: 1rem !important;
    line-height: 1.4;
}

/* Property card spacing fix */
.property-card .image-container {
    position: relative;
    width: 100%;
    height: 260px !important; /* Override h-48 class */
    overflow: hidden;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.property-card .image-container img {
    height: 240px !important; /* Override h-48 and object-cover height */
    margin-bottom: 0 !important;
    display: block !important;
    object-fit: cover;
    border: none !important;
}

.property-card .image-container + div {
    padding-top: 0 !important; /* Completely remove top padding */
    margin-top: 0 !important;
    padding-bottom: 0 !important;
    border-top: none !important;
}

/* Remove margin from price div */
.property-card .image-container + div > div:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
    margin-bottom: 0.25rem !important;
}

/* Add margin below buttons */
.property-card .image-container + div > div:last-child {
    margin-bottom: 15px !important; /* Gap below view and whatsapp buttons */
}

.property-card .image-container + div > div:nth-child(2) {
    margin-bottom: 0 !important; /* No gap for price div */
}

/* Override all Tailwind classes */
.property-card .image-container + div[class*="p-"] {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Mobile specific adjustments for property card spacing */
@media (max-width: 768px) {
    .property-card .image-container {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
    }
    
    .property-card .image-container img {
        margin-bottom: 0 !important;
        border: none !important;
        vertical-align: bottom !important;
    }
    
    .property-card .image-container + div {
        padding-top: 0 !important;
        margin-top: 0 !important;
        padding-bottom: 0 !important;
        border-top: none !important;
    }
    
    .property-card .image-container + div > div:first-child {
        margin-top: 0 !important;
        padding-top: 0 !important;
        margin-bottom: 0.25rem !important;
    }
    
    .property-card .image-container + div[class*="p-"] {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    
    .property-card .image-container + div[class*="mt-"] {
        margin-top: 0 !important;
    }
    
    .property-card .image-container + div[class*="pt-"] {
        padding-top: 0 !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .dark-mode {
        background: #1f2937;
        color: white;
    }
}

/* Mobile responsive table fixes */
@media (max-width: 768px) {
    /* Reduce container padding for better screen utilization */
    .container.mx-auto.px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Property detail tables mobile fixes */
    .overflow-x-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.75rem;
        padding: 0 0.75rem;
    }
    
    /* Make tables stack on mobile */
    table.w-full {
        border-collapse: collapse;
        border: 1px solid #e5e7eb;
        border-radius: 0.375rem;
        overflow: hidden;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        width: 100% !important;
        min-width: 300px !important;
    }
    
    /* Table headers on mobile */
    table th {
        background: #f9fafb;
        font-weight: 600;
        font-size: 0.75rem;
        padding: 0.5rem;
        border-bottom: 1px solid #e5e7eb;
        color: #374151;
    }
    
    /* Table cells on mobile */
    table td {
        padding: 0.5rem;
        border-bottom: 1px solid #e5e7eb;
        font-size: 0.75rem;
        line-height: 1.3;
    }
    
    /* Remove double borders */
    table td:last-child,
    table th:last-child {
        border-right: none;
    }
    
    /* First column styling */
    table td:first-child {
        font-weight: 600;
        color: #dc2626;
        background: #fef2f2;
        min-width: 100px;
        width: 35%;
    }
    
    /* Second column styling */
    table td:last-child {
        color: #374151;
        word-break: break-word;
        width: 65%;
    }
    
    /* Remove borders from last row */
    table tr:last-child td {
        border-bottom: none;
    }
    
    /* Table container mobile fixes */
    .bg-white.rounded-xl.shadow-lg {
        padding: 0.5rem;
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }
    
    /* Section headings mobile */
    .text-xl.font-semibold.text-gray-700 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
        padding: 0 0.5rem;
    }
    
    /* Reduce spacing between sections */
    .mb-8 {
        margin-bottom: 1rem !important;
    }
    
    /* Main content padding */
    main.container.mx-auto.px-4.py-8 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* Extra small mobile fixes */
@media (max-width: 480px) {
    /* Even smaller padding for very small screens */
    .container.mx-auto.px-4 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    table td,
    table th {
        padding: 0.375rem;
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    /* First column minimum width */
    table td:first-child {
        min-width: 80px;
        width: 30%;
    }
    
    /* Second column width */
    table td:last-child {
        width: 70%;
    }
    
    /* Container padding */
    .bg-white.rounded-xl.shadow-lg {
        padding: 0.375rem;
    }
    
    /* Section headings */
    .text-xl.font-semibold.text-gray-700 {
        font-size: 0.875rem;
        margin: 0.75rem 0.25rem;
    }
    
    /* Reduce margins further */
    .mb-8 {
        margin-bottom: 0.75rem !important;
    }
    
    /* Main content padding */
    main.container.mx-auto.px-4.py-8 {
        padding-top: 0.75rem !important;
        padding-bottom: 0.75rem !important;
    }
}

/* Landscape mobile fixes */
@media (max-width: 768px) and (orientation: landscape) {
    table td,
    table th {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Card-based layout for very small screens */
@media (max-width: 425px) {
    /* Ultra-compact container padding */
    .container.mx-auto.px-4 {
        padding-left: 0.375rem !important;
        padding-right: 0.375rem !important;
    }
    
    /* Hide table headers on very small screens */
    .overflow-x-auto table thead {
        display: none;
    }
    
    /* Convert table rows to cards */
    .overflow-x-auto table,
    .overflow-x-auto table tbody {
        display: block;
        width: 100%;
    }
    
    .overflow-x-auto table tr {
        display: block;
        margin-bottom: 0.5rem;
        background: white;
        border: 1px solid #e5e7eb;
        border-radius: 0.375rem;
        padding: 0.5rem;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }
    
    .overflow-x-auto table td {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.25rem 0;
        border-bottom: none;
        font-size: 0.7rem;
        line-height: 1.2;
    }
    
    .overflow-x-auto table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #dc2626;
        min-width: 70px;
        margin-right: 0.5rem;
        flex-shrink: 0;
        font-size: 0.65rem;
    }
    
    /* Remove first column styling since we're using data-labels */
    .overflow-x-auto table td:first-child {
        background: transparent;
        color: inherit;
        min-width: auto;
        width: auto;
    }
    
    /* Container adjustments */
    .bg-white.rounded-xl.shadow-lg {
        padding: 0.25rem;
        margin-bottom: 0.5rem;
    }
    
    /* Section headings */
    .text-xl.font-semibold.text-gray-700 {
        font-size: 0.8rem;
        margin: 0.5rem 0.125rem;
    }
    
    /* Ultra-compact margins */
    .mb-8 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Main content padding */
    main.container.mx-auto.px-4.py-8 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
    
    /* Mobile card layout overrides */
    .mobile-card-item {
        padding: 0.5rem;
        margin-bottom: 0.375rem;
        border-radius: 0.375rem;
    }
    
    .mobile-card-item .label {
        font-size: 0.65rem;
        margin-bottom: 0.125rem;
    }
    
    .mobile-card-item .value {
        font-size: 0.7rem;
        line-height: 1.2;
    }
}

/* Ultra-compact styles for very small screens */
@media (max-width: 380px) {
    /* Minimal container padding */
    .container.mx-auto.px-4 {
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    
    /* Ultra-compact table cells */
    table td,
    table th {
        padding: 0.25rem !important;
        font-size: 0.65rem !important;
        line-height: 1.1 !important;
    }
    
    /* Minimal margins */
    .mb-8 {
        margin-bottom: 0.375rem !important;
    }
    
    /* Compact containers */
    .bg-white.rounded-xl.shadow-lg {
        padding: 0.25rem !important;
        margin-bottom: 0.375rem !important;
    }
    
    /* Small headings */
    .text-xl.font-semibold.text-gray-700 {
        font-size: 0.75rem !important;
        margin: 0.375rem 0.125rem !important;
    }
    
    /* Ultra-compact main content */
    main.container.mx-auto.px-4.py-8 {
        padding-top: 0.375rem !important;
        padding-bottom: 0.375rem !important;
    }
    
    /* Card layout adjustments */
    .mobile-card-item {
        padding: 0.375rem !important;
        margin-bottom: 0.25rem !important;
    }
    
    .mobile-card-item .label {
        font-size: 0.6rem !important;
        margin-bottom: 0.0625rem !important;
    }
    
    .mobile-card-item .value {
        font-size: 0.65rem !important;
        line-height: 1.1 !important;
    }
}
