/**
 * =================================================================
 * NOBAMO - Category Sidebar Styles
 * =================================================================
 * 
 * Štýly pre bočnú navigáciu kategórií.
 * 
 * FÁZA C: Nový súbor
 * 
 * @version 1.0.0
 * @date    2025-12-29
 */

/* ============================================
   SIDEBAR CONTAINER
   ============================================ */

#category-sidebar {
    transition: all 0.3s ease;
}

/* Sticky behavior */
#category-sidebar.lg\:sticky {
    position: sticky;
    top: 6rem; /* 24 in Tailwind = 96px = 6rem */
    max-height: calc(100vh - 8rem);
}

/* ============================================
   CATEGORY ITEMS
   ============================================ */

.sidebar-category {
    position: relative;
}

/* Hover effect on category row */
.sidebar-category > div:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

/* Category link base styles */
.sidebar-category a {
    position: relative;
    border-radius: 0.5rem;
}

/* Active state indicator */
.sidebar-category a.bg-brand-100 {
    box-shadow: inset 3px 0 0 0 #16a34a;
}

/* Hover state */
.sidebar-category a:hover:not(.bg-brand-100) {
    background-color: #f9fafb;
}

/* ============================================
   EXPAND/COLLAPSE TOGGLE
   ============================================ */

.sidebar-toggle {
    cursor: pointer;
    user-select: none;
    border-radius: 0.375rem;
}

.sidebar-toggle:hover {
    background-color: #f3f4f6;
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px #16a34a40;
}

/* Rotation animation */
.sidebar-toggle.rotate-90 {
    transform: rotate(90deg);
}

.sidebar-toggle svg {
    transition: transform 0.2s ease;
}

/* ============================================
   CHILDREN CONTAINER
   ============================================ */

.sidebar-children {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease;
}

.sidebar-children.hidden {
    display: none;
}

/* Subtle left border for nested items */
.sidebar-children .sidebar-category {
    position: relative;
}

.sidebar-children .sidebar-category::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, #e5e7eb 10%, #e5e7eb 90%, transparent);
}

/* ============================================
   PRODUCT COUNT BADGE
   ============================================ */

.sidebar-category .rounded-full {
    min-width: 1.5rem;
    text-align: center;
}

/* Animated count on hover */
.sidebar-category a:hover .rounded-full {
    transform: scale(1.05);
    transition: transform 0.15s ease;
}

/* ============================================
   ICONS
   ============================================ */

.sidebar-category [data-lucide] {
    flex-shrink: 0;
}

/* ============================================
   BADGE (New, Sale, etc.)
   ============================================ */

.sidebar-category .text-\[10px\] {
    letter-spacing: 0.025em;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

/* ============================================
   SCROLLBAR CUSTOMIZATION
   ============================================ */

#category-sidebar nav {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}

#category-sidebar nav::-webkit-scrollbar {
    width: 6px;
}

#category-sidebar nav::-webkit-scrollbar-track {
    background: transparent;
    margin: 0.5rem 0;
}

#category-sidebar nav::-webkit-scrollbar-thumb {
    background-color: #d1d5db;
    border-radius: 3px;
}

#category-sidebar nav::-webkit-scrollbar-thumb:hover {
    background-color: #9ca3af;
}

/* Show scrollbar only on hover */
#category-sidebar nav {
    overflow-y: auto;
}

#category-sidebar:hover nav::-webkit-scrollbar-thumb {
    background-color: #9ca3af;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (min-width: 1024px) {
    #category-sidebar {
        min-width: 16rem;
    }
}

@media (min-width: 1280px) {
    #category-sidebar {
        min-width: 18rem;
    }
}

/* ============================================
   ACCORDION STYLE (Alternative)
   ============================================ */

#category-sidebar[data-style="accordion"] .sidebar-children {
    border-left: 2px solid #e5e7eb;
    margin-left: 1rem;
    padding-left: 0.5rem;
}

#category-sidebar[data-style="accordion"] .sidebar-category::before {
    display: none;
}

/* ============================================
   FLAT STYLE (Alternative)
   ============================================ */

#category-sidebar[data-style="flat"] .sidebar-toggle {
    display: none;
}

#category-sidebar[data-style="flat"] .sidebar-children {
    display: block !important;
}

/* ============================================
   LOADING STATE
   ============================================ */

#category-sidebar.loading nav {
    opacity: 0.5;
    pointer-events: none;
}

#category-sidebar.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #e5e7eb;
    border-top-color: #16a34a;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

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

@media print {
    #category-sidebar {
        display: none !important;
    }
}
