:root {
    --black: #000000;
    --red: #d30000;
    --white: #ffffff;
    --gray: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--black);
    color: var(--white);
    line-height: 1.6;
    padding-top: 80px;
}

.navbar {
    background-color: var(--black);
    border-bottom: 2px solid var(--red);
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(211, 0, 0, 0.3);
}

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

.navbar-nav .nav-link {
    color: var(--white) !important;
    margin: 0 0.5rem;
    transition: color 0.3s;
}

.navbar-nav .nav-link:hover {
    color: var(--red) !important;
}

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

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

.btn-outline-light {
    color: var(--white);
    border-color: var(--white);
}

.btn-outline-light:hover {
    background-color: var(--red);
    border-color: var(--red);
    color: var(--white);
}

.card {
    background-color: var(--gray);
    border: 1px solid #444;
    color: var(--white);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--red);
}

.card-title {
    color: var(--red);
}

.form-control {
    background-color: var(--gray);
    border: 1px solid #555;
    color: var(--white);
}

.form-control:focus {
    background-color: var(--gray);
    border-color: var(--red);
    color: var(--white);
    box-shadow: 0 0 0 0.2rem rgba(211, 0, 0, 0.25);
}

.hero-section {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('/static/images/hero-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 4rem 0;
    border-bottom: 3px solid var(--red);
    min-height: 500px;
    display: flex;
    align-items: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: bold;
    color: var(--red);
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.9);
}

.hero-section .lead {
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.9);
}

.hero-section h3 {
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.9);
}

.callback-card {
    background-color: rgba(51, 51, 51, 0.75) !important;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(211, 0, 0, 0.5) !important;
}

.callback-card:hover {
    transform: none !important;
    background-color: rgba(51, 51, 51, 0.85) !important;
}

.callback-square {
    max-width: 300px;
    margin: 0 auto;
    margin-left: 60px;
}

.callback-card h5 {
    font-size: 1.2rem;
}

.category-card {
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.category-image-wrapper {
    width: calc(100% + 2rem);
    height: 350px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 50%, #e8e8e8 100%);
    border-radius: 0;
    padding: 40px;
    margin: -1rem -1rem 0 -1rem;
    border-bottom: 4px solid var(--red);
    box-shadow: 
        0 6px 20px rgba(211, 0, 0, 0.3),
        inset 0 -30px 40px -20px rgba(0, 0, 0, 0.1);
    position: relative;
}

.category-image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, transparent, var(--red), transparent);
}

.category-image-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.05) 100%);
    pointer-events: none;
}

.category-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
    transition: transform 0.4s ease, filter 0.4s ease;
}

.category-card:hover .category-image {
    transform: scale(1.1);
    filter: drop-shadow(0 8px 20px rgba(211, 0, 0, 0.5));
}

.category-card:hover .category-image-wrapper {
    box-shadow: 0 8px 30px rgba(211, 0, 0, 0.5);
}

.price {
    color: var(--red);
    font-size: 1.5rem;
    font-weight: bold;
}

.old-price {
    text-decoration: line-through;
    color: #888;
    font-size: 1.2rem;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 0;
}

.product-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card .card-img-wrapper {
    width: 100%;
    padding-top: 75%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f5f5f5 100%);
    border-bottom: 3px solid var(--red);
}

.product-card .card-img-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 8px;
    transition: transform 0.3s ease;
}

.product-card:hover .card-img-top {
    transform: scale(1.05);
}

.product-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .card-title {
    font-size: 1rem;
    line-height: 1.3;
    min-height: 2.6em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    color: var(--white);
}

.product-card .mt-auto {
    margin-top: auto;
}

.no-image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2d2d2d 0%, #1a1a1a 100%);
    color: #666;
    font-size: 1rem;
}

footer {
    background-color: var(--black);
    border-top: 2px solid var(--red);
    padding: 2rem 0;
    margin-top: 3rem;
}

.cart-badge {
    background-color: var(--red);
    color: var(--white);
    border-radius: 50%;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    position: absolute;
    top: -5px;
    right: -10px;
}

.search-top {
    background-color: var(--gray);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #444;
}

.search-top .form-control-lg {
    font-size: 1.1rem;
}

.filters-sidebar {
    background-color: var(--gray);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #444;
    position: sticky;
    top: 100px;
}

.filter-section {
    margin-bottom: 0;
}

.filter-title {
    color: var(--red);
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #555;
}

.category-tree {
    max-height: none;
    overflow-y: visible;
}

.category-item {
    margin-bottom: 0.25rem;
}

.category-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--white);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.category-link:hover {
    background-color: rgba(211, 0, 0, 0.2);
    color: var(--white);
    text-decoration: none;
}

.category-link.active {
    background-color: var(--red);
    color: var(--white);
    font-weight: bold;
}

