@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&family=Satoshi:wght@300;400;500;600;700&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;

.gradient-bg {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}
.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 0 0 2px #8b5cf6;
}
.banner-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 0.5rem;
}

/* Modern contractor profile styles */
.service-card {
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.service-card:hover {
    transform: translateY(-2px);
}

.portfolio-item {
    border-radius: 1rem;
    overflow: hidden;
}

.review-card {
    border-radius: 1rem;
    border-left: 4px solid #3b82f6;
}

.nearby-card {
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.nearby-card:hover {
    transform: translateY(-4px);
}

/* Tab button modern styles */
.tab-button {
    flex: 1;
    padding: 1rem 1rem;
    background: white;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    color: #6b7280;
}

.tab-button:hover {
    background: #f8fafc;
    color: #374151;
}

.tab-button.active {
    background: white;
    color: #3b82f6;
    font-weight: 600;
}

.tab-button .absolute {
    background: #3b82f6;
    transition: transform 0.3s ease;
}

.tab-button.active .absolute {
    transform: scaleX(1);
}

/* Service button styles */
.service-button {
    transition: all 0.3s ease;
}

.service-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Review star colors */
.star-rating i {
    color: #fbbf24;
}

.star-rating i.text-gray-300 {
    color: #d1d5db;
}

/* Fix for contractor card text overflow */
.contractor-card h3, .company-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .contractor-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .contractor-card h3 {
        font-size: 1.125rem;
        line-height: 1.5;
        margin-bottom: 0.5rem;
    }
    
    .banner-image, #bannerImage {
        height: 150px;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    /* Navigation mobile */
    nav {
        padding: 0.5rem;
    }
    
    nav .hidden.sm\:flex {
        display: none !important;
    }
    
    .mobile-menu-button {
        display: block;
    }
    
    /* Hero section mobile */
    .gradient-bg {
        padding: 2rem 1rem;
    }
    
    .hero-section h1 {
        font-size: 2rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-section p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    /* Categories grid mobile */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem;
    }
    
    .category-card {
        padding: 1rem;
        font-size: 0.875rem;
    }
    
    /* Search form mobile */
    #zipCodeSearchForm, #searchForm {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }
    
    #zipCodeSearchInput, #contractorSearchInput {
        padding: 0.75rem;
        font-size: 1rem;
        width: 100%;
    }
    
    /* Grids mobile */
    
    /* Tabs mobile */
    .tab-button {
        flex: 1;
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
        text-align: center;
    }
    
    .tabs-container {
        flex-direction: column;
    }
    
    /* Reviews and portfolio mobile */
    #portfolio-grid, .reviews-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }
    
    .star-rating {
        font-size: 0.875rem;
    }
    
    .star-rating i {
        font-size: 1rem;
    }
    
    /* Footer mobile */
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem;
    }
    
    .footer-section {
        text-align: center;
    }
    
    /* Buttons and links mobile */
    a, button {
        min-height: 2.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Forms mobile */
    input[type="text"], input[type="email"], input[type="password"], textarea {
        font-size: 1rem;
        padding: 0.75rem;
        border-radius: 0.5rem;
    }
    
    /* Headings mobile */
    h1 { font-size: 2rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    
    /* Container padding */
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Profile picture positioning */
    .absolute.-bottom-16 {
        left: 1rem;
    }
    
    /* Emergency and view buttons mobile */
    .emergency-available, .view-profile-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .hero-section h1 {
        font-size: 1.75rem !important;
    }
    
    .contractor-card {
        padding: 0.75rem;
    }
    
    .tab-button {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
    
    .categories-grid {
        grid-template-columns: 1fr !important;
    }
    
    #zipCodeSearchForm input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* --- Modern Styles --- */
body {
    font-family: 'Satoshi', 'Plus Jakarta Sans', 'Inter', sans-serif;
    background-color: #f7f7f7;
    line-height: 1.7; /* Increased line height for better readability */
    letter-spacing: 0.03em; /* Slightly increased letter spacing for body text */
}

/* General padding and spacing adjustments for a more relaxed feel */
.max-w-7xl {
    padding-left: 1rem; /* Default padding for small screens */
    padding-right: 1rem; /* Default padding for small screens */
}

@media (min-width: 640px) { /* sm breakpoint */
    .max-w-7xl {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) { /* lg breakpoint */
    .max-w-7xl {
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Ensure tables are responsive */
table {
    width: 100%;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
}

section {
    padding-top: 5rem;
    padding-bottom: 5rem;
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.01em; /* Slightly more open letter spacing for headings */
}

/* Glassmorphism for search bar */
.glassmorphism {
    background-color: rgba(255, 255, 255, 0.7); /* Frosted background */
    backdrop-filter: blur(10px); /* Blur effect */
    border: 1px solid rgba(255, 255, 255, 0.3); /* Subtle border */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); /* Drop shadow */
}

/* --- Hero Section --- */
@keyframes kenburns {
    0% {
        transform: scale(1.05) translate(0, 0);
    }
    100% {
        transform: scale(1) translate(0, 0);
    }
}

.bg-hero-pattern {
    position: relative;
    overflow: hidden;
}

.bg-hero-pattern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://images.unsplash.com/photo-1512917774080-9991f1c4c750?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80');
    background-size: cover;
    background-position: center;
    animation: kenburns 20s ease-out forwards;
    z-index: -2;
}

.bg-hero-pattern::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.6) 0%, rgba(139, 92, 246, 0.6) 100%);
    z-index: -1;
    transition: backdrop-filter 0.3s ease; /* Add transition for blur effect */
}

.bg-hero-pattern.scrolled::before {
    filter: blur(5px); /* Apply blur on scroll */
}

.bg-hero-pattern.scrolled .text-white {
    opacity: 0.7; /* Slightly fade text on scroll */
    transition: opacity 0.3s ease;
}

/* --- Navigation --- */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

nav.scrolled {
    background-color: rgba(255, 255, 255, 0.95); /* White fade effect */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(5px); /* Frosted effect */
}

nav a {
    position: relative;
    transition: color 0.3s ease;
}

nav a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #4f46e5;
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

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

.testimonial-carousel {
    display: flex;
    transition: transform 0.5s ease-in-out;
}

.testimonial-slide {
    flex: 0 0 100%; /* Show 1 slide per page */
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    text-align: center;
    box-sizing: border-box; /* Include padding in the width calculation */
}

.testimonial-dots {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.testimonial-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: #d1d5db;
    margin: 0 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.testimonial-dot.active {
    background-color: #4f46e5;
}

/* --- Category Cards --- */
.category-card {
    position: relative; /* Needed for absolute positioning of overlay */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-align: center;
    overflow: hidden; /* Ensures background imagery stays within bounds */
}

.category-card:hover {
    transform: translateY(-8px) scale(1.02); /* Lift and slight scale on hover */
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15); /* More pronounced shadow */
}

.category-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0.1; /* Faded background imagery */
    transition: opacity 0.3s ease;
    z-index: 0;
}

