/* 
  Premium E-commerce Design System 
  Mobile First Approach
  Typography: Inter (Google Fonts)
*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Color Palette - Modern & Premium */
    --primary-color: #0f172a;
    /* Slate 900 */
    --secondary-color: #334155;
    /* Slate 700 */
    --accent-color: #f15b22;
    /* Orange */
    --accent-hover: #cf4a17;
    /* Darker Orange */
    --background-color: #f8fafc;
    /* Slate 50 */
    --surface-color: #ffffff;
    /* White */
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --border-color: #e2e8f0;
    /* Slate 200 */
    --danger-color: #ef4444;
    /* Red 500 */
    --success-color: #10b981;
    /* Emerald 500 */

    /* Spacing & Layout */
    --container-width: 1400px;
    --header-height: 70px;
    /* Slightly smaller for mobile */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* Mobile friendly tap */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    /* Slightly smaller base font for mobile */
    overflow-x: hidden;
    /* Prevent horizontal scroll */
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}




/* Layout - Mobile Default */
.container {
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}

.main-layout {
    display: flex;
    flex-direction: column;
    /* Stack vertically on mobile */
    gap: 24px;
    padding-top: 20px;
    padding-bottom: 40px;
}

/* Header - Mobile Default */
header {
    background-color: var(--surface-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

/* Mobile Hamburger Button */
.hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--primary-color);
    padding: 8px;
    margin-left: -8px;
    /* Alignment fix */
    cursor: pointer;
}

/* Header Content Layout */
.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
}

/* Ensure Logo is Centered */
.logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    /* Ensure distinct layer */
}

.logo img {
    height: 32px;
    /* Appropriate mobile height */
    width: auto;
}

.header-right {
    width: 28px;
    /* To balance spacing if needed, or empty */
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Off-canvas Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    /* Start off-screen */
    width: 280px;
    /* Fixed width sidebar on mobile */
    height: 100vh;
    background: var(--surface-color);
    z-index: 1000;
    transition: left 0.3s ease;
    overflow-y: auto;
    padding: 0;
    /* Reset padding, will use inner containers */
    border-radius: 0;
    /* No radius on mobile full height */
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    /* Hide scrollbar */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar.active {
    left: 0;
    /* Slide in */
}

/* Sidebar Header (Mobile) */
.sidebar-header {
    display: flex;
    /* Visible on mobile */
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 10;
}

.close-sidebar-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modern Sidebar Design styles (border, shadow) are now handled in the Off-canvas section for mobile 
   and in the media query for desktop. The conflicting block has been removed. */

.sidebar-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: -0.02em;
    margin: 0;
    padding: 0;
    border: none;
    cursor: default;
}

/* Optional decorative element */
.sidebar-title::after {
    display: none;
    /* Hide decorative line in header on keyframes or reset */
}

/* Mobile: Hide category content by default logic is removed as the whole sidebar is hidden */
.sidebar-content {
    display: block;
    /* Always open inside the drawer */
}

#sidebar-toggle-icon {
    display: none;
    /* Icon removed */
}

/* Modern Category Tree Design */
.category-tree ul {
    margin: 0;
    padding: 0;
}

.category-tree li {
    margin-bottom: 2px;
    position: relative;
    /* Optional: Animate entry */
}

/* Tree Row Wrapper - clickable feel */
.tree-row {
    display: flex;
    align-items: center;
    padding: 5px 0;
    /* Less left padding, toggle adds space */
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: default;
    color: var(--text-main);
}

.tree-row:hover {
    background-color: #f1f5f9;
    /* Slate 100 */
}

/* Toggle Button Styling */
.tree-toggle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    margin-right: 4px;
    /* Space between toggle and text */
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tree-toggle:hover {
    background-color: #e2e8f0;
    /* Slate 200 */
    color: var(--text-main);
}

/* SVG Icon rotation */
.tree-toggle .toggle-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.25s ease;
}

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

/* Placeholder for leaf nodes to align with parents */
.category-tree .tree-toggle.placeholder {
    width: 24px;
    /* Same width as real toggle */
    cursor: default;
    pointer-events: none;
}