.category-link .toggle-icon {
    font-size: 0.7rem;
    transition: transform 0.2s;
    margin-left: 5px;
}

.category-link.expanded .toggle-icon {
    transform: rotate(90deg);
}

.main-category {
    font-weight: 600;
    font-size: 0.95rem;
}

.subcategory-list {
    margin-left: 0.75rem;
    margin-top: 0.15rem;
    border-left: 2px solid var(--red);
    padding-left: 0.5rem;
    display: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.subcategory-list.show {
    display: block;
    max-height: 500px;
}

.subcategory-link {
    display: block;
    color: #bbb;
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.subcategory-link:hover {
    background-color: rgba(211, 0, 0, 0.15);
    color: var(--white);
    text-decoration: none;
}

.subcategory-link.active {
    background-color: var(--red);
    color: var(--white);
    font-weight: bold;
}

.filter-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #555;
}

table {
    color: var(--white);
}

.table {
    color: var(--white);
}

.table-dark {
    background-color: var(--gray);
}

.table-dark thead {
    background-color: var(--black);
    border-bottom: 2px solid var(--red);
}

.alert-success {
    background-color: #155724;
    border-color: #155724;
    color: var(--white);
}

.alert-danger {
    background-color: #721c24;
    border-color: #721c24;
    color: var(--white);
}

.modal-content {
    background-color: var(--gray);
    color: var(--white);
}

.modal-header {
    border-bottom-color: var(--red);
}

.modal-footer {
    border-top-color: var(--red);
}

.close {
    color: var(--white);
}

.quantity-controls {
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-controls .btn {
    width: 35px;
    height: 35px;
    padding: 0;
    font-size: 1.2rem;
    line-height: 1;
}

.quantity-value {
    font-size: 1.1rem;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

.item-subtotal {
    font-weight: bold;
    color: var(--red);
}

.cart-item-card {
    background-color: var(--gray);
    border: 1px solid #444;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
}

.cart-item-name {
    color: var(--red);
    margin-bottom: 5px;
    font-size: 1rem;
    line-height: 1.3;
}

.cart-item-info {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #555;
}

.cart-item-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cart-item-label {
    color: #aaa;
    font-size: 0.9rem;
}

.cart-item-price {
    font-weight: bold;
    color: var(--white);
}

.cart-item-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #555;
}

.cart-item-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cart-total-card {
    background-color: var(--black);
    border: 2px solid var(--red);
    border-radius: 8px;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.cart-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

@media (max-width: 576px) {
    .cart-actions {
        flex-direction: column;
    }
    
    .cart-actions .btn {
        width: 100%;
    }
}

.mobile-header-cart {
    display: none;
    position: relative;
    font-size: 1.5rem;
    text-decoration: none;
    margin-right: 10px;
    order: 2;
}

.mobile-header-cart-badge {
    position: absolute;
    top: -8px;
    right: -12px;
    background-color: var(--red);
    color: var(--white);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

@media (max-width: 991px) {
    .mobile-header-cart {
        display: flex;
        align-items: center;
    }
}

.mobile-cart-widget {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--red);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(211, 0, 0, 0.5);
    z-index: 1001;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.3s, box-shadow 0.3s;
}

.mobile-cart-widget:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(211, 0, 0, 0.7);
}

.mobile-cart-widget .cart-icon {
    font-size: 1.8rem;
    color: var(--white);
}

.mobile-cart-widget .mobile-cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: var(--white);
    color: var(--red);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

@media (max-width: 991px) {
    body {
        padding-top: 70px;
    }
    
    .mobile-cart-widget {
        display: flex;
    }
    
    .hero-section {
        padding: 2rem 0;
        min-height: auto;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .callback-square {
        margin-left: 0;
        margin-top: 1.5rem;
    }
    
    .category-image-wrapper {
        height: 200px;
        padding: 20px;
    }
    
    .filters-sidebar {
        position: static;
        margin-bottom: 1.5rem;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1rem 0;
    }
    
    .search-top {
        padding: 1rem;
    }
    
    .search-top .row {
        flex-direction: column;
    }
    
    .search-top .col-md-8,
    .search-top .col-md-4 {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    footer .row > div {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 576px) {
    body {
        padding-top: 60px;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .hero-title {
        font-size: 1.5rem;
    }
    
    .hero-section .lead {
        font-size: 0.9rem;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
    }
    
    .card-title {
        font-size: 1rem;
    }
    
    .price {
        font-size: 1.2rem;
    }
    
    .old-price {
        font-size: 1rem;
    }
    
    .category-image-wrapper {
        height: 180px;
    }
    
    .category-tree {
        max-height: 250px;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .mobile-cart-widget {
        width: 55px;
        height: 55px;
        bottom: 15px;
        right: 15px;
    }
    
    .mobile-cart-widget .cart-icon {
        font-size: 1.5rem;
    }
}
