/**
 * Sidebar Shared Styles - Dùng Chung
 * Chỉ chứa styles cho sidebar, không có reset hay layout toàn trang.
 * Dùng cho các trang standalone (sdk-monitor-dashboard-active.html, v.v.)
 * để tránh xung đột CSS với Tailwind hoặc CSS riêng của trang.
 */

:root {
    --primary-color: #01297A;
    --primary-light: #034EA2;
    --sidebar-collapsed-width: 64px;
    --sidebar-width: 240px;
    --danger-color: #ff4d4f;
}

/* ── Logo ── */
.sidebar-logo-area {
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 0;
    transition: gap 0.3s ease, padding 0.3s ease;
}

.sidebar:hover .sidebar-logo-area {
    justify-content: flex-start;
    gap: 12px;
    padding: 0 4px;
}

.sidebar-fpt-logo-box {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-fpt-logo-box img {
    width: 100%;
    height: auto;
}

.sidebar-logo-text {
    color: white;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar:hover .sidebar-logo-text {
    opacity: 1;
    width: auto;
}

/* ── Sidebar container ── */
.sidebar {
    width: var(--sidebar-collapsed-width);
    background-color: var(--primary-color);
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 20px 10px 16px;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s ease, padding 0.3s ease;
    box-sizing: border-box;
    font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

.sidebar:hover {
    width: var(--sidebar-width);
    padding: 20px 16px 16px;
}

/* ── Nav menu ── */
.sidebar-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    flex: 1;
}

.sidebar-nav-section {
    margin-bottom: 16px;
}

.sidebar-nav-section-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    height: 0;
    overflow: hidden;
    padding: 0 12px;
    margin: 0;
    transition: opacity 0.2s ease, height 0.2s ease, padding 0.2s ease, margin 0.2s ease;
}

.sidebar:hover .sidebar-nav-section-title {
    opacity: 1;
    height: auto;
    padding: 8px 12px 4px;
    margin-bottom: 4px;
}

.sidebar-nav-item {
    width: 100%;
    height: 40px;
    display: flex;
    align-items: center;
    padding: 0;
    gap: 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-decoration: none;
    list-style: none;
    box-sizing: border-box;
}

.sidebar:hover .sidebar-nav-item {
    padding: 0 12px;
    gap: 12px;
}

.sidebar-nav-item i {
    font-size: 18px;
    width: 100%;
    text-align: center;
    flex-shrink: 0;
    transition: width 0.3s ease;
    color: #fff;
}

.sidebar:hover .sidebar-nav-item i {
    width: 22px;
}

.sidebar-nav-item-label {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    width: 0;
    overflow: hidden;
    transition: opacity 0.2s ease, width 0.3s ease;
}

.sidebar:hover .sidebar-nav-item-label {
    opacity: 1;
    width: auto;
}

.sidebar-nav-item:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav-item.active {
    background-color: rgba(255, 255, 255, 0.16);
    color: white;
    font-weight: 600;
}

/* ── Footer ── */
.sidebar-footer-area {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    transition: gap 0.3s ease, padding 0.3s ease;
}

.sidebar:hover .sidebar-footer-area {
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
}

.sidebar-footer-icons {
    display: flex;
    gap: 8px;
}

.sidebar-footer-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 16px;
}

.sidebar-footer-icon:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-avatar {
    width: 28px;
    height: 28px;
    background-color: var(--danger-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
    flex-shrink: 0;
}

/* ── Responsive ── */
@media (max-width: 1366px) {
    .sidebar { padding: 16px 8px 12px; }
    .sidebar:hover { padding: 16px 12px 12px; }
    .sidebar-logo-area { margin-bottom: 24px; }
    .sidebar-nav-item { height: 36px; font-size: 13px; }
    .sidebar:hover .sidebar-nav-item { height: 36px; font-size: 13px; padding: 0 10px; gap: 10px; }
    .sidebar-nav-item i { font-size: 14px; }
    .sidebar:hover .sidebar-nav-item i { width: 18px; }
    .sidebar:hover .sidebar-nav-section-title { font-size: 10px; padding: 6px 10px 3px; }
    .sidebar-nav-section { margin-bottom: 12px; }
}

@media (max-width: 1280px) {
    .sidebar { padding: 14px 6px 10px; }
    .sidebar:hover { padding: 14px 10px 10px; }
    .sidebar-logo-area { margin-bottom: 20px; }
    .sidebar-nav-item { height: 34px; font-size: 12px; }
    .sidebar:hover .sidebar-nav-item { height: 34px; font-size: 12px; padding: 0 8px; gap: 8px; }
    .sidebar-nav-item i { font-size: 13px; }
    .sidebar:hover .sidebar-nav-item i { width: 18px; }
    .sidebar:hover .sidebar-nav-section-title { font-size: 10px; padding: 5px 8px 2px; }
    .sidebar-nav-section { margin-bottom: 10px; }
    .sidebar-avatar { width: 28px; height: 28px; }
}
