/* app/static/css/navigation.css */
/* UPPDATERAD VERSION - Kompakt desktop-meny, normal mobil/tablet-meny */

:root {
    --primary-color: #007533;
    --text-color: #333;
    --text-light: #666;
    --background-color: white;
    --hover-color: #006a33;
    --border-color: #e0e0e0;
    --light-bg: #f8f8f8;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* ========== DESKTOP SIDEBAR NAVIGATION (KOMPAKT) ========== */

.sidebar-navigation {
    width: 240px;
    background-color: white;
    /*border-radius: 8px;
    box-shadow: var(--shadow-sm);
    max-height: calc(100vh - 120px);
    position: sticky; */
    top: 90px;
    overflow-y: auto;
    flex-shrink: 0;
    border-right: 2px;
    border-right-color: #eeeeee;
    border-right-style: solid;    
}

.sidebar-navigation::-webkit-scrollbar {
    width: 6px;
}

.sidebar-navigation::-webkit-scrollbar-track {
    background: white; /* Vit bakgrund istället för grå */
}

.sidebar-navigation::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

/* DESKTOP: Kompakt header */
.sidebar-nav-header {
    padding: 10px 16px; /* Mindre padding */
    border-bottom: none; /* Inget streck på desktop */
    background-color: white; /* Vit bakgrund istället för grå */
}

.sidebar-nav-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-nav-header svg {
    width: 20px;
    height: 20px;
}

/* ========== CATEGORY LIST (DESKTOP) ========== */

.sidebar-category-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-category-item {
    border-bottom: none; /* Inget streck på desktop */
}

.sidebar-category-item:last-child {
    border-bottom: none;
}

/* DESKTOP: Kompakt padding (4px vertikalt) */
.sidebar-link-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 8px;
    padding: 4px 12px; /* Mycket mindre padding på desktop */
    transition: all 0.2s;
}

.sidebar-link-wrapper:hover {
    background-color: var(--light-bg);
}

.sidebar-category-link {
    flex: 1;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.sidebar-category-link:hover {
    color: var(--primary-color);
}

.sidebar-category-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

.sidebar-category-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    flex-shrink: 0;
}

.sidebar-category-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s;
    flex-shrink: 0;
    color: var(--text-light);
}

.sidebar-category-link.expanded .sidebar-category-arrow {
    transform: rotate(180deg);
}

/* ========== SUBCATEGORY LIST (DESKTOP) ========== */

.sidebar-subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: white; /* Vit bakgrund istället för grå */
    display: none;
}

.sidebar-category-item.expanded > .sidebar-subcategory-list {
    display: block;
}

.sidebar-subcategory-item {
    border-bottom: none; /* Inget streck på desktop */
}

.sidebar-subcategory-item:last-child {
    border-bottom: none;
}

/* DESKTOP: Kompakt padding för subcategories */
.sidebar-subcategory-item .sidebar-link-wrapper {
    padding: 2px 12px 2px 28px; /* Mindre padding, indentering kvar */
}

.sidebar-subcategory-link {
    flex: 1;
    color: var(--text-color);
    text-decoration: none;
    font-size: 13px;
}

.sidebar-subcategory-link:hover {
    color: var(--primary-color);
}

.sidebar-subcategory-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

/* ========== SUB-SUBCATEGORY LIST (DESKTOP) ========== */

.sidebar-subsubcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: white;
    display: none;
}

.sidebar-subcategory-item.expanded > .sidebar-subsubcategory-list {
    display: block;
}

.sidebar-subsubcategory-item {
    border-bottom: none; /* Inget streck på desktop */
}

.sidebar-subsubcategory-item:last-child {
    border-bottom: none;
}

