/* General */
main {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    margin: 2rem 1rem 0 1rem;
    padding: 0;
    font-family: 'Montserrat', sans-serif;
}


/* Tri style */
.tri-form {
    display: flex;
    gap: 20px;
}

.tri-form select {
    width: 140px;
}

.sort {
    padding: 0.3rem 0.5rem;
    font-family: 'Montserrat', sans-serif;
    border-radius: 5px;
    appearance: none;
    background-color: #ECE9D8;
    background-image: url("https://upload.wikimedia.org/wikipedia/commons/9/9d/Arrow-down.svg");
    background-repeat: no-repeat;
    background-position: right 5px center;
    background-size: 15px;
}

.right-container {
    display: flex;
    justify-content: space-between;
}

.view_buttons {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    color: #ECE9D8;
}

.view_buttons ul {
    display: flex;
    flex-direction: row;
    list-style-type: none;
    gap: 20px;
    padding: 0;
}

.view_buttons ul li {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.view_buttons .active {
    background-color: rgba(217, 217, 217, 0.28);
}


/* Filter style */
.filter-container {
    display: flex;
    flex-direction: column;
    gap: 50px;
    border: 5px solid #ECE9D8;
    border-radius: 10px;
    width: 350px;
    height: fit-content;
    padding: 2rem;
    overflow: hidden;
}

.filter-title {
    display: flex;
    justify-content: center;
    align-self: center;
    color: #ECE9D8;
    gap: 5px;
    text-transform: uppercase;
    font-family: 'Krona One';
    font-size: 0.9rem;
}

.filter-title h1 {
    margin: 0;
    font-size: 1.3rem;
}

.input-container {
    width: 100%;
    border-radius: 15px;
    border: 2px solid #ECE9D8;
}

.input-details {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 20px;
    padding: 0 1rem;
    overflow: hidden;
    max-height: 0;
    transition: all 0.5s ease;
}

.input-details-expanded {
    margin: 10px 0 30px 0;
}

.filter-form input[type="number"],
.filter-form select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ECE9D8;
    border-radius: 5px;
}

.toggle-input {
    font-size: 1.1rem;
    height: 100%;
    padding: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
}

.input-details-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.filter-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    gap: 25px;
    width: 100%;
}

.filter-form input:focus .input-details {
    height: 50px;
}

.error-message {
    color: red;
}

.filter-form span,
.filter-form label {
    display: flex;
    align-items: center;
    gap: 3px;
}

.submit-filter {
    margin: 1rem auto 0 auto;
    background-color: #ECE9D8;
    border-radius: 0.5rem;
    cursor: pointer;
    color: #1E1E1E;
    border: none;
    padding: 1em 2em;
    font-family: 'Krona One', sans-serif;
    font-size: 1rem;
    transition: 0.35s ease-in-out;
}

.submit-filter:hover {
    box-shadow: -5px -5px 0px #1E1E1E;
    transform: translate(3px, 3px);
}

.container {
    margin: 0 auto 0 auto;
    width: 70%;
}

/* Vue en liste */
.list-view {
    font-family: 'Krona One', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 60px 0 60px auto;
    max-width: 100%;
}

.list-view .product {
    display: flex;
    flex: row;
    margin: 0;
    height: 250px;
    width: 100%;
    border-radius: 15px;
    overflow: hidden;
}

