/* ===========================
   Digital Point Gestionale
   =========================== */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 60px;
    --dp-primary: #2563eb;
    --dp-dark: #1e293b;
    --dp-darker: #0f172a;
}

/* Sidebar - layout a 3 zone: header, menu scroll, bottom fisso */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    max-height: 100vh;
    background: var(--dp-dark) !important;
    transition: width 0.3s ease;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    overflow: hidden;
}

/* ZONA 2: Menu - prende TUTTO lo spazio rimasto e scrolla con rotellina */
.sidebar-scrollable {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;  /* Obbligatorio: senza questo flex non riduce l'altezza */
}

/* ZONA 3: Bottom fisso - Da Fare, Da Ordinare, Footer - SEMPRE visibile */
.sidebar-bottom-fixed {
    flex: 0 0 auto;  /* non cresce, non si riduce */
    overflow: hidden;
    background: var(--dp-dark);
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Scrollbar sottile per sidebar */
.sidebar-scrollable::-webkit-scrollbar {
    width: 5px;
}
.sidebar-scrollable::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}
.sidebar-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
.sidebar-scrollable {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}


.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-text {
    display: none;
}

.sidebar.collapsed .sidebar-sublink {
    padding-left: 1rem !important;
}

.sidebar-link {
    color: #94a3b8;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 2px;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-link:hover .sidebar-text {
    color: #fff !important;
}

.sidebar-sublink {
    padding-left: 2.5rem !important;
    font-size: 0.875rem;
}

.sidebar-sublink .sidebar-text {
    color: #94a3b8 !important;
}

.sidebar-sublink:hover .sidebar-text {
    color: #fff !important;
}

.sidebar-submenu {
    border-radius: 0 0 0 4px;
}

.sidebar-icon {
    width: 20px;
    text-align: center;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
    background: #f8fafc;
}

.sidebar.collapsed ~ .main-content,
.main-content.expanded {
    margin-left: var(--sidebar-collapsed);
    width: calc(100% - var(--sidebar-collapsed));
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
}

.card-stat {
    border-left: 4px solid var(--dp-primary);
}

.card-stat .card-stat-icon {
    font-size: 2rem;
    color: var(--dp-primary);
    opacity: 0.7;
}

.card-stat.warning { border-left-color: #f59e0b; }
.card-stat.warning .card-stat-icon { color: #f59e0b; }

.card-stat.danger { border-left-color: #ef4444; }
.card-stat.danger .card-stat-icon { color: #ef4444; }

.card-stat.success { border-left-color: #22c55e; }
.card-stat.success .card-stat-icon { color: #22c55e; }

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom-width: 1px;
}

/* Badge scadenza */
.badge-scadenza {
    font-size: 0.75rem;
}

/* Login page */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--dp-dark) 0%, var(--dp-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 400px;
    border-radius: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }
}
