*{
    padding: 0;
    margin: 0;
    font-family: Gill Sans, sans-serif;
}

button, .addToCart, img, a, i ,h1 ,h2 {
  cursor: pointer;
}

body{
    width: auto;
    height: auto;
}
html{
    width: auto;
    height: auto;
}

.topsales{
    margin-top: 20px;
    display: flex;
}
.sales1{
    min-width: 400px;
    min-height: 560px;
    margin-right: 30px;
}
.sales1 img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
}
.rightsidetopsales{
    height: 560px;
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 10px;
}
.sales2{
    width: 200px;
    height: 170px;
}
.sales2 img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    border-radius: 6px;
}
.description2{
    width: 160px;
    height: 170px;
    padding: 10px;
    box-sizing: border-box;
    background-color: #f7f7f7;
    border-radius: 6px;
    color: #835959;
    text-align: center;
    align-content: center;
}
.description1{
    width: 370px;
    height: 170px;
    padding: 10px;
    box-sizing: border-box;
    background-color: #ff7676;
    border-radius: 6px;
    color: #ffffff;
    text-align: center;
    align-content: center;
    font-size: larger;
    margin: 15px 0;
}
/*header*/
header{
    background-color: #f5ebeb;
    height: 50px;
    width: 100%;
    position: fixed;
    box-shadow: rgba(99, 99, 99, 0.2) 0px 2px 8px 0px;
    z-index: 1;
    align-items: center;
}
header h1{
    line-height: 50px;
    width: 1000px;
    padding: 0 calc(50% - 510px);
    margin:00 10px; 
    display:inline;
    font-size: x-large;
    color: #5a3e3e;
}
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 30px;
    cursor: pointer;
    color: inherit;
}
header .CRUDlinks {
    position: absolute;
    right: 80px;
    top: 0;
    height: 50px;
    display: inline-flex;
    align-items: center;
    gap: 20px; 
    white-space: nowrap;
}

header .CRUDlinks span {
    color: #5a3e3e;
}

header a {
    text-decoration: none;
    color: #6c86fc;
}
header i{
    color: #5a3e3e;
}
.shoppingcart{
    display:inline;
    right: 0px;
    position: absolute;
    padding: 8px;
    margin-right: 15px;
    width: auto;
    max-width: 300px;
    align-items: center;
}
.shoppingcart i{
    right: 0px;
    position: absolute;
    font-size: 36px;
}
.cartwindow{
    background-color: #f1f1f1;
    padding: 0px 10px 10px 10px;
    border-radius: 5px;
    box-shadow: rgba(99, 99, 99, 0.5) 0px 2px 8px 0px;
    margin-top: 40px;
    
    display: none;
}
.shoppingcart:hover .cartwindow{
    display: block;
}
.cartitem{
    display: flex;
    margin-bottom: 10px;
    align-items: flex-start;
}
.cartitemthumbnail{
    width: 90px;
    height: 120px;
    margin-right: 10px;
}
.cartitemname{
    margin-bottom: 3px;
    font-size: small;
    margin-top: 10px;
    text-decoration: none;
    color:black;
    padding: 5px ;
}
.cartitem > a {
  flex-shrink: 0;
}
.cartitem > div {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.cartitemdescription{
    padding: 10px 5px;
    color: #999999;
    font-size: x-small;
}
.quantitycontrol{
    padding: 10px 5px;
    justify-content: flex-end;
    display: flex;
    margin-left: auto; 
}
.quantityincrement,.quantitydecrement{
    border-radius: 100%;
    border: none;
    background-color: #C1C1C1;
    color: #ffffff;
    width: 25px;
    height: 25px;
    margin: 10px;
    font-size: medium;
}
.quantityincrement:active,.quantitydecrement:active{
    background-color: #707070
}
.quantity{
    line-height: 30px;
    text-align: center;
    align-self: center;
}
h2{
    padding: 12px 10px;
    margin-top: 5px;
    text-align: center;
    color: #5a3e3e;
}
.cartwrapper{
    overflow-y: auto;
    max-height: 350px;
}
.subtotal{
    text-align: center;
    padding: 10px;
}
.checkout, .viewcart{
    text-align: center;
    padding: 8px;
    margin: 2px 0;
    border: 1px solid #8f8f8f;
    border-radius: 3px;
    color: #6d6d6d;
}
.checkout:hover, .viewcart:hover{
    background-color: #8f8f8f;
    color: #ffffff;
}

/*main*/
main{
    background-color: #FFFFFF;
    min-height: calc(100vh - 50px - 90px); 
    /*100% -header -footer*/
    max-width: 1000px;
    padding: 50px 0px 0px 10px;
    /*leave space for fixed header*/
    display: flex;
    flex-direction: column; 
    margin: 0 auto;
}

/*navigation bar*/
nav{
    background-color: #FFFFFF;
}
nav li{
    display: inline;
    padding: 10px;
    line-height: 50px;
}

nav a{
    text-decoration: none;
    color: rgb(142, 142, 243);
}
nav a:hover{
    text-decoration: underline;
}




/*main content*/
.content{
    flex:1;
    display: flex;
}

.leftcolumn{
    background-color: #F8F8F8;
    width: 160px;
    display:inline;
    justify-items: center;
    border-radius: 4px;
}

.categoriestitle{
    background-color: #f79393;
    line-height: 80px;
    width: 100%;
    text-align: center;
    font-size:larger;
    color: #FFFFFF;
    border-radius: 4px 4px 0 0;
}

.categorieslist{
    width: 100%;
}

.categorieslist li{
    list-style-type: none;
}

.categorieslist li div{
    text-align: center;
    padding: 10px 0;
}
.categorieslist li div:hover{
    background-color: #EDEDED;
}

.categorieslist a{
    text-decoration: none;
    color: black;
}

.rightcolumn{
    display: inline;
    width: calc(100% - 160px - 40px);
    /*100% -category list -marginleft*/
    margin-left: 40px;
    position: relative;
}
.categorydescription{
    position: relative;
    min-width: 100%;
}
.rightcolumn h1{
    position: relative;
    left: 0;
}
.categorydescription p{
    position: relative;
    left: 0;
    color: #8d8d8d;
    margin-top: 1px;
}

.productlist{
    margin-top: 30px;
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;     
    gap: 10px;   
}
.productitem{
    margin-bottom: 30px;
    width: 150px;
}
.productitem img{
    width: 150px;
    height: 200px;
    object-fit: cover;
    object-position: center;
}

.productname{
    padding: 5px 0;
    margin-bottom: 3px;
    font-size: small;
}
.productname a{
    text-decoration: none;
    color:black;
}
.productpricewrapper{
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.productprice{
    font-size: medium;
    padding: 5px 3px;
    display: inline;
    
}
.addToCart{
    border: none;
    background-color: rgb(187, 174, 241);
    color: #FFFFFF;
    padding: 7px 5px;
    border-radius: 3px;
    font-size: small;
}
.addToCart:hover{
   background-color: rgb(162, 147, 221);
}
/*footer*/
footer{
    background-color: #EFEFEF;
    width: 100%;
    height: 90px;
    margin-top: auto;   
}
footer div{
    position: relative;
    color: #8d8d8d;
    padding: 15px 5px;
    padding-bottom: 0;
    margin-left: 30px;
}



@media (max-width: 768px) {

    .shoppingcart:hover .cartwindow {
        display: none !important; 
    }

    .shoppingcart.show-cart .cartwindow {
        display: block !important;
        position: absolute; 
        right: 0;           
        width: 300px;       
        z-index: 10000;     
    }


    

    header:not(.admin-mode) .menu-toggle {
        display: block;
        position: absolute;
        right: 80px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 30px;
        background: none;
        border: none;
        cursor: pointer;
        color: inherit;
    }


    header:not(.admin-mode) #auth-links {
        display: none; 
        position: absolute;
        top: 100%; 
        left: 0 !important;
        right: 0 !important;
        
        width: 100vw !important;
        height: auto !important;
        min-height: fit-content !important;
        
        background-color: #faf8f8;
        box-shadow: 0px 8px 16px rgba(0,0,0,0.3);
        
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important; 
        z-index: 9999;
    }

    header:not(.admin-mode) #auth-links.show-menu {
        display: flex !important;
    }

    header:not(.admin-mode) #auth-links a, 
    header:not(.admin-mode) #auth-links span {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 15px 20px !important;
        margin: 0 !important;
        
        white-space: normal !important; 
        word-wrap: break-word !important; 
        text-align: center !important;
        
        border-bottom: 1px solid #ddd;
        line-height: 1.5;
        background-color: #faf8f8 !important; 
    }
}

