/* =========================
   GLOBAL FIXES (UNIVERSAL)
   =========================*/

/* Restore non-cropped product images */
.product img {
    height: 180px !important;
    object-fit: contain !important;
}

/* Reduce product card height */
.product {
    max-height: 420px !important;
}

/* Fix long checkout button on category section */
.checkout-btn {
    max-width: 280px !important;
    margin: auto !important;
}

/* Continue shopping button */
.continue-shopping {
    display: block;
    text-align: center;
    background: var(--gray-light);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    color: var(--text-dark);
    margin-top: 15px;
    font-weight: 500;
}

.continue-shopping:hover {
    background: var(--primary-color);
    color: white;
}

/* Sidebar fix: prevent body scroll */
body.sidebar-open {
    overflow: hidden !important;
}

/* Active page indicator */
.sidebar-link.active,
.dropdown-content a.active,
.dropbtn.active {
    background: var(--primary-color) !important;
    color: white !important;
}

/* Increase logo size and move left */
.header-branding img {
    height: 70px !important;
    left: 10px !important;
}

/* Sidebar product-dropdown restored */
.sidebar-products-menu {
    transition: max-height 0.3s ease;
    max-height: 0;
    overflow: hidden;
}

.sidebar-products-menu.active {
    max-height: 300px;
}

/* Theme toggle tap effect */
#theme-toggle:active {
    transform: scale(0.85);
    background: var(--secondary-color);
}

/* --- UI improvements appended --- */

/* === UI Improvements: Header, Theme Toggle, Logo, Cards, Checkout Button === */

/* Header visible in dark mode */
body.dark-mode header,
body.dark-mode .header, body.dark-mode .site-header {
    background-color: rgba(17,17,17,0.98) !important;
    color: #ffffff !important;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(6px);
}

/* Light mode header */
body:not(.dark-mode) header,
body:not(.dark-mode) .header, body:not(.dark-mode) .site-header {
    background-color: rgba(255,255,255,0.96) !important;
    color: #111827 !important;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

/* Theme toggle styles (supports id #theme-toggle and .theme-toggle) */
#theme-toggle, .theme-toggle {
    width: 52px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    padding: 4px;
    cursor: pointer;
    transition: background 240ms ease, box-shadow 240ms ease;
    background: var(--toggle-bg, #e6e6e6);
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
#theme-toggle .knob, .theme-toggle .knob {
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 200ms ease, box-shadow 200ms ease, background 200ms ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    transform: translateX(0);
}
body.dark-mode #theme-toggle, body.dark-mode .theme-toggle {
    --toggle-bg: #3b3b3b;
}
body.dark-mode #theme-toggle .knob, body.dark-mode .theme-toggle .knob {
    transform: translateX(22px);
    background: #fafafa;
}

/* Click/tap feedback */
#theme-toggle:active .knob, .theme-toggle:active .knob {
    transform: scale(0.92);
}

/* Desktop logo bump and consistent left */
@media (min-width: 1024px) {
    .site-logo img, .header-logo img, .nav-logo img {
        height: 60px !important;
        width: auto !important;
        display: block;
    }
    header .site-logo, header .header-logo, header .nav-logo {
        margin-left: 20px !important;
        display: flex;
        align-items: center;
    }
}

/* Product card hover (subtle lift and shadow) */
.pm-card, .product-card, .card {
    transition: transform 220ms cubic-bezier(.2,.9,.3,1), box-shadow 220ms cubic-bezier(.2,.9,.3,1);
    will-change: transform, box-shadow;
}
.pm-card:hover, .product-card:hover, .card:hover {
    transform: translateY(-8px);
    box-shadow: 0 18px 36px rgba(6,15,30,0.12);
}

/* Improve proceed to checkout button (reinforce) */
.checkout-btn {
    display: inline-block;
    padding: 12px 26px;
    background: linear-gradient(135deg,#ff7a00,#ff4d00);
    color: #fff;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
    box-shadow: 0 8px 24px rgba(255,77,0,0.14);
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
    text-decoration: none;
}
.checkout-btn:hover {
    transform: translateY(-4px);
    filter: brightness(1.05);
    box-shadow: 0 18px 40px rgba(255,77,0,0.18);
}
.checkout-btn:active {
    transform: translateY(1px) scale(0.985);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

/* Ensure consistent left alignment of header elements */
.header-inner, .header-container, .site-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* small tweak to ensure header z-index over content */
header, .site-header {
    position: relative;
    z-index: 9999;
}

/* Accessible focus outlines for toggle and checkout button */
#theme-toggle:focus, .theme-toggle:focus, .checkout-btn:focus {
    outline: 3px solid rgba(255,124,0,0.18);
    outline-offset: 3px;
}

/* Slight text improvement for categories title */
.category-grid p, .category-card p {
    font-weight: 600;
    letter-spacing: -0.2px;
}

/* UI Enhancements */

.proceed-global-btn {
    background: linear-gradient(135deg,#ff7a00,#ff4d00);
    padding: 14px 26px;
    color:#fff;
    border-radius:12px;
    font-weight:600;
    text-decoration:none;
    box-shadow:0 8px 20px rgba(255,77,0,.2);
    transition:all .25s ease;
}
.proceed-global-btn:hover {
    transform:translateY(-3px);
    box-shadow:0 14px 32px rgba(255,77,0,.26);
}
.proceed-global-btn:active {
    transform:scale(.96);
}

/* =========================
   PREMIUM BACK-TO-TOP BUTTON - LOWER POSITION
   =========================*/
   
#back-to-top {
    position: fixed;
    bottom: 80px; /* Changed from 30px to 80px - moves it down */
    left: 25px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff7a00, #ff4d00);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(255, 77, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

#back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#back-to-top:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 77, 0, 0.4);
}

#back-to-top:active {
    transform: translateY(0) scale(0.95);
}

#back-to-top i {
    transition: transform 0.3s ease;
}

#back-to-top:hover i {
    transform: translateY(-2px);
}

/* Auto-inserted z-index fixes to keep cart drawer above header and FAB visible */
header, .navbar, .page-header, .site-header { z-index: 100; position: relative; }
#cart-drawer, #cart-backdrop { z-index: 9999 !important; }
#mini-cart-fab { z-index: 10000 !important; }
#theme-toggle { z-index: 10001 !important; position: fixed; right: 18px; bottom: 80px; }


/* Navbar theme toggle */
#theme-toggle {
 background: var(--light-color);
 border:1px solid var(--gray-light);
 width:42px;height:42px;border-radius:10px;
 display:flex;justify-content:center;align-items:center;
 cursor:pointer;margin-left:12px;
}

/* Theme toggle responsive placement */
.theme-btn{border:none;background:var(--light-color);padding:8px 12px;border-radius:50px;display:flex;align-items:center;gap:8px;cursor:pointer;}
@media(min-width:768px){
 .navbar{display:flex;align-items:center;}
 .navbar .theme-btn{order:10;margin-left:12px;margin-right:12px;}
}
@media(max-width:767px){
 .navbar{display:flex;align-items:center;}
 .navbar .menu-toggle{order:1;}
 .navbar .theme-btn{order:2;margin-left:10px;}
 .navbar .logo{order:3;}
}