.category-card:hover .category-card-bg {
    opacity: 0.15; /* Slightly less faded on hover */
}

/* Specific category background images */
.category-home-builders .category-card-bg {
    background-image: url('../img/blueprint-overlay.png');
}

.category-plumbers .category-card-bg {
    background-image: url('../img/pipe-illustration.png');
}

.category-electricians .category-card-bg {
    background-image: url('../img/bolt-illustration.png');
}

.category-painters .category-card-bg {
    background-image: url('../img/paint-roller-illustration.png');
}

.category-landscapers .category-card-bg {
    background-image: url('../img/greenery-texture.png');
}

.category-handymen .category-card-bg {
    background-image: url('../img/tools-illustration.png');
}

.category-card .icon-container,
.category-card span {
    position: relative; /* Ensures text and icon are above background */
    z-index: 1;
}

.category-card .icon-container {
    background-color: #f3f4f6;
    color: #4f46e5;
    border-radius: 50%;
    height: 4rem;
    width: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: background-color 0.3s ease;
}

.category-card:hover .icon-container {
    background-color: #e0e7ff;
}

/* --- Buttons --- */
button, .button {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

button:hover, .button:hover {
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.6); /* Subtle glow effect */
}

button::before, .button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 300%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.5s ease-out;
    transform: translate(-50%, -50%) scale(0);
    z-index: -1;
}

button:hover::before, .button:hover::before {
    transform: translate(-50%, -50%) scale(1);
}

button:hover, .button:hover {
    box-shadow: 0 0 15px rgba(79, 70, 229, 0.4); /* Subtle glow effect */
}

/* --- Contractor Cards --- */
.contractor-card {
    background-color: #ffffff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.6s ease, transform 0.6s ease; /* Added opacity and transform for fade-in */
    opacity: 0; /* Hidden by default */
    transform: translateY(20px); /* Start slightly below */
}

.contractor-card.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.contractor-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.contractor-card-image {
    width: 100%;
    height: 12rem;
    object-fit: cover;
}

.contractor-card-content {
    padding: 1.25rem;
}

.contractor-card-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contractor-card-services {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.contractor-card-rating {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #4b5563;
}

.contractor-card-rating .fa-star {
    color: #FFC107 !important;
    font-size: 1.2em;
}

.contractor-card-location {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Responsive adjustments for contractor cards and profiles */
@media (max-width: 768px) {
    .contractor-card {
        flex-direction: column;
        max-width: 300px; /* Adjust as needed for desired mobile width */
        margin-left: auto;
        margin-right: auto;
    }

    .contractor-card-image {
        height: 150px;
    }

    .absolute.-bottom-16 {
        position: static;
        transform: none;
        margin-top: -4rem;
        margin-bottom: 1rem;
    }

    .profile-avatar {
        width: 100px;
        height: 100px;
    }

    #contractor-profile .pt-20 {
        padding-top: 1rem;
    }

    #contractorName {
        font-size: 1.75rem !important;
    }

    .tabs-container {
        flex-direction: column;
    }

    .tab-button {
        text-align: center;
        border-bottom: 1px solid #e5e7eb;
    }

    .nearby-card {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .contractor-card-title {
        font-size: 1rem;
    }

    .contractor-card-services,
    .contractor-card-location {
        font-size: 0.75rem;
    }

    .profile-avatar {
        width: 80px;
        height: 80px;
        margin-top: -3rem;
    }

    #contractorName {
        font-size: 1.5rem !important;
    }

    .tab-button {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
}