/* Define CSS Variables for easy color management */
:root {
    --primary-color: #007bff; /* Original Blue, used for accents */
    --secondary-color: #343a40; /* Dark Charcoal, used for header/text */
    --accent-color: #e63946; /* A more striking, modern accent red */
    --yelp-red: #da3d2c; /* The official Yelp brand red for links */
    --star-color: #ffc107; /* Bright Yellow for stars */
    --background-light: #f8f9fa; /* Very light gray */
    --background-body: #e9ecef; /* Light gray background */
    --text-color: #212529; /* Darker text for better contrast */
    --font-family-base: 'Poppins', sans-serif; /* Using the new imported font */
}

/* --- Global Styles --- */
body {
    font-family: var(--font-family-base);
    margin: 0;
    padding: 0;
    background-color: var(--background-body);
    color: var(--text-color);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    font-weight: 600;
    color: var(--secondary-color);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 15px;
}

.container h2 {
    font-size: 1.8em;
    margin-bottom: 25px;
    color: var(--accent-color);
    text-align: center;
}

/* --- Header & Footer --- */
header {
    background-color: var(--secondary-color);
    color: white;
    padding: 40px 0;
    text-align: center;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.logo-icon {
    font-size: 3em;
    color: var(--accent-color);
    display: block;
    margin-bottom: 10px;
}

.header-content h1 {
    font-size: 3em;
    margin-bottom: 5px;
    color: white;
    font-weight: 700;
}

.header-content p {
    font-size: 1.2em;
    opacity: 0.9;
    font-weight: 300;
}

footer {
    text-align: center;
    padding: 20px;
    background-color: var(--secondary-color);
    color: var(--background-light);
    font-size: 0.9em;
    margin-top: 40px;
}

/* --- Apartment Card (Main Listing) --- */
.apartment-card {
    background-color: white;
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 40px;
    /* Clean shadow for "lifted" effect */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.apartment-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.apartment-title {
    color: var(--secondary-color);
    border-bottom: 2px solid var(--background-body);
    padding-bottom: 15px;
    margin-top: 0;
    margin-bottom: 30px;
    font-size: 2em;
}

/* ------------------------------------------------------------------ */
/* ⭐️ NEW YELP ATTRIBUTION STYLING ⭐️ */
/* ------------------------------------------------------------------ */

/* 1. Style for the main listing title link */
.apartment-title a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 700;
}

.apartment-title a:hover,
.apartment-title a:active,
.apartment-title a:focus {
    color: var(--yelp-red);
    text-decoration: none; /* FIX: Prevents underline on hover/click */
}

/* 2. Style for the container wrapping the rating for compliance */
.apartment-rating a.yelp-link {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: opacity 0.2s;
}

.apartment-rating a.yelp-link:hover,
.apartment-rating a.yelp-link:active,
.apartment-rating a.yelp-link:focus {
    opacity: 0.85;
    text-decoration: none; /* FIX: Prevents underline on hover/click */
}

/* 3. Style for the explicit "Data powered by Yelp" text */
.yelp-branding {
    font-size: 0.85em;
    margin-top: -10px;
}

.yelp-branding a {
    color: #6c757d;
    text-decoration: none;
    font-weight: 500;
    /* We'll use the border-bottom for a subtle underline-like effect */
    border-bottom: 1px dashed #ced4da;
    padding-bottom: 1px;
    transition: all 0.2s ease; /* Added transition for smoother effect */
}

.yelp-branding a:hover,
.yelp-branding a:active,
.yelp-branding a:focus {
    color: var(--yelp-red);
    /* This border is the visual hover indicator, replacing the standard underline */
    border-bottom: 1px solid var(--yelp-red);
    text-decoration: none; /* 🔥 CRITICAL FIX: Ensures no standard browser underline appears */
}

/* 4. Style for image source attribution */
.yelp-image-attribution {
    text-align: right;
    font-size: 0.8em;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.8);
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    box-sizing: border-box;
}

.yelp-image-attribution a {
    color: var(--yelp-red);
    text-decoration: none;
    font-weight: 600;
}

.yelp-image-attribution a:hover,
.yelp-image-attribution a:active,
.yelp-image-attribution a:focus {
    text-decoration: none; /* FIX: Prevents underline on hover/click */
}
/* ------------------------------------------------------------------ */
/* ⭐️ END NEW YELP ATTRIBUTION STYLING ⭐️ */
/* ------------------------------------------------------------------ */