@media (max-width: 1024px){
    header.admin-mode .menu-toggle {
        display: block;
        position: absolute;
        right: 80px;
        top: 50%;
        transform: translateY(-50%);
    }

    header.admin-mode #auth-links {
        display: none; 
        position: absolute;
        top: 100%; 
        left: 0 !important;
        right: 0 !important;
        
        width: 100vw !important;
        height: auto !important;
        min-height: fit-content !important;
        
        background-color: #faf8f8;
        box-shadow: 0px 8px 16px rgba(0,0,0,0.3);
        
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        margin: 0 !important;
        gap: 0 !important;
        z-index: 9999;
    }

    header.admin-mode #auth-links.show-menu {
        display: flex !important;
    }

    header.admin-mode #auth-links a, 
    header.admin-mode #auth-links span {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 15px 20px !important;
        margin: 0 !important;
        
        white-space: normal !important; 
        word-wrap: break-word !important; 
        text-align: center !important;
        
        border-bottom: 1px solid #ddd;
        line-height: 1.5;
    }
}


@media (max-width: 768px) and (pointer: coarse) {
    
    html, body {
        overflow-x: hidden !important;
        width: 100vw !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    header {
        width: 100vw !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .shoppingcart.show-cart .cartwindow {
        right: 10px !important;
        max-width: calc(100vw - 20px) !important;
    }

    main {
        padding-top: 60px !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important; 
    }

    .topsales {
        flex-direction: column !important; 
        width: 100% !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }
    
    .sales1 {
        min-width: 100% !important; 
        width: 100% !important;
        min-height: auto !important;
        margin-right: 0 !important;
        margin-bottom: 20px !important;
    }
    
    .rightsidetopsales {
        width: 100% !important;
        height: auto !important;
        flex-direction: column !important; 
        display: flex !important;
    }

    .sales2, .description1, .description2 {
        width: 100% !important; 
        height: auto !important;
        min-height: 100px;
        margin-bottom: 15px !important;
    }

    .content {
        flex-direction: column !important; 
        width: 100% !important;
        padding: 0 15px !important;
        box-sizing: border-box !important;
    }

    .leftcolumn {
        width: 100% !important; 
        margin-bottom: 30px !important;
    }

    .rightcolumn {
        width: 100% !important; 
        margin-left: 0 !important;
    }

    .productlist {
        justify-content: center !important; 
    }

    .description1, 
    .description2 {
        display: none !important;
    }
    
    .categorydescription {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        margin-bottom: 20px !important;
    }

    .category-title, 
    .category-des,
    .rightcolumn h1,
    .categorydescription p {
        align-self: center !important;
        text-align: center !important;
        width: 100% !important;
        left: 0 !important;
        margin-left: 0 !important;
    }
}