/* DESKTOP: Kompakt padding för sub-subcategories */
.sidebar-subsubcategory-link {
    display: block;
    padding: 4px 12px 4px 44px; /* Mindre padding, extra indentering */
    color: var(--text-color);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.sidebar-subsubcategory-link:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

.sidebar-subsubcategory-link.active {
    background-color: var(--light-bg);
    color: var(--primary-color);
    font-weight: 600;
}

/* ========== MOBILE SIDEBAR MENU ========== */

.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-sidebar-overlay.active {
    display: block;
    opacity: 1;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background-color: white;
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
}

.mobile-sidebar.active {
    transform: translateX(0);
}

/* MOBIL/TABLET: Större padding och borders */
.mobile-sidebar-header {
    padding: 16px; /* Större padding på mobil/tablet */
    border-bottom: 1px solid var(--border-color); /* Streck på mobil/tablet */
    background-color: var(--light-bg); /* Grå bakgrund på mobil/tablet OK */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.mobile-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
}

.mobile-sidebar-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-sidebar-close:hover {
    color: var(--primary-color);
}

.mobile-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-sidebar-loading {
    padding: 20px;
    text-align: center;
    color: var(--text-light);
}

/* MOBIL/TABLET: Större padding och borders för kategorierna */
.mobile-sidebar .sidebar-category-list,
.mobile-sidebar .sidebar-subcategory-list,
.mobile-sidebar .sidebar-subsubcategory-list {
    background-color: white;
}

/* MOBIL/TABLET: Behåll större padding (14px) */
.mobile-sidebar .sidebar-link-wrapper {
    padding: 14px 16px; /* Större padding på mobil/tablet */
}

.mobile-sidebar .sidebar-subcategory-item .sidebar-link-wrapper {
    padding: 14px 16px 14px 36px; /* Större padding på mobil/tablet */
}

.mobile-sidebar .sidebar-subsubcategory-link {
    padding: 14px 16px 14px 52px; /* Större padding på mobil/tablet */
}

/* MOBIL/TABLET: Lägg till borders mellan items */
.mobile-sidebar .sidebar-category-item {
    border-bottom: 1px solid var(--border-color); /* Streck på mobil/tablet */
}

.mobile-sidebar .sidebar-subcategory-item {
    border-bottom: 1px solid var(--border-color); /* Streck på mobil/tablet */
}

.mobile-sidebar .sidebar-subsubcategory-item {
    border-bottom: 1px solid var(--border-color); /* Streck på mobil/tablet */
}

.mobile-sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background-color: var(--light-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.mobile-sidebar-footer a {
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    transition: color 0.2s;
}

.mobile-sidebar-footer a:hover {
    color: var(--primary-color);
}

/* ========== CATEGORY GRID (för kategoriöversikter) ========== */

.category-overview-section {
    margin-bottom: 40px;
}

.category-overview-section h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-color);
}

.category-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 24px;
}

.category-overview-card {
    background-color: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px;
    text-align: center;
    text-decoration: none;
    color: var(--text-color);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 120px;
    position: relative;
}

.category-overview-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

/* SVG-ikon (fallback) */
.category-overview-icon {
    width: 48px;
    height: 48px;
    color: var(--primary-color);
    flex-shrink: 0;
}

/* Produktbild i kategori-kort */
.category-overview-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}

.category-overview-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
    word-wrap: break-word;
    hyphens: auto;
}

/* Laddningsindikator */
.category-loading {
    color: var(--text-light);
    padding: 20px;
    text-align: center;
}

/* ========== DESKTOP SIDEBAR NAVIGATION - Arrow Buttons ========== */

.category-arrow {
    background: none;
    border: none;
    padding: 0px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.category-arrow:hover {
    background-color: rgba(0, 140, 69, 0.1);
    color: var(--primary-color);
}

.category-arrow.rotated {
    transform: rotate(90deg);
}

.category-arrow svg {
    display: block;
    pointer-events: none;
}

.category-text,
.subcategory-text {
    flex: 1;
    cursor: pointer;
}

.sidebar-category-link:hover .category-text,
.sidebar-subcategory-link:hover .subcategory-text {
    color: var(--primary-color);
}

.sidebar-category-item.expanded > .sidebar-link-wrapper,
.sidebar-subcategory-item.expanded > .sidebar-link-wrapper {
    background-color: var(--light-bg);
}

/* ========== RESPONSIVE - Tablet ========== */

@media (max-width: 992px) {
    .category-overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .category-overview-card {
        padding: 12px;
        gap: 8px;
        min-height: 120px;
    }
    
    .category-overview-icon {
        width: 40px;
        height: 40px;
    }
    
    .category-overview-image {
        width: 60px;
        height: 60px;
    }
    
    .category-overview-name {
        font-size: 13px;
    }
}

/* ========== RESPONSIVE - Mobile ========== */

@media (max-width: 768px) {
    /* Desktop sidebar döljs, mobil sidebar används istället */
    .sidebar-navigation {
        display: none;
    }
    
    .category-overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    /* Större klick-område för arrow på mobil */
    .mobile-sidebar .category-arrow {
        padding: 8px;
        margin-right: -4px;
    }
}

@media (max-width: 576px) {
    .category-overview-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
}

/* ========== ACCESSIBILITY ========== */

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .sidebar-navigation,
    .mobile-sidebar,
    .mobile-menu-toggle,
    .breadcrumb {
        display: none;
    }
    
    .product-layout {
        grid-template-columns: 1fr;
    }
}