.list-view .product .product__image {
    margin: 0;
    padding: 0;
    flex: 4;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.list-view .product .product__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-view .product .product__details {
    width: 100%;
    height: 100%;
    flex: 6;
    padding: 1rem 0 2.5rem 1rem;
    position: relative;
    background-color: #ECE9D8;
    color: black;
}

.list-view .product__description p {
    max-height: 80px;
    width: 90%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    line-height: 20px;
    height: 80px;
    text-overflow: ellipsis;
    font-family: 'Montserrat', sans-serif;
    margin-top: 30px;
}

.list-view .product__specs {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    width: fit-content;
    gap: 15px;
    position: absolute;
    bottom: 25px;
}

.list-view .product .product__power,
.list-view .product .product__seats,
.list-view .product .product__fuel {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-size: 1rem;
}

.list-view .product .product__power i,
.list-view .product .product__seats i,
.list-view .product .product__fuel i {
    font-size: 1.5rem;
}

.list-view .product .product__power p,
.list-view .product .product__seats p,
.list-view .product .product__fuel p {
    margin: 0.5rem 0;
}

.list-view .product .product__price {
    font-weight: bold;
    position: absolute;
    top: 0;
    right: 0;
    margin: 16px;
}

.list-view .product .product__name__price {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.list-view .product .product__name a {
    color: black;
    text-decoration: none;
    font-size: 1.2rem;
}

.list-view .product .product__name:hover {
    text-decoration: underline;
}

.list-view .product__price__link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: fit-content;
    gap: 10px;
}

.list-view .product__price__link a {
    color: #29373a;
    border: 2px solid #29373a;
    border-radius: 0.5rem;
    padding: 3px 10px;
    transition: 0.2s ease-in-out;
    font-weight: 600;
    text-decoration: none;
    font-family: 'Athiti', sans-serif;
    font-size: 1.2em;
    position: absolute;
    bottom: 25px;
    right: 16px;
}


/* Vue en grille */
.grid-view {
    display: grid;
    grid-auto-columns: max-content;
    grid-auto-rows: minmax(100px, auto);
    grid-gap: 25px;
    grid-template-columns: repeat(3, 1fr);
    margin: 60px 0 60px auto;
    width: 100%;
    font-family: 'Montserrat', sans-serif;
}

.grid-view .product__details {
    background-color: #ECE9D8;
    color: #29373a;
    padding: 1rem;
    display: flex;
    font-family: 'Krona One', sans-serif;
    flex-direction: column;
    gap: 10px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
}

.grid-view .product__description {
    display: none;
}

.grid-view .product__power,
.grid-view .product__seats,
.grid-view .product__fuel {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.grid-view .product__power i,
.grid-view .product__seats i,
.grid-view .product__fuel i {
    font-size: 1.5rem;
}

.grid-view .product__name a {
    color: #29373a;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
}

.grid-view .product__name {
    margin-bottom: 10px;
}

.grid-view .product__name:hover {
    text-decoration: underline;
}

.grid-view .product__name p {
    margin: 0;
    padding: 0;
    font-weight: 500;
}

.grid-view .product__specs {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 15px;
    width: 100%;
}

.grid-view .product__specs p {
    margin: 0;
}

.grid-view .product__image {
    position: relative;
    background-color: #29373a;
    display: flex;
    height: 50%;
    align-items: center;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    overflow: hidden;
}

.grid-view .product__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-view .product__image img {
    max-width: 100%;
}

.grid-view .product__price__link {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.grid-view .product__price__link a {
    color: #29373a;
    border: 2px solid #29373a;
    border-radius: 0.5rem;
    padding: 3px 10px;
    margin-left: auto;
    transition: 0.2s ease-in-out;
    font-weight: 600;
    text-decoration: none;
    font-family: 'Athiti', sans-serif;
    font-size: 1.2em;
}

/* Media Query for responsiveness */
@media (width < 1300px) {
    .collection {
        grid-template-columns: repeat(2, 1fr);
    }

    .container {
        width: 60%;
    }

    .filter-container {
        width: 30%;
        min-width: 250px;
        padding: 2rem 1rem;
    }

}

@media (width < 1000px) {
    .collection {
        grid-template-columns: repeat(1, 1fr);
    }

    .view_buttons {
        display: none;
    }

    .submit-filter {
        font-size: 0.8rem;
    }

    .toggle-input {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .collection {
        grid-template-columns: repeat(1, 1fr);
    }
}