/* ================================================================
   LAYOUT.CSS - Sidebar & Main Layout with Proper Margins
   ================================================================ */

/* ================================================================
   APP CONTAINER
   ================================================================ */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

/* ================================================================
   SIDEBAR CONTAINER
   ================================================================ */
#sidebar-container {
    flex-shrink: 0;
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.app-sidebar {
    width: 260px;
    height: 100vh;
    background: #ffffff;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.02);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Sidebar Header */
.sidebar-header {
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.brand-name {
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
}

.brand-name span {
    color: #4f46e5;
}

/* Mobile brand in sidebar */
.sidebar-mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.sidebar-mobile-brand .brand-icon-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-mobile-brand .brand-name-small {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.sidebar-mobile-brand .brand-name-small span {
    color: #4f46e5;
}

.sidebar-close-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 20px;
    cursor: pointer;
    display: none;
    padding: 4px;
    border-radius: 6px;
}

.sidebar-close-btn:hover {
    background: #f1f5f9;
}

/* Sidebar Content */
.sidebar-content {
    flex: 1;
    padding: 20px 16px;
    overflow-y: auto;
}

.nav-group-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    padding: 12px 12px 6px;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: #64748b;
    text-decoration: none;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.nav-link i {
    font-size: 20px;
    color: #64748b;
    transition: color 0.2s ease;
}

.nav-link:hover {
    background: #f8fafc;
    color: #0f172a;
}

.nav-link:hover i {
    color: #0f172a;
}

.nav-item.active .nav-link {
    background: rgba(79, 70, 229, 0.08);
    color: #4f46e5;
}

.nav-item.active .nav-link i {
    color: #4f46e5;
}

.nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.nav-badge.live {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.user-card-mini {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.user-details h5 {
    font-size: 13.5px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.user-details span {
    font-size: 11px;
    color: #64748b;
}

.btn-logout {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: 0.2s;
}

.btn-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

/* ================================================================
   MAIN CONTENT - PROPER MARGIN FOR SIDEBAR
   ================================================================ */
.main-content {
    flex: 1;
    margin-left: 260px;
    min-height: 100vh;
    background: #f4f6f8;
    transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    width: calc(100% - 260px);
    padding: 0;
    position: relative;
}

/* ================================================================
   CONTENT WRAPPER - INTERNAL PADDING FOR CONTENT
   ================================================================ */
.content-wrapper {
    padding: 30px 35px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ================================================================
   TOP BAR
   ================================================================ */
.top-bar {
    height: 76px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 35px;
    position: sticky;
    top: 0;
    z-index: 99;
    gap: 16px;
}

.top-bar-left,
.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-toggle-sidebar {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #0f172a;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.btn-toggle-sidebar:hover {
    background: #f1f5f9;
}

/* Mobile Brand in Top Bar */
.mobile-brand {
    display: none;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.mobile-brand .brand-icon-small {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #4f46e5, #6366f1);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.mobile-brand .brand-name-small {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
}

.mobile-brand .brand-name-small span {
    color: #4f46e5;
}

.search-wrapper {
    position: relative;
    width: 340px;
}

.search-wrapper i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 18px;
}

.search-wrapper input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    color: #0f172a;
    transition: all 0.3s ease;
    outline: none;
}

.search-wrapper input:focus {
    background: #ffffff;
    border-color: #4f46e5;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.btn-header-fb,
.btn-header-yt {
    padding: 10px 20px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}

.btn-header-fb {
    background: #eff6ff;
    color: #1877f2;
    border-color: #bfdbfe;
}

.btn-header-fb:hover {
    background: #1877f2;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(24, 119, 242, 0.2);
}

.btn-header-yt {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.btn-header-yt:hover {
    background: #dc2626;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(220, 38, 38, 0.2);
}

.avatar {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #4f46e5, #818cf8);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.25);
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 4px;
    border-radius: 999px;
    transition: 0.2s;
}

.user-profile:hover {
    background: #f1f5f9;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* Desktop */
@media (min-width: 992px) {
    #sidebar-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 260px;
        height: 100vh;
        z-index: 1000;
    }

    .app-sidebar {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        display: none !important;
    }

    .sidebar-close-btn {
        display: none !important;
    }

    .btn-toggle-sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 260px;
        width: calc(100% - 260px);
    }

    .sidebar-brand {
        display: flex !important;
    }

    .sidebar-mobile-brand {
        display: none !important;
    }

    .mobile-brand {
        display: none !important;
    }
}

/* Mobile */
@media (max-width: 991px) {
    #sidebar-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 0;
        height: 100vh;
        z-index: 1001;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        z-index: 1001;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
    }

    .app-sidebar.show {
        transform: translateX(0);
    }

    .sidebar-close-btn {
        display: block !important;
    }

    .btn-toggle-sidebar {
        display: flex !important;
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .content-wrapper {
        padding: 20px 16px;
    }

    .top-bar {
        padding: 0 16px;
        height: 64px;
    }

    .top-bar-left {
        gap: 8px;
    }

    .top-bar-right {
        gap: 8px;
    }

    .search-wrapper {
        display: none;
    }

    .btn-text {
        display: none !important;
    }

    .btn-header-fb,
    .btn-header-yt {
        padding: 8px;
        font-size: 18px;
        gap: 0;
        width: 38px;
        height: 38px;
        justify-content: center;
        border-radius: 50%;
        min-width: 38px;
    }

    .avatar {
        width: 38px;
        height: 38px;
        font-size: 14px;
    }

    .sidebar-brand {
        display: none !important;
    }

    .sidebar-mobile-brand {
        display: flex !important;
    }

    .mobile-brand {
        display: flex !important;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .app-sidebar {
        width: 280px;
    }

    .content-wrapper {
        padding: 14px 10px;
    }

    .btn-header-fb,
    .btn-header-yt {
        width: 34px;
        height: 34px;
        font-size: 16px;
        min-width: 34px;
        padding: 6px;
    }

    .avatar {
        width: 34px;
        height: 34px;
        font-size: 12px;
    }

    .top-bar {
        height: 56px;
        padding: 0 10px;
    }

    .btn-toggle-sidebar {
        width: 36px;
        height: 36px;
        font-size: 20px;
        padding: 4px;
    }
}