/* --- Apartment Rating Styles (Adjusted for new wrapping link) --- */
.apartment-rating {
    /* Removed redundant flex/gap styles, they are now on the a.yelp-link */
    display: block;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--background-body);
}

.stars {
    font-size: 1.4em;
    display: inline-block;
    white-space: nowrap; /* Prevent stars from wrapping */
}

.stars i {
    color: #ced4da; /* Default grey for empty stars */
}

.stars i.filled {
    color: var(--star-color); /* Bright yellow for filled stars */
}

.score {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--accent-color);
}

.review-count {
    font-size: 1em;
    color: #6c757d;
    font-weight: 400;
}

/* --- Flexbox Layout for Image and Text --- */
.apartment-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

@media (min-width: 769px) {
    .apartment-content-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }

    .image-gallery {
        flex-shrink: 0;
    }

    .text-content-wrapper {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
}


/* --- Image Gallery Styles (Added position relative for attribution) --- */
.image-gallery {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
    max-width: 600px;
    width: 100%;
    flex-shrink: 0;
    position: relative; /* CRITICAL: Allows absolute positioning of yelp-image-attribution */
}

.main-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease-in-out;
}

.apartment-card:hover .main-image {
    transform: scale(1.03);
}

/* --- Basic Info & Niche Snapshot (Text Content) --- */
.basic-info {
    margin-top: 0;
    margin-bottom: 30px;
    padding: 20px;
    background-color: var(--background-light);
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--secondary-color);
}

.basic-info p {
    margin-bottom: 10px;
}

.basic-info .location-text {
    font-weight: 400;
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 0;
}

.basic-info i {
    color: var(--primary-color);
    margin-right: 5px;
}

/* --- Niche Snapshot Section --- */
.niche-snapshot {
    padding-top: 10px;
    flex-grow: 1;
}

.niche-snapshot h3 {
    color: var(--accent-color);
    font-size: 1.6em;
    margin-bottom: 20px;
    border-bottom: 1px dashed #ced4da;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
}

.niche-snapshot h3 i {
    margin-right: 10px;
    color: var(--accent-color);
}

.niche-category {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
    border-bottom: 1px solid var(--background-body);
}

.niche-category:last-child {
    border-bottom: none;
}

.niche-category h4 {
    color: var(--secondary-color);
    font-size: 1.2em;
    margin: 0 0 5px 0;
    display: flex;
    align-items: center;
    font-weight: 600;
}

.icon {
    font-size: 1.3em;
    margin-right: 12px;
    color: var(--primary-color);
    min-width: 20px;
    text-align: center;
}

.niche-category p {
    margin: 0;
    padding-left: 32px;
    font-size: 1em;
    color: #495057;
    font-weight: 300;
}

/* --- View Details Button --- */
.view-details-btn {
    display: block;
    width: 100%;
    margin-top: 30px;
    padding: 15px;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.view-details-btn:hover {
    background-color: #c72b3a;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* --- Yelp Attribution Styles (REMOVED/UPDATED) --- */
/* The general footer attribution is removed as it's non-compliant. */
/* New, specific attribution styles are defined above. */
.yelp-attribution-footer { display: none; } /* Hide the old footer reference */


/* --- Responsiveness for smaller screens (Improved) --- */
@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 0 15px;
    }

    .apartment-card {
        padding: 25px;
        margin-left: 0;
        margin-right: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .header-content h1 {
        font-size: 2.2em;
    }

    .main-image {
        height: 250px;
    }

    .image-gallery {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .apartment-title {
        font-size: 1.5em;
    }

    /* Keep the rating link elements on one line for small screens */
    .apartment-rating a.yelp-link {
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Keep the rating score visible */
    .score {
        order: -1;
    }

    .yelp-image-attribution {
        /* Make the image attribution more subtle on small screens */
        padding: 5px;
        font-size: 0.75em;
    }
}


/* --- Pagination Styles (Enhanced) --- */
#paginator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 30px 0;
    margin-top: 20px;
    gap: 20px;
}

#paginator button {
    padding: 12px 25px;
    font-size: 1em;
    font-weight: 600;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#paginator button:hover:not(:disabled) {
    background-color: #0056b3;
    transform: translateY(-2px);
}

#paginator button:disabled {
    background-color: #ced4da;
    cursor: not-allowed;
    color: #6c757d;
    box-shadow: none;
}

#paginator span {
    font-size: 1.1em;
    color: var(--text-color);
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: var(--background-light);
}

#paginator button i {
    margin: 0 5px;
}