/* Category Link Styling */
.tree-link {
    flex: 1;
    display: flex;
    /* Flex to align count right */
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: inherit;
    font-size: 13px;
    font-weight: 400;
    padding: 4px 6px 4px 0;
    border-radius: 4px;
    transition: color 0.15s ease;
}

.tree-link:hover {
    color: var(--accent-color);
}

.tree-link .link-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

/* Count Badge styling */
.count-badge {
    font-size: 0.75rem;
    color: #94a3b8;
    /* Slate 400 */
    background: transparent;
    padding: 0;
    min-width: 20px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Active State Design */
.tree-row.active {
    background-color: #fff1eb;
    /* Very light orange/brand bg */
    color: var(--accent-color);
}

.tree-row.active .tree-link {
    font-weight: 600;
    color: var(--accent-color);
}

.tree-row.active .tree-toggle {
    color: var(--accent-color);
    /* Color the arrow too */
}

.tree-row.active .count-badge {
    color: var(--accent-color);
    opacity: 0.8;
}

/* Submenu Styling */
.category-tree .tree-submenu {
    padding-left: 18px;
    /* indent width matches toggle width + margin */
    display: none;
    position: relative;
    /* Removed heavy border lines for a cleaner look, optional to bring back if requested */
}

/* Vertical Guide Line (Optional, subtle) - DISABLED */
.tree-submenu::before {
    content: '';
    display: none;
}

.tree-submenu .tree-row {
    padding-top: 6px;
    padding-bottom: 6px;
    font-size: 0.95em;
}

/* Nested adjustments - keep aligning guides */
.tree-submenu .tree-submenu {
    padding-left: 18px;
}

.tree-submenu .tree-submenu::before {
    left: 17px;
}

/* Breadcrumb Premium Design */
.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 0;
    margin-bottom: 24px;
    padding: 10px 16px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    list-style: none;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-item+.breadcrumb-item::before {
    content: "";
    display: block;
    width: 5px;
    height: 9px;
    margin: 0 8px;
    background-image: url("data:image/svg+xml,%3Csvg width='5' height='9' viewBox='0 0 5 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L4 4.5L1 8' stroke='%2394A3B8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
}

.breadcrumb-link {
    color: var(--text-muted);
    transition: var(--transition-base);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb-link:hover {
    color: var(--accent-color);
    background-color: #fef2f2;
    /* Light accent bg on hover */
    padding: 2px 6px;
    margin: -2px -6px;
    border-radius: 4px;
}

.breadcrumb-link.active {
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 600;
    pointer-events: none;
}

/* Product Grid - Mobile Default */
.product-grid {
    display: grid;
    /* Mobile: 2 columns is standard for e-commerce, but 1 column for very small screens */
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    /* Smaller gap for mobile */
}

/* Product Card - Mobile Default */
.product-card {
    background-color: #fff;
    border: none;
    /* Removed border to reduce 'frame' feel */
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Critical for equal height columns in grid */
    position: relative;
    box-shadow: var(--shadow-sm);
    /* Use subtle shadow instead of border */
}

.product-card>a {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Ensure the link wrapper also takes full height */
}

.product-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

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

.product-image-wrapper {
    position: relative;
    padding-top: 100%;
    /* Changed from 150% to 100% to make it square and shorter */
    background-color: #fff;
    /* Kept white as requested */
    overflow: hidden;
}

.product-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* Changed from cover to contain to fit entire image */
    padding: 10px;
    /* Added padding to prevent image touching edges */
    object-position: top center;
    /* Focus on faces/upper body */
    padding: 0;
    transition: transform 0.5s ease;
}

.product-info {
    padding: 12px;
    /* Reduced padding to compact the card */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.product-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    line-height: normal;
    /* Line height normal for single line */
    white-space: nowrap;
    /* Prevent wrapping */
    overflow: hidden;
    text-overflow: ellipsis;
    /* Show dots ... */
    display: block;
    /* Reset display */
    flex-grow: 0;
    /* No need to grow vertically same way */
    min-height: auto;
    /* Remove forced height */
}

.product-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px;
}

.btn-view {
    display: block;
    width: 100%;
    text-align: center;
    padding: 5px 10px;
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    margin-top: auto;
    text-transform: uppercase;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-view:hover {
    background-color: var(--accent-color);
    color: white;
}

/* Pagination - Mobile Default */
.pagination {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-md);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
}

.page-link.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

/* Product Detail Page - Mobile Adjustments */
.product-detail-container {
    display: flex;
    flex-direction: column;
    /* Stack on mobile */
    gap: 24px;
}

.detail-image img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.detail-info h1 {
    font-size: 20px;
    margin-bottom: 12px;
    line-height: 1.3;
}

.detail-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* =========================================
   Tablet Breakpoint (min-width: 768px)
   ========================================= */
@media (min-width: 768px) {
    body {
        font-size: 16px;
    }

    .container {
        padding: 0 24px;
        max-width: 720px;
        /* Tablet container width */
    }

    .logo img {
        height: 44px;
    }

    /* Layout shifts to grid */
    .hamburger-btn {
        display: none;
        /* Hide hamburger on desktop */
    }

    /* Reset Header Layout for Desktop */
    .header-content {
        justify-content: flex-start;
    }

    .logo {
        position: static;
        transform: none;
        margin-right: 40px;
    }

    .logo img {
        height: 44px;
        /* Restore larger size for tablet/desktop */
    }

    .main-layout {
        display: grid;
        grid-template-columns: 280px 1fr;
        /* Sidebar | Content */
        gap: 32px;
        align-items: start;
    }

    .sidebar {
        /* Reset positioning for desktop */
        position: static;
        width: auto;
        height: auto;
        left: auto;
        z-index: 10;
        background: var(--surface-color);
        border-radius: var(--radius-lg);
        padding: 20px;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
        border: 1px solid rgba(226, 232, 240, 0.8);
        overflow: visible;
        /* Allow submenus if needed, but not scrollable itself usually unless sticky */
    }

    .sidebar-header {
        display: block;
        padding: 0;
        border: none;
        background: transparent;
        position: static;
        margin-bottom: 16px;
    }

    .close-sidebar-btn {
        display: none;
    }

    .sidebar-content {
        padding: 0;
    }

    .sidebar-title {
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 12px;
        margin-bottom: 8px;
        font-size: 18px;
        position: relative;
    }

    /* Restore decorative line (DISABLED per user request) */
    .sidebar-title::after {
        content: '';
        display: none;
        position: absolute;
        bottom: -1px;
        left: 0;
        width: 40px;
        height: 2px;
        background-color: var(--accent-color);
        border-radius: 2px;
    }

    /* Desktop: Always show sidebar content, hide toggle icon */
    .sidebar-content {
        display: block !important;
    }

    .sidebar-title {
        cursor: default;
        margin-bottom: 20px;
        /* Restore margin */
        padding-bottom: 12px;
        padding-top: 0;
    }

    #sidebar-toggle-icon {
        display: none !important;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        /* Better sizing for tablet */
        gap: 20px;
    }

    .product-title {
        font-size: 14px;
        min-height: 40px;
    }

    .btn-view {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Detail Page */
    .product-detail-container {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 40px;
    }

    .detail-info h1 {
        font-size: 24px;
    }
}

/* =========================================
   Desktop Breakpoint (min-width: 1024px)
   ========================================= */
@media (min-width: 1024px) {
    .container {
        max-width: var(--container-width);
    }

    header {
        height: var(--header-height);
        /* Back to 80px if defined or larger */
    }

    .logo img {
        height: 50px;
    }

    .main-layout {
        grid-template-columns: 340px 1fr;
        /* Wider sidebar */
        gap: 40px;
    }

    .sidebar {
        position: sticky;
        /* Sticky only makes sense if we have height context */
        top: calc(var(--header-height) + 20px);
        max-height: calc(100vh - var(--header-height) - 40px);
        overflow-y: auto;
    }

    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        /* 4 items per row for both listing and dashboard */
        gap: 20px;
    }



    .product-image {
        padding: 24px;
        /* More white space around image */
    }

    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-hover);
        border-color: #202B60;
    }

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

    /* Desktop Breadcrumb Spacing */
    .breadcrumb {
        margin-top: 24px;
    }

    /* Detail Page */
    .detail-info h1 {
        font-size: 32px;
    }
}

