/* 
 * UCAGS CRM - Sidebar Navigation Styles
 * Vertical sidebar with glassmorphism
 */

/* Dashboard Layout */
#dashboardPage {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Prevent body from scrolling while dashboard is active (use .main-content scroll only) */
body #dashboardPage.active {
    overscroll-behavior: none;
}

body:has(#dashboardPage.active) {
    overflow: hidden;
}

/* Hide sidebar and main wrapper when dashboard is not active */
#dashboardPage:not(.active) .sidebar,
#dashboardPage:not(.active) .main-wrapper {
    display: none !important;
    visibility: hidden;
    opacity: 0;
}

/* Sidebar */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg, rgba(88, 28, 135, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 30px rgba(88, 28, 135, 0.4), inset 1px 0 0 rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

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

/* Sidebar Header */
.sidebar-header {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
}

.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

/* Brand logo inside sidebar header */
.sidebar-logo .brand-logo {
    max-width: 280px;
    max-height: 72px;
    margin: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

/* Legacy icon/text logo (kept for backward compatibility) */
.sidebar-logo i {
    font-size: 24px;
    color: white;
}

.sidebar-logo h2 {
    color: white;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-toggle {
    background: rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all var(--transition-base);
    backdrop-filter: blur(10px);
}

.sidebar-toggle:hover {
    background: rgba(139, 92, 246, 0.5);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
}

/* Sidebar User */
.sidebar-user {
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.6) 0%, rgba(167, 139, 250, 0.6) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.user-name {
    color: white;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: -0.01em;
}

.user-role {
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
    letter-spacing: 0;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    font-weight: 500;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.nav-item i {
    font-size: 15px;
    width: 18px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
}

.nav-item span {
    flex: 1;
    font-size: 12px;
    letter-spacing: 0;
}

.nav-item:hover {
    background: rgba(139, 92, 246, 0.3);
    color: white;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.nav-item:hover i {
    color: white;
}

.nav-item.active {
    background: rgba(139, 92, 246, 0.4);
    color: white;
    font-weight: 600;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 2px 8px rgba(139, 92, 246, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.5);
}

.nav-item.active i {
    color: white;
}

.nav-item.active::before {
    opacity: 1;
}

.nav-item.nav-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.nav-item .badge {
    margin-left: auto;
    font-size: 0.7em;
    padding: 2px 6px;
}

.add-batch-btn {
    color: #4caf50 !important;
    font-weight: 600;
}

.add-batch-btn:hover {
    background: rgba(76, 175, 80, 0.1) !important;
}

.add-batch-btn i {
    color: #4caf50;
}

/* Badge */
.badge {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(139, 92, 246, 1) 0%, rgba(167, 139, 250, 1) 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.badge-primary {
    background: rgba(139, 92, 246, 0.2);
    color: var(--primary-purple-light);
}

/* Nav Section (Collapsible) */
.nav-section {
    margin-bottom: 4px;
    display: block;
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all var(--transition-base);
}

.nav-section-header:hover {
    background: rgba(139, 92, 246, 0.2);
    color: white;
}

.nav-section-header i:first-child {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-section-header span {
    flex: 1;
    font-size: 12px;
    font-weight: 500;
}

.toggle-icon {
    font-size: 12px;
    transition: transform var(--transition-base);
}

.nav-section.active .toggle-icon {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    padding-left: 32px;
    display: flex;
    flex-direction: column;
}

.nav-section.active .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 2px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all var(--transition-base);
    cursor: pointer;
    font-size: 11px;
}

.nav-subitem i {
    font-size: 13px;
    width: 16px;
    text-align: center;
}

.nav-subitem:hover {
    background: rgba(139, 92, 246, 0.2);
    color: white;
}

.nav-subitem.active {
    background: rgba(139, 92, 246, 0.3);
    color: white;
    font-weight: 600;
    border-left: 2px solid rgba(167, 139, 250, 0.8);
}

/* Nav Divider */
.nav-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 12px 12px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top Bar */
.top-bar {
    height: 56px;
    background: linear-gradient(90deg, rgba(88, 28, 135, 0.95) 0%, rgba(17, 24, 39, 0.95) 100%);
    backdrop-filter: blur(30px) saturate(150%);
    -webkit-backdrop-filter: blur(30px) saturate(150%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(88, 28, 135, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.mobile-menu-btn {
    display: none;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all var(--transition-base);
}

.mobile-menu-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.page-title {
    font-size: 16px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.01em;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    position: relative;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(139, 92, 246, 0.4);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition-base);
}

.user-menu:hover {
    background: rgba(139, 92, 246, 0.4);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
}

.user-menu span {
    color: white;
    font-size: 12px;
    font-weight: 500;
}

/* Main Content Area */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.main-content::-webkit-scrollbar {
    width: 8px;
}

.main-content::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb {
    background: #D2D2D7;
    border-radius: 10px;
}

.main-content::-webkit-scrollbar-thumb:hover {
    background: #A1A1A6;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid var(--separator);
    box-shadow: var(--shadow-sm);
}

.welcome-section h2 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 13px;
    letter-spacing: 0;
    line-height: 1.5;
}

/* Content Placeholder */
.content-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    text-align: center;
    background: #FAFAFA;
    border: 2px dashed #E5E5EA;
    border-radius: 16px;
    margin-top: 32px;
}

.content-placeholder i {
    font-size: 64px;
    color: var(--primary-purple);
    margin-bottom: 20px;
    opacity: 0.4;
}

.content-placeholder p {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 24px;
}

/* Call Stats Grid */
.call-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.call-stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    text-align: center;
    transition: all var(--transition-base);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.call-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.call-stat-card i {
    font-size: 32px;
    color: var(--primary-purple);
    margin-bottom: 12px;
}

.call-stat-card h3 {
    font-size: 32px;
    color: var(--text-primary);
    font-weight: 700;
    margin-bottom: 4px;
}

.call-stat-card p {
    color: var(--text-secondary);
    font-size: 13px;
}

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

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .top-bar {
        padding: 0 20px;
    }

    .main-content {
        padding: 20px;
    }

    .page-title {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 280px;
    }

    .top-bar-right .user-menu {
        display: none;
    }

    .call-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .welcome-section h2 {
        font-size: 22px;
    }
}
