/*
CSS-kommentar: Strukturöversikt
1. Main och layout
2. Header och toolbar
3. Produkter och kort
*/

/* 1. Main och layout */
main {
    display: flex;
    flex-direction: column;
    flex: 1;
    background-color: #efe9e1;
}

/* 2. Header och toolbar */
.page-header {
    width: 100%;
    padding: 2rem 5rem;
    background-color: #b23a48;
}

.page-header h1 {
    font-size: 3rem;
    font-weight: 700;
    margin: 0 0 3rem;
    color: #f3f3f3;
}

.toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.category-btn {
    border: none;
    background-color: #f3f3f3;
    color: #36291f;
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s ease;
}

.category-btn:hover,
.category-btn.active {
    background-color: #efe9e1;
}

.sort-wrapper {
    position: relative;
    display: flex;
    justify-content: flex-end;
}

.hamburger {
    width: 2rem;
    height: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger span {
    display: block;
    height: 2px;
    background-color: #f3f3f3;
}

.hamburger span:nth-child(1) {
    width: 100%;
}
.hamburger span:nth-child(2) {
    width: 70%;
}
.hamburger span:nth-child(3) {
    width: 50%;
}

.sort-panel {
    position: absolute;
    top: 1.8rem;
    right: 0;
    display: flex;
    flex-direction: column;
    min-width: 220px;
    background-color: #f3f3f3;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 10;
}

.sort-option {
    border: none;
    background: none;
    padding: 0.8rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    color: #36291f;
    cursor: pointer;
    transition: 0.2s ease;
}

.sort-option:hover,
.sort-option.active {
    background-color: #efe9e1;
}

.hidden {
    display: none;
}

/* 3. Produkter och kort */
.products-section {
    width: 100%;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
}

.product {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    overflow: hidden;
    min-height: 100%;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.product:hover {
    transform: translateY(-4px);
    cursor: pointer;
}

.product img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
    background-color: #efe9e1;
}

.product-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 1rem;
}

.rating {
    align-self: flex-start;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: #555;
}

.product h2 {
    font-size: 1.05rem;
    margin: 0 0 0.5rem;
    color: #36291f;
    line-height: 1.3;
}

.product p {
    font-size: 0.9rem;
    color: #555;
    line-height: 1.5;
    margin: 0 0 1rem;
    flex: 1;
}

.price {
    font-weight: bold;
    color: #36291f;
    margin-top: auto;
    font-size: 1rem;
    margin-bottom: 2rem;
}

.product-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
}

.add-to-cart-mini {
    width: 2.2rem;
    height: 2.2rem;
    border: 1px solid #d8d1c8;
    background: #fff;
    color: #36291f;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        transform 0.2s ease,
        background-color 0.2s ease,
        border-color 0.2s ease,
        opacity 0.2s ease;
    flex-shrink: 0;
    opacity: 0.85;
}

.add-to-cart-mini:hover {
    background-color: #36291f;
    color: #fff;
    border-color: #36291f;
    transform: scale(1.06);
}

.add-to-cart-mini i {
    font-size: 0.95rem;
}

.cart-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #36291f;
    color: #fff;
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.9rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 9999;
}

.cart-toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1024px) {
    .page-header,
    .products-section {
        padding-left: 2rem;
        padding-right: 2rem;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .products-section {
        padding-left: 0;
        padding-right: 0;
    }
    .page-header {
        padding: 1rem;
    }
    .page-header h1 {
        font-size: 2rem;
    }
    .toolbar-row {
        flex-direction: column;
        align-items: stretch;
    }
    .category-buttons {
        order: 1;
    }
    .sort-wrapper {
        order: 2;
        align-self: flex-end;
    }
    .sort-panel {
        top: 1.8rem;
        right: 0;
        min-width: 180px;
    }
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .product img {
        max-width: 100%;
        height: auto;
        object-fit: contain;
    }
    .product h2 {
        font-size: 0.95rem;
    }
    .product p {
        font-size: 0.8rem;
    }
    .price {
        font-size: 0.95rem;
    }
}