/* =========================================
   Very Small Mobile (max-width: 360px)
   ========================================= */
@media (max-width: 360px) {
    .product-grid {
        grid-template-columns: 1fr;
        /* Single column for very narrow phones */
    }
}

/* Dashboard Elements */
.category-dashboard-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin: 0;
    font-weight: 700;
}

.section-header h2 a {
    text-decoration: none;
    color: inherit;
}

.section-header h2 a:hover {
    color: var(--accent-color);
}

/* Dashboard Minimal Product Cards */
.category-dashboard-section .product-grid {
    row-gap: 32px;
}

.category-dashboard-section .product-card {
    border: none;
    background: transparent;
    box-shadow: none !important;
    padding: 0;
}

.category-dashboard-section .product-card:hover {
    transform: translateY(-3px);
}

.category-dashboard-section .product-image-wrapper {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: box-shadow 0.3s ease;
}

.category-dashboard-section .product-card:hover .product-image-wrapper {
    box-shadow: var(--shadow-md);
}

.category-dashboard-section .product-info {
    padding: 0;
}

.category-dashboard-section .product-category {
    font-size: 10px;
    margin-bottom: 2px;
    opacity: 0.8;
}

.category-dashboard-section .product-title {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 6px;
    min-height: 34px;
    /* Slightly reduced height constraint */
}

