/* ========== Root & Typography ========== */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --accent-color: #e74c3c;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
    color: var(--dark-color);
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

/* Proper top padding for fixed header */
body, .page-wrapper, main {
    padding-top: 64px;
}

@media (max-width: 576px) {
    body, .page-wrapper, main {
        padding-top: 48px;
    }
}

/* ========== Layout Structure ========== */
.page-wrapper {
    min-height: 100%;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.container {
    max-width: 1320px;
    padding-left: 15px;
    padding-right: 15px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== Header & Navigation ========== */
#site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background-color: #212529;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin: 0;
    padding: 0;
}

.site-logo {
    height: 64px;
    max-width: 240px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: -7;
}

@media (max-width: 576px) {
    .cart-icon-btn {
        font-size: 1.55rem !important;
        padding: 0.35rem 0.6rem !important;
    }
}

@media (max-width: 991.98px) {
    .mobile-header-spacer {
        height: 7px;
        width: 100%;
        display: block;
    }
    .navbar-icons {
        justify-content: flex-end;
        gap: 1.5rem;
    }
    .profile-icon-btn, .cart-icon-btn {
        font-size: 2.1rem;
        padding: 0.45rem 0.85rem;
        border-radius: 50%;
        background: rgba(255,255,255,0.07);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
        vertical-align: middle;
    }
    .profile-icon-btn:active, .cart-icon-btn:active,
    .profile-icon-btn:focus, .cart-icon-btn:focus {
        background: rgba(255,255,255,0.18);
    }
    .navbar-collapse {
        background-color: #212529;
        padding: 1rem;
        border-radius: 0 0 0.25rem 0.25rem;
        position: absolute;
        top: 70px;
        left: 0;
        right: 0;
        z-index: 1030;
        margin-top: 0 !important;
        box-shadow: none !important;
    }
    #site-header .navbar-nav {
        margin-top: 0 !important;
    }
}

.navbar-icons {
    display: flex;
    align-items: center;
}

.navbar-icons a:focus,
.navbar-icons a:active,
.navbar-icons a:hover {
    outline: none !important;
    box-shadow: none !important;
}

.user-icon .dropdown-item:hover, 
.user-icon .dropdown-item:focus {
    background-color: rgba(52, 152, 219, 0.1) !important;
    color: #3498db !important;
}

/* ========== Hero Section ========== */
.hero {
    background: linear-gradient(rgba(44, 62, 80, 0.45), rgba(44, 62, 80, 0.45)), url('https://images.unsplash.com/photo-1517836357463-d25dfeac3438?w=1920&auto=format&fit=crop&q=90&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxzZWFyY2h8M3x8Z3ltfGVufDB8fDB8fHww') center center/cover no-repeat;
    background-size: cover;
    background-position: center;
    color: white;
    padding: 80px 0;
    margin-bottom: -2.3rem;
    text-align: center;
}
.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 20px;
}
.hero p {
    font-size: 1.2rem;
    max-width: 700px;
    margin: 0 auto 30px;
}

/* ========== Product Cards ========== */
.product-card {
    border: none;
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 30px;
}
.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.product-card img {
    height: 200px;
    object-fit: cover;
}
.product-card .card-title {
    font-weight: 600;
}
.product-card .price {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 1.2rem;
}

/* ========== Buttons ========== */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}
.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}
.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ========== Cart ========== */
.cart-item {
    margin-left: 0.5rem !important;
    position: relative;
    top: -2px;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
}
.cart-item img {
    max-width: 80px;
    border-radius: 4px;
}
.quantity-control {
    display: flex;
    align-items: center;
}
.quantity-control input {
    width: 50px;
    text-align: center;
    margin: 0 10px;
    /* Remove browser spinner */
    -webkit-appearance: none;
       -moz-appearance: textfield;
    appearance: none;
}

/* Hide number input spinners for all browsers */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

 input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
} 

/* Responsive cart table for mobile */
@media (max-width: 576px) {
    .table.cart-table, .table.table-hover {
        font-size: 0.97rem;
    }
    .table.cart-table thead, .table.table-hover thead {
        display: none;
    }
    .table.cart-table tbody tr, .table.table-hover tbody tr {
        display: block;
        margin-bottom: 1.5rem;
        border-bottom: 2px solid #eee;
    }
    .table.cart-table td, .table.table-hover td {
        display: block;
        width: 100%;
        border: none;
        padding: 0.5rem 0;
    }
    .cart-item img.img-thumbnail {
        width: 100px !important;
        max-width: 100%;
        margin-bottom: 0.5rem;
    }
    .cart-item .d-flex.align-items-center {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .cart-item h5.mb-0 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
    .cart-item .quantity-control {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    .cart-qty-group {
        width: 100% !important;
    }
    .cart-item .btn-danger {
        width: 100%;
        margin-top: 0.5rem;
    }
    .cart-item .cart-subtotal, .cart-item .cart-price {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }
    .cart-item .text-muted {
        font-size: 0.95rem;
    }
}

/* Accessibility: focus ring for keyboard navigation (optional enhancement) */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}