/****************************************
 * GLOBAL
 ****************************************/

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #fafafa;
    color: #222;
}

a {
    color: #1a73e8;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/****************************************
 * HEADER
 ****************************************/

.main-header {
    background: #fff;
    border-bottom: 1px solid #e2e2e2;
    position: sticky;
    top: 0;
    z-index: 2000;
    margin-bottom: 15px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.header-logo {
    font-size: 28px;
    font-weight: 700;
    color: #2c4cff;
}

.header-search {
    flex: 1;
    margin: 0 20px;
    display: flex;
}

.header-search input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 6px 0 0 6px;
    font-size: 15px;
}

.header-search button {
    padding: 10px 20px;
    background: #2c4cff;
    border: none;
    border-radius: 0 6px 6px 0;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.header-user .user-link {
    font-weight: 600;
    color: #333;
}

/****************************************
 * DESKTOP CATEGORY MENU (FINAL)
 ****************************************/

.header-categories {
    background: #f6f6f6;
    border-top: 1px solid #e2e2e2;
}

.cat-menu {
    list-style: none;
    display: flex;
    gap: 22px;
    padding: 10px 10px;
    margin: 0;
    overflow: visible;
}

.cat-item {
    position: relative;
    white-space: nowrap;
}

.cat-link {
    font-weight: 600;
    color: #444;
    padding: 6px 0;
    display: inline-block;
}

.cat-link:hover {
    color: #2c4cff;
}

/****************************************
 * SUBCATEGORY DROPDOWN (FINAL)
 ****************************************/

.subcat-menu {
    position: absolute;
    top: 36px;
    left: 0;
    list-style: none;

    background: #fff;
    min-width: 230px;
    padding: 8px 0;
    margin: 0;

    border-radius: 8px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);

    opacity: 0;
    transform: translateY(7px);
    pointer-events: none;

    transition: opacity .18s ease, transform .18s ease;
    z-index: 3000;
}

/* Показываем при hover */
.cat-item:hover > .subcat-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.subcat-menu li a {
    display: block;
    padding: 8px 14px;
    color: #333;
    font-size: 14px;
}

.subcat-menu li a:hover {
    background: #f1f1f1;
}

/****************************************
 * MOBILE MENU
 ****************************************/

.header-burger {
    display: none;
    font-size: 26px;
    cursor: pointer;
}

.mobile-categories {
    display: none;
    background: #fff;
    border-top: 1px solid #ddd;
}

.mobile-categories.open {
    display: block;
}

.mobile-cat-menu {
    list-style: none;
    padding: 12px 15px;
}

.mobile-cat-item {
    padding: 8px 0;
}

.mobile-cat-header {
    display: flex;
    justify-content: space-between;
    font-size: 16px;
}

.mobile-subcats {
    list-style: none;
    padding-left: 10px;
    display: none;
    margin-top: 8px;
}

.mobile-subcats.open {
    display: block;
}

@media (max-width: 1200px) {
    .header-categories {
        display: none;
    }
    .header-burger {
        display: block;
    }
}

/****************************************
 * PRODUCT GRID
 ****************************************/

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 25px;
    margin: 40px 0;
}

.product-card {
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    transition: .2s ease;
}

.product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.18);
}

.product-link {
    display: block;
    padding: 12px;
}

.product-image-wrapper {
    width: 100%;
    height: 180px;
    background: #f4f4f4;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-title {
    height: 40px;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
}

/****************************************
 * PRICE
 ****************************************/

.product-price {
    font-weight: bold;
    font-size: 18px;
    color: #2b6cb0;
}

.product-old-price {
    text-decoration: line-through;
    color: #999;
    margin-left: 6px;
}

/****************************************
 * PRODUCT PAGE
 ****************************************/

.product-page {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 40px;
}

.product-main-image {
    width: 100%;
    height: 420px;
    border-radius: 10px;
    background: #f0f0f0;
    overflow: hidden;
}

.product-main-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/****************************************
 * BUY BUTTON
 ****************************************/

.buy-button {
    display: block;
    width: 80%;
    margin-left: 5%;
    margin-top: 20px;
    padding: 14px 20px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;

    background: linear-gradient(90deg, #ff4e4e, #ff0000);
    color: #fff;
    border-radius: 10px;

    text-decoration: none;
    transition: .25s ease;
}

.buy-button:hover {
    background: linear-gradient(90deg, #ff0000, #cc0000);
    transform: translateY(-2px);
}

/****************************************
 * PRICE HISTORY
 ****************************************/

.trend-box {
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
}

.trend-fall {
    background: #e6f7ee;
    border-left: 4px solid #0a9f55;
}

.trend-rise {
    background: #fde8e8;
    border-left: 4px solid #d43636;
}

.trend-stable {
    background: #eef1ff;
    border-left: 4px solid #4455ff;
}

.price-stats {
    margin-top: 10px;
    display: flex;
    gap: 25px;
    font-size: 14px;
}
th, td{
    padding: 5px 20px;
}

/****************************************
 * FOOTER
 ****************************************/

.footer {
    margin-top: 50px;
    padding: 20px 0;
    background: #fff;
    border-top: 1px solid #ddd;
    text-align: center;
    color: #777;
    font-size: 14px;
}