.category-dashboard-section .product-price,
.category-dashboard-section .btn-view {
    display: none;
}

/ *   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =           F o o t e r           = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   * /     . s i t e - f o o t e r    {
                 b a c k g r o u n d - c o l o r :    v a r ( - - s u r f a c e - c o l o r ) ;
                 b o r d e r - t o p :    1 p x   s o l i d   v a r ( - - b o r d e r - c o l o r ) ;
                 p a d d i n g :    2 4 p x   0 ;
                 m a r g i n - t o p :    a u t o ;
                 / *   P u s h   t o   b o t t o m   i f   u s i n g   f l e x   c o l u m n   o n   b o d y ,
       b u t   h e r e   m a r g i n - t o p   i s   f i n e   * /             m a r g i n - t o p :    6 0 p x ;
         
}

         . f o o t e r - c o n t e n t    {
                 d i s p l a y :    f l e x ;
                 a l i g n - i t e m s :    c e n t e r ;
                 j u s t i f y - c o n t e n t :    s p a c e - b e t w e e n ;
                 c o l o r :    v a r ( - - t e x t - m u t e d ) ;
                 f o n t - s i z e :    1 3 p x ;
                 f o n t - w e i g h t :    5 0 0 ;
         
}

         . f o o t e r - b r a n d    {
                 d i s p l a y :    f l e x ;
                 a l i g n - i t e m s :    c e n t e r ;
                 g a p :    8 p x ;
                 c o l o r :    v a r ( - - p r i m a r y - c o l o r ) ;
                 f o n t - w e i g h t :    6 0 0 ;
         
}

         . f o o t e r - l i n k s    {
                 d i s p l a y :    f l e x ;
                 g a p :    2 0 p x ;
         
}

         . f o o t e r - l i n k s   a    {
                 c o l o r :    v a r ( - - t e x t - m u t e d ) ;
                 t r a n s i t i o n :    c o l o r   0 . 2 s   e a s e ;
         
}

         . f o o t e r - l i n k s   a : h o v e r    {
                 c o l o r :    v a r ( - - a c c e n t - c o l o r ) ;
         
}

         @ m e d i a   ( m a x - w i d t h :   7 6 8 p x )    {
                 . f o o t e r - c o n t e n t    {
                             f l e x - d i r e c t i o n :    c o l u m n ;
                             g a p :    1 6 p x ;
                             t e x t - a l i g n :    c e n t e r ;
                     
    }

         
}

     