/* Cloudpedia Sidebar Navigation Styles */

/* Base Sidebar Styling */
.cp-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 90px;
    height: 100vh;
    background: linear-gradient(177deg, #3B82F6 0%, #9333EA 100%);
    backdrop-filter: blur(80px);
    -webkit-backdrop-filter: blur(80px);
    z-index: 1000;
    transition: width 0.3s ease;
    border: 0.5px solid rgba(245, 239, 235, 0.4);
    border-radius: 10px;
    box-shadow:
        0 0 0 1px rgba(142, 125, 248, 0.12),
        0 4px 32px rgba(142, 125, 248, 0.24),
        0 0 80px rgba(189, 1, 255, 0.16);
}

.cp-sidebar-inner {
    display: flex;
    flex-direction: column;
    padding: 35px 0 91px 0;
    overflow: hidden;
    width: 100%;
    height: 100%;
    border-radius: inherit;
}

.cp-sidebar.expanded {
    width: 285px;
}

/* Sidebar Toggle Button */
.cp-sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 142px;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    box-shadow: none;
    z-index: 10;
}

.cp-sidebar.expanded .cp-sidebar-toggle {
    transform: rotate(180deg);
}

.cp-sidebar-toggle img {
    width: 100%;
    height: 100%;
}

/* Logo Section */
.cp-sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 24px 0;
    flex-shrink: 0;
}

.cp-logo-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.cp-logo-link {
    gap: 12px;
}

.cp-logo-link:hover {
    opacity: 0.85;
}

.cp-logo-link img.logo-collapsed {
    width: 48px;
    height: auto;
    display: block;
}

.cp-logo-link img.logo-expanded {
    width: 48px;
    height: auto;
    display: none;
}

.cp-sidebar.expanded .cp-logo-link img.logo-collapsed {
    display: block;
}

.cp-sidebar.expanded .cp-logo-link img.logo-expanded {
    display: none;
}

.cp-logo-text {
    display: none;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.cp-sidebar.expanded .cp-logo-text {
    display: block;
}

/* Logo divider */
.cp-sidebar-logo::after {
    content: none;
}

/* User Section */
.cp-sidebar-user {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 25px 12px 16px;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.cp-sidebar-user:hover {
    opacity: 0.85;
}

.cp-sidebar.expanded .cp-sidebar-user {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
}

.cp-sidebar-user::before {
    content: '';
    position: absolute;
    top: 16px;
    left: 0;
    display: block;
    height: 1px;
    width: 100%;
    background: radial-gradient(ellipse at center, rgba(245, 239, 235, 0.24) 0%, transparent 70%);
}

.cp-user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1.5px solid rgba(245, 239, 235, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: #F2C7BA;
}

.cp-user-avatar img {
    width: 100%;
    height: 100%; object-fit: cover;
}

.cp-user-info {
    display: none;
    text-align: center;
    width: 100%;
    min-width: 0;
}

.cp-sidebar.expanded .cp-user-info {
    display: block;
    text-align: left;
    flex: 1;
}

.cp-user-name {
    display: block;
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.cp-user-role {
    display: block;
    color: rgba(255, 255, 255, 0.48);
    font-size: 14px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    margin-top: 2px;
}

/* Main Navigation */
.cp-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px 0;
}

.cp-sidebar-nav::before {
    content: '';
    display: block;
    height: 1px;
    width: 100%;
    background: radial-gradient(ellipse at center, rgba(245, 239, 235, 0.24) 0%, transparent 70%);
    margin-bottom: 8px;
}

.cp-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cp-nav-item {
    margin: 0;
    padding: 0 12px;
}

.cp-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 8px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: all 0.2s ease;
    height: 56px;
    position: relative;
    white-space: nowrap;
    border-radius: 10px;
}

.cp-sidebar.expanded .cp-nav-link {
    justify-content: flex-start;
    padding: 0 16px;
}

.cp-nav-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.cp-nav-link.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.18);
}

.cp-nav-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.cp-nav-label {
    display: none;
    font-size: 14px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
}

.cp-sidebar.expanded .cp-nav-label {
    display: inline;
}

/* Bottom User Actions */
.cp-sidebar-bottom {
    padding: 0 12px;
    flex-shrink: 0;
}

.cp-sidebar-bottom::before {
    content: '';
    display: block;
    height: 1px;
    width: 100%;
    background: radial-gradient(ellipse at center, rgba(245, 239, 235, 0.24) 0%, transparent 70%);
    margin-bottom: 16px;
}

.cp-bottom-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cp-bottom-item {
    margin: 0;
    padding: 0;
}

.cp-bottom-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 8px;
    color: rgba(255, 255, 255, 0.72);
    text-decoration: none;
    transition: all 0.2s ease;
    height: 44px;
    white-space: nowrap;
    border-radius: 10px;
    border: 1px solid transparent;
}

.cp-bottom-link.cp-link-profile {
    background: rgba(255, 255, 255, 0.14);
}

.cp-bottom-link.cp-link-logout {
    background: transparent;
    border-color: rgba(245, 239, 235, 0.4);
}

.cp-sidebar.expanded .cp-bottom-link {
    justify-content: center;
}

