/**
 * SIDEBAR MENU STYLES
 * Menu laterale con comportamento accordion
 */

/* ============================================================
   SIDEBAR CONTAINER
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: 320px;
    height: 100vh;
    background: #fff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    overflow: hidden;
}

.sidebar.open {
    left: 0;
}

/* ============================================================
   SIDEBAR HEADER
   ============================================================ */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #c8102e;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   SIDEBAR CONTENT (Scrollable)
   ============================================================ */
.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* Custom Scrollbar */
.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* ============================================================
   SEZIONI PRINCIPALI (Accordion Level 1)
   ============================================================ */
.sidebar-section {
    border-bottom: 1px solid #eee;
}

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

.sidebar-section-header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
    gap: 12px;
}

.sidebar-section-header:hover {
    background: #f8f8f8;
}

.section-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

.section-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.section-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.sidebar-section-header[aria-expanded="true"] .section-arrow {
    transform: rotate(0deg);
}

.sidebar-section-header[aria-expanded="false"] .section-arrow {
    transform: rotate(-90deg);
}

/* Contenuto Sezione */
.sidebar-section-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease;
    opacity: 1;
}

.sidebar-section-content.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ============================================================
   SOTTOCATEGORIE (Accordion Level 2 - Solo in Prodotti)
   ============================================================ */
.sidebar-subcategory {
    border-top: 1px solid #f0f0f0;
}

.sidebar-subcategory:first-child {
    border-top: none;
}

.subcategory-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 20px 12px 56px;
    background: #fafafa;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.subcategory-header:hover {
    background: #f0f0f0;
}

.subcategory-label {
    font-size: 14px;
    font-weight: 500;
    color: #555;
}

.subcategory-arrow {
    font-size: 10px;
    color: #999;
    transition: transform 0.3s ease;
}

.sidebar-subcategory.open .subcategory-arrow {
    transform: rotate(0deg);
}

.sidebar-subcategory:not(.open) .subcategory-arrow {
    transform: rotate(-90deg);
}

/* Contenuto Sottocategoria */
.sidebar-subcategory .subcategory-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-subcategory.open .subcategory-content {
    max-height: 500px;
}

/* ============================================================
   LINKS
   ============================================================ */
.sidebar-links {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Links diretti nelle sezioni (non sottocategorie) */
.sidebar-section-content > .sidebar-links > li > a {
    display: block;
    padding: 10px 20px 10px 56px;
    color: #555;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-section-content > .sidebar-links > li > a:hover {
    background: #f5f5f5;
    color: #c8102e;
    border-left-color: #c8102e;
}

/* Links nelle sottocategorie */
.subcategory-content > li > a {
    display: block;
    padding: 9px 20px 9px 72px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.subcategory-content > li > a:hover {
    background: #fff;
    color: #c8102e;
    border-left-color: #c8102e;
}

/* ============================================================
   SIDEBAR FOOTER
   ============================================================ */
.sidebar-footer {
    padding: 16px 20px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.sidebar-contact {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-contact a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.sidebar-contact a:hover {
    color: #c8102e;
}

.sidebar-contact svg {
    flex-shrink: 0;
}

.sidebar-whatsapp {
    color: #25D366 !important;
}

.sidebar-whatsapp:hover {
    color: #1da851 !important;
}

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

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

/* ============================================================
   BODY LOCK (quando sidebar aperta)
   ============================================================ */
body.sidebar-open {
    overflow: hidden;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        left: -100%;
    }

    .sidebar.open {
        left: 0;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .sidebar {
        width: 300px;
        left: -300px;
    }
}
