/* public/style.css */
:root {
    --primary-color: #ff3e3e; /* Subito-like red */
    --secondary-color: #f4f4f4;
    --text-color: #333;
    --border-color: #ddd;
}

body {
    font-family: 'Open Sans', sans-serif; /* Clean, modern font */
    background-color: var(--secondary-color);
    color: var(--text-color);
}

.navbar {
    background-color: #fff;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.navbar-brand {
    font-weight: bold;
    color: var(--primary-color) !important;
    font-size: 1.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: #e63535;
    border-color: #e63535;
}

.search-bar {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.ad-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 20px;
}

.ad-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ad-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
    background-color: #eee;
}

.ad-body {
    padding: 15px;
}

.ad-price {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.ad-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ad-meta {
    font-size: 0.9rem;
    color: #666;
}

.footer {
    background-color: #fff;
    padding: 20px 0;
    margin-top: 50px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: #888;
}

/* Star Rating Styles */
.star-rating {
    color: #ffd700; /* Gold */
    font-size: 1.2rem;
}
.star-rating.large {
    font-size: 2rem;
}
.star-rating .bi-star-fill, .star-rating .bi-star-half {
    color: #ffc107;
}
.star-rating .bi-star {
    color: #e4e5e9;
}
.review-card {
    border-left: 4px solid #0d6efd;
}
/* For review form */
.rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.rating-input input {
    display: none;
}
.rating-input label {
    font-size: 2rem;
    color: #e4e5e9;
    cursor: pointer;
    transition: color 0.2s;
}
.rating-input input:checked ~ label,
.rating-input label:hover,
.rating-input label:hover ~ label {
    color: #ffc107;
}

/* Improved Crystal Clear 5-Star Rating */
/* We keep the exact same HTML input structure (10 inputs) but use CSS to overlay them */
.rating-input {
    display: inline-block;
    position: relative;
    height: 2rem;
    line-height: 2rem;
    font-size: 2rem;
}
.rating-input input {
    display: none;
}
.rating-input label {
    cursor: pointer;
    /* Reset layout */
    float: right; 
    display: block;
    width: 1rem; /* Half width of font-size 2rem */
    height: 2rem;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    margin: 0;
    padding: 0;
    color: #e4e5e9;
    transition: color 0.1s;
}

/* The actual star icon inside */
.rating-input label::before {
    content: "\F586"; /* Bootstrap Icon bi-star-fill code */
    font-family: "bootstrap-icons";
    font-size: 2rem;
    display: block;
    width: 2rem; /* Full star width */
    height: 2rem;
    position: absolute;
    top: 0;
}

/* ODD items in DOM (Right-side halves visually, e.g. 5.0, 4.0) */
/* They need to show the RIGHT side of the star */
/* :nth-of-type(odd) selects the labels for X.0 inputs because inputs are hidden */
/* Actually, inputs are siblings. */
/* Layout: Input5, Label5, Input4.5, Label4.5... */
/* Float right reverses them visually: [Label0.5] [Label1.0] [Label1.5] ... */
/* So Label0.5 is Leftmost. Label0.5 is LAST in DOM. */
/* DOM Order: Label5(Rightmost visual?), Label4.5(Visual Left of 5?) */

/* WAIT. Flex-row-reverse was easier to conceptualize, but float: right is standard. */
/* Let's stick to flex-row-reverse which we had. */
.rating-input {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.rating-input label {
    width: 1rem; 
    overflow: hidden;
    position: relative;
}
.rating-input label::before {
    content: "\F586"; /* bi-star-fill */
    font-family: "bootstrap-icons";
    position: absolute;
    width: 2rem;
    top: 0;
    /* Default color */
    color: #e4e5e9;
}

/* X.0 Labels (First of pair in DOM) - Show RIGHT half of star */
/* DOM: [Input5][Label5] [Input4.5][Label4.5] */
/* Label5 is the Right visual half. */
/* Just shift the icon to the left by 1rem to show the right half */
.rating-input input:nth-of-type(odd) + label::before {
    left: -1rem; 
}

/* X.5 Labels (Second of pair in DOM) - Show LEFT half of star */
/* Label4.5 is Left visual half. Icon stays at left: 0 */
.rating-input input:nth-of-type(even) + label::before {
    left: 0;
}

/* Hover & Checked States - Color all following siblings (which are visually to the LEFT) */
.rating-input input:checked ~ label::before,
.rating-input label:hover ~ label::before,
.rating-input label:hover::before {
    color: #ffc107;
}