.cp-bottom-link:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(245, 239, 235, 0.5);
}

.cp-bottom-link img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.cp-bottom-label {
    display: none;
    font-size: 14px;
    font-weight: 600;
}

/* Page Wrapper */
.cp-page-wrapper {
    margin-left: 90px;
    transition: margin-left 0.3s ease;
}

.cp-page-wrapper.cp-no-sidebar {
    margin-left: 0;
}

.cp-sidebar.expanded ~ .cp-page-wrapper {
    margin-left: 285px;
}

/* Mobile Menu Toggle (Hidden on Desktop) */
.cp-mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 999;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0;
}

.cp-sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.cp-sidebar-backdrop.visible {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Mobile Styles */
@media (max-width: 768px) {
    .cp-sidebar {
        left: -285px;
        width: 285px;
        z-index: 1100;
        border-radius: 0 10px 10px 0;
    }

    .cp-sidebar.mobile-open {
        left: 0;
    }

    .cp-sidebar.expanded {
        left: 0;
        width: 285px;
    }

    .cp-sidebar-toggle {
        display: none;
    }

    .cp-page-wrapper {
        margin-left: 0;
    }

    .cp-mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cp-mobile-menu-toggle::before,
    .cp-mobile-menu-toggle::after {
        content: '';
        position: absolute;
        width: 24px;
        height: 2px;
        background: #000;
        transition: all 0.3s ease;
    }

    .cp-mobile-menu-toggle::before {
        top: 12px;
    }

    .cp-mobile-menu-toggle::after {
        bottom: 12px;
    }

    .cp-sidebar-backdrop.visible {
        display: block;
    }

    .cp-sidebar:not(.mobile-open) {
        left: -285px;
    }

    .cp-nav-label,
    .cp-bottom-label {
        display: inline;
    }

    .cp-sidebar-nav {
        padding: 8px 0;
    }

    .cp-nav-link,
    .cp-bottom-link {
        justify-content: flex-start;
        padding: 0 16px;
    }

    .cp-nav-link:hover,
    .cp-bottom-link:hover {
        background: rgba(255, 255, 255, 0.12);
    }

    .logo-collapsed {
        display: none;
    }

    .logo-expanded {
        display: block;
    }
}

/* Scrollbar Styling for Sidebar Nav */
.cp-sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.cp-sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.cp-sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.cp-sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* RTL Support */
body.body-rtl .cp-sidebar {
    right: 0;
    left: auto;
    border-radius: 10px 0 0 10px;
    box-shadow:
        0 0 0 1px rgba(142, 125, 248, 0.12),
        0 4px 32px rgba(142, 125, 248, 0.24),
        0 0 80px rgba(189, 1, 255, 0.16);
}

body.body-rtl .cp-sidebar-toggle {
    right: auto;
    left: -14px;
}

body.body-rtl .cp-sidebar.expanded .cp-sidebar-toggle {
    transform: rotate(0deg);
}

body.body-rtl .cp-sidebar:not(.expanded) .cp-sidebar-toggle {
    transform: rotate(180deg);
}

body.body-rtl .cp-page-wrapper {
    margin-right: 90px;
    margin-left: 0;
}

body.body-rtl .cp-page-wrapper.cp-no-sidebar {
    margin-right: 0;
}

body.body-rtl .cp-sidebar.expanded ~ .cp-page-wrapper {
    margin-right: 285px;
    margin-left: 0;
}

@media (max-width: 768px) {
    body.body-rtl .cp-sidebar {
        right: -285px;
        left: auto;
        border-radius: 10px 0 0 10px;
    }

    body.body-rtl .cp-sidebar.mobile-open {
        right: 0;
    }

    body.body-rtl .cp-mobile-menu-toggle {
        left: auto;
        right: 15px;
    }
}

/* Announcement Banner in sticky header */
#header-top-sticky {
  background-color: #fafafa !important; /* Update as needed based on screenshot */
  border-bottom: 1px solid #eaeaea;
}

.announcement-banner {
  font-family: inherit; /* Should match the theme typography */
  padding: 10px 0;
}

.announcement-banner .news-badge {
  background-color: #c4b5fd;
  color: #1a2050;
  font-weight: 600;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 4px;
  margin-right: 32px;
}

.announcement-banner .news-text {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}

/* Sticky Header fix for cp-sidebar - Using position: sticky is smoother than fixed */
#header-top-sticky {
    position: sticky !important;
    top: 0 !important;
    z-index: 998 !important;
    background-color: #fafafa !important;
    border-bottom: 1px solid #eaeaea;
}

/* Parent theme JS applies position: fixed and margin-top to elements. 
   Since we use position: sticky (which stays in flow), we need to override those. */
#header-top-sticky.make-header-sticky {
    position: sticky !important;
    left: auto !important;
    width: auto !important;
}

/* Prevent unwanted margin from parent theme JS on any following elements */
#header-top-sticky + *,
#header-top-sticky.make-header-sticky + * {
    margin-top: 0 !important;
}

/* Specific reset for the old sidebar and breadcrumbs */
.side-menu-bar-cloudx {
    margin-top: 0 !important;
}


